openacc_lib.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. ! OpenACC Runtime Library Definitions. -*- mode: fortran -*-
  2. ! Copyright (C) 2014-2015 Free Software Foundation, Inc.
  3. ! Contributed by Tobias Burnus <burnus@net-b.de>
  4. ! and Mentor Embedded.
  5. ! This file is part of the GNU Offloading and Multi Processing Library
  6. ! (libgomp).
  7. ! Libgomp is free software; you can redistribute it and/or modify it
  8. ! under the terms of the GNU General Public License as published by
  9. ! the Free Software Foundation; either version 3, or (at your option)
  10. ! any later version.
  11. ! Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
  12. ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. ! FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. ! more details.
  15. ! Under Section 7 of GPL version 3, you are granted additional
  16. ! permissions described in the GCC Runtime Library Exception, version
  17. ! 3.1, as published by the Free Software Foundation.
  18. ! You should have received a copy of the GNU General Public License and
  19. ! a copy of the GCC Runtime Library Exception along with this program;
  20. ! see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  21. ! <http://www.gnu.org/licenses/>.
  22. ! NOTE: Due to the use of dimension (..), the code only works when compiled
  23. ! with -std=f2008ts/gnu/legacy but not with other standard settings.
  24. ! Alternatively, the user can use the module version, which permits
  25. ! compilation with -std=f95.
  26. integer, parameter :: acc_device_kind = 4
  27. ! Keep in sync with include/gomp-constants.h.
  28. integer (acc_device_kind), parameter :: acc_device_none = 0
  29. integer (acc_device_kind), parameter :: acc_device_default = 1
  30. integer (acc_device_kind), parameter :: acc_device_host = 2
  31. integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3
  32. integer (acc_device_kind), parameter :: acc_device_not_host = 4
  33. integer (acc_device_kind), parameter :: acc_device_nvidia = 5
  34. integer, parameter :: acc_handle_kind = 4
  35. ! Keep in sync with include/gomp-constants.h.
  36. integer (acc_handle_kind), parameter :: acc_async_noval = -1
  37. integer (acc_handle_kind), parameter :: acc_async_sync = -2
  38. integer, parameter :: openacc_version = 201306
  39. interface acc_get_num_devices
  40. function acc_get_num_devices_h (d)
  41. import acc_device_kind
  42. integer acc_get_num_devices_h
  43. integer (acc_device_kind) d
  44. end function
  45. end interface
  46. interface acc_set_device_type
  47. subroutine acc_set_device_type_h (d)
  48. import acc_device_kind
  49. integer (acc_device_kind) d
  50. end subroutine
  51. end interface
  52. interface acc_get_device_type
  53. function acc_get_device_type_h ()
  54. import acc_device_kind
  55. integer (acc_device_kind) acc_get_device_type_h
  56. end function
  57. end interface
  58. interface acc_set_device_num
  59. subroutine acc_set_device_num_h (n, d)
  60. import acc_device_kind
  61. integer n
  62. integer (acc_device_kind) d
  63. end subroutine
  64. end interface
  65. interface acc_get_device_num
  66. function acc_get_device_num_h (d)
  67. import acc_device_kind
  68. integer acc_get_device_num_h
  69. integer (acc_device_kind) d
  70. end function
  71. end interface
  72. interface acc_async_test
  73. function acc_async_test_h (a)
  74. logical acc_async_test_h
  75. integer a
  76. end function
  77. end interface
  78. interface acc_async_test_all
  79. function acc_async_test_all_h ()
  80. logical acc_async_test_all_h
  81. end function
  82. end interface
  83. interface acc_wait
  84. subroutine acc_wait_h (a)
  85. integer a
  86. end subroutine
  87. end interface
  88. interface acc_wait_async
  89. subroutine acc_wait_async_h (a1, a2)
  90. integer a1, a2
  91. end subroutine
  92. end interface
  93. interface acc_wait_all
  94. subroutine acc_wait_all_h ()
  95. end subroutine
  96. end interface
  97. interface acc_wait_all_async
  98. subroutine acc_wait_all_async_h (a)
  99. integer a
  100. end subroutine
  101. end interface
  102. interface acc_init
  103. subroutine acc_init_h (devicetype)
  104. import acc_device_kind
  105. integer (acc_device_kind) devicetype
  106. end subroutine
  107. end interface
  108. interface acc_shutdown
  109. subroutine acc_shutdown_h (devicetype)
  110. import acc_device_kind
  111. integer (acc_device_kind) devicetype
  112. end subroutine
  113. end interface
  114. interface acc_on_device
  115. function acc_on_device_h (devicetype)
  116. import acc_device_kind
  117. logical acc_on_device_h
  118. integer (acc_device_kind) devicetype
  119. end function
  120. end interface
  121. ! acc_malloc: Only available in C/C++
  122. ! acc_free: Only available in C/C++
  123. interface acc_copyin
  124. subroutine acc_copyin_32_h (a, len)
  125. use iso_c_binding, only: c_int32_t
  126. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  127. type (*), dimension (*) :: a
  128. integer (c_int32_t) len
  129. end subroutine
  130. subroutine acc_copyin_64_h (a, len)
  131. use iso_c_binding, only: c_int64_t
  132. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  133. type (*), dimension (*) :: a
  134. integer (c_int64_t) len
  135. end subroutine
  136. subroutine acc_copyin_array_h (a)
  137. type (*), dimension (..), contiguous :: a
  138. end subroutine
  139. end interface
  140. interface acc_present_or_copyin
  141. subroutine acc_present_or_copyin_32_h (a, len)
  142. use iso_c_binding, only: c_int32_t
  143. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  144. type (*), dimension (*) :: a
  145. integer (c_int32_t) len
  146. end subroutine
  147. subroutine acc_present_or_copyin_64_h (a, len)
  148. use iso_c_binding, only: c_int64_t
  149. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  150. type (*), dimension (*) :: a
  151. integer (c_int64_t) len
  152. end subroutine
  153. subroutine acc_present_or_copyin_array_h (a)
  154. type (*), dimension (..), contiguous :: a
  155. end subroutine
  156. end interface
  157. interface acc_pcopyin
  158. subroutine acc_pcopyin_32_h (a, len)
  159. use iso_c_binding, only: c_int32_t
  160. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  161. type (*), dimension (*) :: a
  162. integer (c_int32_t) len
  163. end subroutine
  164. subroutine acc_pcopyin_64_h (a, len)
  165. use iso_c_binding, only: c_int64_t
  166. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  167. type (*), dimension (*) :: a
  168. integer (c_int64_t) len
  169. end subroutine
  170. subroutine acc_pcopyin_array_h (a)
  171. type (*), dimension (..), contiguous :: a
  172. end subroutine
  173. end interface
  174. interface acc_create
  175. subroutine acc_create_32_h (a, len)
  176. use iso_c_binding, only: c_int32_t
  177. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  178. type (*), dimension (*) :: a
  179. integer (c_int32_t) len
  180. end subroutine
  181. subroutine acc_create_64_h (a, len)
  182. use iso_c_binding, only: c_int64_t
  183. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  184. type (*), dimension (*) :: a
  185. integer (c_int64_t) len
  186. end subroutine
  187. subroutine acc_create_array_h (a)
  188. type (*), dimension (..), contiguous :: a
  189. end subroutine
  190. end interface
  191. interface acc_present_or_create
  192. subroutine acc_present_or_create_32_h (a, len)
  193. use iso_c_binding, only: c_int32_t
  194. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  195. type (*), dimension (*) :: a
  196. integer (c_int32_t) len
  197. end subroutine
  198. subroutine acc_present_or_create_64_h (a, len)
  199. use iso_c_binding, only: c_int64_t
  200. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  201. type (*), dimension (*) :: a
  202. integer (c_int64_t) len
  203. end subroutine
  204. subroutine acc_present_or_create_array_h (a)
  205. type (*), dimension (..), contiguous :: a
  206. end subroutine
  207. end interface
  208. interface acc_pcreate
  209. subroutine acc_pcreate_32_h (a, len)
  210. use iso_c_binding, only: c_int32_t
  211. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  212. type (*), dimension (*) :: a
  213. integer (c_int32_t) len
  214. end subroutine
  215. subroutine acc_pcreate_64_h (a, len)
  216. use iso_c_binding, only: c_int64_t
  217. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  218. type (*), dimension (*) :: a
  219. integer (c_int64_t) len
  220. end subroutine
  221. subroutine acc_pcreate_array_h (a)
  222. type (*), dimension (..), contiguous :: a
  223. end subroutine
  224. end interface
  225. interface acc_copyout
  226. subroutine acc_copyout_32_h (a, len)
  227. use iso_c_binding, only: c_int32_t
  228. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  229. type (*), dimension (*) :: a
  230. integer (c_int32_t) len
  231. end subroutine
  232. subroutine acc_copyout_64_h (a, len)
  233. use iso_c_binding, only: c_int64_t
  234. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  235. type (*), dimension (*) :: a
  236. integer (c_int64_t) len
  237. end subroutine
  238. subroutine acc_copyout_array_h (a)
  239. type (*), dimension (..), contiguous :: a
  240. end subroutine
  241. end interface
  242. interface acc_delete
  243. subroutine acc_delete_32_h (a, len)
  244. use iso_c_binding, only: c_int32_t
  245. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  246. type (*), dimension (*) :: a
  247. integer (c_int32_t) len
  248. end subroutine
  249. subroutine acc_delete_64_h (a, len)
  250. use iso_c_binding, only: c_int64_t
  251. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  252. type (*), dimension (*) :: a
  253. integer (c_int64_t) len
  254. end subroutine
  255. subroutine acc_delete_array_h (a)
  256. type (*), dimension (..), contiguous :: a
  257. end subroutine
  258. end interface
  259. interface acc_update_device
  260. subroutine acc_update_device_32_h (a, len)
  261. use iso_c_binding, only: c_int32_t
  262. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  263. type (*), dimension (*) :: a
  264. integer (c_int32_t) len
  265. end subroutine
  266. subroutine acc_update_device_64_h (a, len)
  267. use iso_c_binding, only: c_int64_t
  268. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  269. type (*), dimension (*) :: a
  270. integer (c_int64_t) len
  271. end subroutine
  272. subroutine acc_update_device_array_h (a)
  273. type (*), dimension (..), contiguous :: a
  274. end subroutine
  275. end interface
  276. interface acc_update_self
  277. subroutine acc_update_self_32_h (a, len)
  278. use iso_c_binding, only: c_int32_t
  279. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  280. type (*), dimension (*) :: a
  281. integer (c_int32_t) len
  282. end subroutine
  283. subroutine acc_update_self_64_h (a, len)
  284. use iso_c_binding, only: c_int64_t
  285. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  286. type (*), dimension (*) :: a
  287. integer (c_int64_t) len
  288. end subroutine
  289. subroutine acc_update_self_array_h (a)
  290. type (*), dimension (..), contiguous :: a
  291. end subroutine
  292. end interface
  293. ! acc_map_data: Only available in C/C++
  294. ! acc_unmap_data: Only available in C/C++
  295. ! acc_deviceptr: Only available in C/C++
  296. ! acc_ostptr: Only available in C/C++
  297. interface acc_is_present
  298. function acc_is_present_32_h (a, len)
  299. use iso_c_binding, only: c_int32_t
  300. logical acc_is_present_32_h
  301. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  302. type (*), dimension (*) :: a
  303. integer (c_int32_t) len
  304. end function
  305. function acc_is_present_64_h (a, len)
  306. use iso_c_binding, only: c_int64_t
  307. logical acc_is_present_64_h
  308. !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
  309. type (*), dimension (*) :: a
  310. integer (c_int64_t) len
  311. end function
  312. function acc_is_present_array_h (a)
  313. logical acc_is_present_array_h
  314. type (*), dimension (..), contiguous :: a
  315. end function
  316. end interface
  317. ! acc_memcpy_to_device: Only available in C/C++
  318. ! acc_memcpy_from_device: Only available in C/C++