Update 'Q' constraint documentation.
[official-gcc.git] / libgomp / openacc_lib.h
blobb327ba7640382cd827d103dc54138cb289b480a4
1 ! OpenACC Runtime Library Definitions. -*- mode: fortran -*-
3 ! Copyright (C) 2014-2020 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 ! Keep in sync with openacc.f90 and config/accel/openacc.f90.
37 integer, parameter :: acc_device_kind = 4
39 ! Keep in sync with include/gomp-constants.h.
40 integer (acc_device_kind), parameter :: acc_device_none = 0
41 integer (acc_device_kind), parameter :: acc_device_default = 1
42 integer (acc_device_kind), parameter :: acc_device_host = 2
43 ! integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3
44 ! removed.
45 integer (acc_device_kind), parameter :: acc_device_not_host = 4
46 integer (acc_device_kind), parameter :: acc_device_nvidia = 5
47 integer (acc_device_kind), parameter :: acc_device_gcn = 8
49 integer, parameter :: acc_handle_kind = 4
51 ! Keep in sync with include/gomp-constants.h.
52 integer (acc_handle_kind), parameter :: acc_async_noval = -1
53 integer (acc_handle_kind), parameter :: acc_async_sync = -2
55 integer, parameter :: openacc_version = 201306
57 interface acc_get_num_devices
58 function acc_get_num_devices_h (d)
59 import acc_device_kind
60 integer acc_get_num_devices_h
61 integer (acc_device_kind) d
62 end function
63 end interface
65 interface acc_set_device_type
66 subroutine acc_set_device_type_h (d)
67 import acc_device_kind
68 integer (acc_device_kind) d
69 end subroutine
70 end interface
72 interface acc_get_device_type
73 function acc_get_device_type_h ()
74 import acc_device_kind
75 integer (acc_device_kind) acc_get_device_type_h
76 end function
77 end interface
79 interface acc_set_device_num
80 subroutine acc_set_device_num_h (n, d)
81 import acc_device_kind
82 integer n
83 integer (acc_device_kind) d
84 end subroutine
85 end interface
87 interface acc_get_device_num
88 function acc_get_device_num_h (d)
89 import acc_device_kind
90 integer acc_get_device_num_h
91 integer (acc_device_kind) d
92 end function
93 end interface
95 interface acc_async_test
96 function acc_async_test_h (a)
97 logical acc_async_test_h
98 integer a
99 end function
100 end interface
102 interface acc_async_test_all
103 function acc_async_test_all_h ()
104 logical acc_async_test_all_h
105 end function
106 end interface
108 interface acc_wait
109 subroutine acc_wait_h (a)
110 integer a
111 end subroutine
112 end interface
114 ! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait.
115 interface acc_async_wait
116 procedure :: acc_wait_h
117 end interface
119 interface acc_wait_async
120 subroutine acc_wait_async_h (a1, a2)
121 integer a1, a2
122 end subroutine
123 end interface
125 interface acc_wait_all
126 subroutine acc_wait_all_h ()
127 end subroutine
128 end interface
130 ! acc_async_wait_all is an OpenACC 1.0 compatibility name for
131 ! acc_wait_all.
132 interface acc_async_wait_all
133 procedure :: acc_wait_all_h
134 end interface
136 interface acc_wait_all_async
137 subroutine acc_wait_all_async_h (a)
138 integer a
139 end subroutine
140 end interface
142 interface acc_init
143 subroutine acc_init_h (devicetype)
144 import acc_device_kind
145 integer (acc_device_kind) devicetype
146 end subroutine
147 end interface
149 interface acc_shutdown
150 subroutine acc_shutdown_h (devicetype)
151 import acc_device_kind
152 integer (acc_device_kind) devicetype
153 end subroutine
154 end interface
156 interface acc_on_device
157 function acc_on_device_h (devicetype)
158 import acc_device_kind
159 logical acc_on_device_h
160 integer (acc_device_kind) devicetype
161 end function
162 end interface
164 ! acc_malloc: Only available in C/C++
165 ! acc_free: Only available in C/C++
167 interface acc_copyin
168 subroutine acc_copyin_32_h (a, len)
169 use iso_c_binding, only: c_int32_t
170 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
171 type (*), dimension (*) :: a
172 integer (c_int32_t) len
173 end subroutine
175 subroutine acc_copyin_64_h (a, len)
176 use iso_c_binding, only: c_int64_t
177 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
178 type (*), dimension (*) :: a
179 integer (c_int64_t) len
180 end subroutine
182 subroutine acc_copyin_array_h (a)
183 type (*), dimension (..), contiguous :: a
184 end subroutine
185 end interface
187 interface acc_present_or_copyin
188 subroutine acc_present_or_copyin_32_h (a, len)
189 use iso_c_binding, only: c_int32_t
190 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
191 type (*), dimension (*) :: a
192 integer (c_int32_t) len
193 end subroutine
195 subroutine acc_present_or_copyin_64_h (a, len)
196 use iso_c_binding, only: c_int64_t
197 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
198 type (*), dimension (*) :: a
199 integer (c_int64_t) len
200 end subroutine
202 subroutine acc_present_or_copyin_array_h (a)
203 type (*), dimension (..), contiguous :: a
204 end subroutine
205 end interface
207 interface acc_pcopyin
208 procedure :: acc_present_or_copyin_32_h
209 procedure :: acc_present_or_copyin_64_h
210 procedure :: acc_present_or_copyin_array_h
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 procedure :: acc_present_or_create_32_h
255 procedure :: acc_present_or_create_64_h
256 procedure :: acc_present_or_create_array_h
257 end interface
259 interface acc_copyout
260 subroutine acc_copyout_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
267 subroutine acc_copyout_64_h (a, len)
268 use iso_c_binding, only: c_int64_t
269 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
270 type (*), dimension (*) :: a
271 integer (c_int64_t) len
272 end subroutine
274 subroutine acc_copyout_array_h (a)
275 type (*), dimension (..), contiguous :: a
276 end subroutine
277 end interface
279 interface acc_copyout_finalize
280 subroutine acc_copyout_finalize_32_h (a, len)
281 use iso_c_binding, only: c_int32_t
282 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
283 type (*), dimension (*) :: a
284 integer (c_int32_t) len
285 end subroutine
287 subroutine acc_copyout_finalize_64_h (a, len)
288 use iso_c_binding, only: c_int64_t
289 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
290 type (*), dimension (*) :: a
291 integer (c_int64_t) len
292 end subroutine
294 subroutine acc_copyout_finalize_array_h (a)
295 type (*), dimension (..), contiguous :: a
296 end subroutine
297 end interface
299 interface acc_delete
300 subroutine acc_delete_32_h (a, len)
301 use iso_c_binding, only: c_int32_t
302 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
303 type (*), dimension (*) :: a
304 integer (c_int32_t) len
305 end subroutine
307 subroutine acc_delete_64_h (a, len)
308 use iso_c_binding, only: c_int64_t
309 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
310 type (*), dimension (*) :: a
311 integer (c_int64_t) len
312 end subroutine
314 subroutine acc_delete_array_h (a)
315 type (*), dimension (..), contiguous :: a
316 end subroutine
317 end interface
319 interface acc_delete_finalize
320 subroutine acc_delete_finalize_32_h (a, len)
321 use iso_c_binding, only: c_int32_t
322 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
323 type (*), dimension (*) :: a
324 integer (c_int32_t) len
325 end subroutine
327 subroutine acc_delete_finalize_64_h (a, len)
328 use iso_c_binding, only: c_int64_t
329 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
330 type (*), dimension (*) :: a
331 integer (c_int64_t) len
332 end subroutine
334 subroutine acc_delete_finalize_array_h (a)
335 type (*), dimension (..), contiguous :: a
336 end subroutine
337 end interface
339 interface acc_update_device
340 subroutine acc_update_device_32_h (a, len)
341 use iso_c_binding, only: c_int32_t
342 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
343 type (*), dimension (*) :: a
344 integer (c_int32_t) len
345 end subroutine
347 subroutine acc_update_device_64_h (a, len)
348 use iso_c_binding, only: c_int64_t
349 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
350 type (*), dimension (*) :: a
351 integer (c_int64_t) len
352 end subroutine
354 subroutine acc_update_device_array_h (a)
355 type (*), dimension (..), contiguous :: a
356 end subroutine
357 end interface
359 interface acc_update_self
360 subroutine acc_update_self_32_h (a, len)
361 use iso_c_binding, only: c_int32_t
362 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
363 type (*), dimension (*) :: a
364 integer (c_int32_t) len
365 end subroutine
367 subroutine acc_update_self_64_h (a, len)
368 use iso_c_binding, only: c_int64_t
369 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
370 type (*), dimension (*) :: a
371 integer (c_int64_t) len
372 end subroutine
374 subroutine acc_update_self_array_h (a)
375 type (*), dimension (..), contiguous :: a
376 end subroutine
377 end interface
379 ! acc_map_data: Only available in C/C++
380 ! acc_unmap_data: Only available in C/C++
381 ! acc_deviceptr: Only available in C/C++
382 ! acc_hostptr: Only available in C/C++
384 interface acc_is_present
385 function acc_is_present_32_h (a, len)
386 use iso_c_binding, only: c_int32_t
387 logical acc_is_present_32_h
388 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
389 type (*), dimension (*) :: a
390 integer (c_int32_t) len
391 end function
393 function acc_is_present_64_h (a, len)
394 use iso_c_binding, only: c_int64_t
395 logical acc_is_present_64_h
396 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
397 type (*), dimension (*) :: a
398 integer (c_int64_t) len
399 end function
401 function acc_is_present_array_h (a)
402 logical acc_is_present_array_h
403 type (*), dimension (..), contiguous :: a
404 end function
405 end interface
407 ! acc_memcpy_to_device: Only available in C/C++
408 ! acc_memcpy_from_device: Only available in C/C++
410 interface acc_copyin_async
411 subroutine acc_copyin_async_32_h (a, len, async)
412 use iso_c_binding, only: c_int32_t
413 import acc_handle_kind
414 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
415 type (*), dimension (*) :: a
416 integer (c_int32_t) len
417 integer (acc_handle_kind) async
418 end subroutine
420 subroutine acc_copyin_async_64_h (a, len, async)
421 use iso_c_binding, only: c_int64_t
422 import acc_handle_kind
423 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
424 type (*), dimension (*) :: a
425 integer (c_int64_t) len
426 integer (acc_handle_kind) async
427 end subroutine
429 subroutine acc_copyin_async_array_h (a, async_)
430 import acc_handle_kind
431 type (*), dimension (..), contiguous :: a
432 integer (acc_handle_kind) async_
433 end subroutine
434 end interface
436 interface acc_create_async
437 subroutine acc_create_async_32_h (a, len, async)
438 use iso_c_binding, only: c_int32_t
439 import acc_handle_kind
440 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
441 type (*), dimension (*) :: a
442 integer (c_int32_t) len
443 integer (acc_handle_kind) async
444 end subroutine
446 subroutine acc_create_async_64_h (a, len, async)
447 use iso_c_binding, only: c_int64_t
448 import acc_handle_kind
449 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
450 type (*), dimension (*) :: a
451 integer (c_int64_t) len
452 integer (acc_handle_kind) async
453 end subroutine
455 subroutine acc_create_async_array_h (a, async_)
456 import acc_handle_kind
457 type (*), dimension (..), contiguous :: a
458 integer (acc_handle_kind) async_
459 end subroutine
460 end interface
462 interface acc_copyout_async
463 subroutine acc_copyout_async_32_h (a, len, async)
464 use iso_c_binding, only: c_int32_t
465 import acc_handle_kind
466 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
467 type (*), dimension (*) :: a
468 integer (c_int32_t) len
469 integer (acc_handle_kind) async
470 end subroutine
472 subroutine acc_copyout_async_64_h (a, len, async)
473 use iso_c_binding, only: c_int64_t
474 import acc_handle_kind
475 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
476 type (*), dimension (*) :: a
477 integer (c_int64_t) len
478 integer (acc_handle_kind) async
479 end subroutine
481 subroutine acc_copyout_async_array_h (a, async_)
482 import acc_handle_kind
483 type (*), dimension (..), contiguous :: a
484 integer (acc_handle_kind) async_
485 end subroutine
486 end interface
488 interface acc_delete_async
489 subroutine acc_delete_async_32_h (a, len, async)
490 use iso_c_binding, only: c_int32_t
491 import acc_handle_kind
492 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
493 type (*), dimension (*) :: a
494 integer (c_int32_t) len
495 integer (acc_handle_kind) async
496 end subroutine
498 subroutine acc_delete_async_64_h (a, len, async)
499 use iso_c_binding, only: c_int64_t
500 import acc_handle_kind
501 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
502 type (*), dimension (*) :: a
503 integer (c_int64_t) len
504 integer (acc_handle_kind) async
505 end subroutine
507 subroutine acc_delete_async_array_h (a, async_)
508 import acc_handle_kind
509 type (*), dimension (..), contiguous :: a
510 integer (acc_handle_kind) async_
511 end subroutine
512 end interface
514 interface acc_update_device_async
515 subroutine acc_update_device_async_32_h (a, len, async)
516 use iso_c_binding, only: c_int32_t
517 import acc_handle_kind
518 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
519 type (*), dimension (*) :: a
520 integer (c_int32_t) len
521 integer (acc_handle_kind) async
522 end subroutine
524 subroutine acc_update_device_async_64_h (a, len, async)
525 use iso_c_binding, only: c_int64_t
526 import acc_handle_kind
527 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
528 type (*), dimension (*) :: a
529 integer (c_int64_t) len
530 integer (acc_handle_kind) async
531 end subroutine
533 subroutine acc_update_device_async_array_h (a, async_)
534 import acc_handle_kind
535 type (*), dimension (..), contiguous :: a
536 integer (acc_handle_kind) async_
537 end subroutine
538 end interface
540 interface acc_update_self_async
541 subroutine acc_update_self_async_32_h (a, len, async)
542 use iso_c_binding, only: c_int32_t
543 import acc_handle_kind
544 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
545 type (*), dimension (*) :: a
546 integer (c_int32_t) len
547 integer (acc_handle_kind) async
548 end subroutine
550 subroutine acc_update_self_async_64_h (a, len, async)
551 use iso_c_binding, only: c_int64_t
552 import acc_handle_kind
553 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
554 type (*), dimension (*) :: a
555 integer (c_int64_t) len
556 integer (acc_handle_kind) async
557 end subroutine
559 subroutine acc_update_self_async_array_h (a, async_)
560 import acc_handle_kind
561 type (*), dimension (..), contiguous :: a
562 integer (acc_handle_kind) async_
563 end subroutine
564 end interface