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