libstdc++: Use std::type_identity_t in <string_view> as per LWG 3950 [PR114400]
[official-gcc.git] / libgomp / openacc_lib.h
blob913c3f1aa3dc91565119098416c228352698a96a
1 ! OpenACC Runtime Library Definitions. -*- mode: fortran -*-
3 ! Copyright (C) 2014-2024 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_current = -1
41 integer (acc_device_kind), parameter :: acc_device_none = 0
42 integer (acc_device_kind), parameter :: acc_device_default = 1
43 integer (acc_device_kind), parameter :: acc_device_host = 2
44 ! integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3
45 ! removed.
46 integer (acc_device_kind), parameter :: acc_device_not_host = 4
47 integer (acc_device_kind), parameter :: acc_device_nvidia = 5
48 integer (acc_device_kind), parameter :: acc_device_radeon = 8
50 integer, parameter :: acc_device_property_kind = 4
51 ! OpenACC 2.6/2.7/3.0 used acc_device_property; in a spec update the
52 ! missing '_kind' was added for consistency. For backward compatibility, keep:
53 integer, parameter :: acc_device_property &
54 & = acc_device_property_kind
56 integer (acc_device_property_kind), parameter :: &
57 & acc_property_memory = 1
58 integer (acc_device_property_kind), parameter :: &
59 & acc_property_free_memory = 2
60 integer (acc_device_property_kind), parameter :: &
61 & acc_property_name = int(Z'10001')
62 integer (acc_device_property_kind), parameter :: &
63 & acc_property_vendor = int(Z'10002')
64 integer (acc_device_property_kind), parameter :: &
65 & acc_property_driver = int(Z'10003')
67 integer, parameter :: acc_handle_kind = 4
69 ! Keep in sync with include/gomp-constants.h.
70 integer (acc_handle_kind), parameter :: acc_async_noval = -1
71 integer (acc_handle_kind), parameter :: acc_async_sync = -2
73 integer, parameter :: openacc_version = 201711
75 interface acc_get_num_devices
76 function acc_get_num_devices_h (devicetype)
77 import acc_device_kind
78 integer acc_get_num_devices_h
79 integer (acc_device_kind) devicetype
80 end function
81 end interface
83 interface acc_set_device_type
84 subroutine acc_set_device_type_h (devicetype)
85 import acc_device_kind
86 integer (acc_device_kind) devicetype
87 end subroutine
88 end interface
90 interface acc_get_device_type
91 function acc_get_device_type_h ()
92 import acc_device_kind
93 integer (acc_device_kind) acc_get_device_type_h
94 end function
95 end interface
97 interface acc_set_device_num
98 subroutine acc_set_device_num_h (devicenum, devicetype)
99 import acc_device_kind
100 integer devicenum
101 integer (acc_device_kind) devicetype
102 end subroutine
103 end interface
105 interface acc_get_device_num
106 function acc_get_device_num_h (devicetype)
107 import acc_device_kind
108 integer acc_get_device_num_h
109 integer (acc_device_kind) devicetype
110 end function
111 end interface
113 interface acc_get_property
114 function acc_get_property_h (devicenum, devicetype, &
115 & property)
116 use iso_c_binding, only: c_size_t
117 import acc_device_kind, acc_device_property_kind
118 implicit none (type, external)
119 integer (c_size_t) :: acc_get_property_h
120 integer, value :: devicenum
121 integer (acc_device_kind), value :: devicetype
122 integer (acc_device_property_kind), value :: property
123 end function
124 end interface
126 interface acc_get_property_string
127 subroutine acc_get_property_string_h (devicenum, devicetype, &
128 & property, string)
129 import acc_device_kind, acc_device_property_kind
130 implicit none (type, external)
131 integer, value :: devicenum
132 integer (acc_device_kind), value :: devicetype
133 integer (acc_device_property_kind), value :: property
134 character (*) :: string
135 end subroutine
136 end interface
138 interface acc_async_test
139 function acc_async_test_h (arg)
140 logical acc_async_test_h
141 integer arg
142 end function
143 end interface
145 interface acc_async_test_all
146 function acc_async_test_all_h ()
147 logical acc_async_test_all_h
148 end function
149 end interface
151 interface acc_wait
152 subroutine acc_wait_h (arg)
153 integer arg
154 end subroutine
155 end interface
157 ! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait.
158 interface acc_async_wait
159 procedure :: acc_wait_h
160 end interface
162 interface acc_wait_async
163 subroutine acc_wait_async_h (arg, async)
164 integer arg, async
165 end subroutine
166 end interface
168 interface acc_wait_all
169 subroutine acc_wait_all_h ()
170 end subroutine
171 end interface
173 ! acc_async_wait_all is an OpenACC 1.0 compatibility name for
174 ! acc_wait_all.
175 interface acc_async_wait_all
176 procedure :: acc_wait_all_h
177 end interface
179 interface acc_wait_all_async
180 subroutine acc_wait_all_async_h (async)
181 integer async
182 end subroutine
183 end interface
185 interface acc_init
186 subroutine acc_init_h (devicetype)
187 import acc_device_kind
188 integer (acc_device_kind) devicetype
189 end subroutine
190 end interface
192 interface acc_shutdown
193 subroutine acc_shutdown_h (devicetype)
194 import acc_device_kind
195 integer (acc_device_kind) devicetype
196 end subroutine
197 end interface
199 interface acc_on_device
200 function acc_on_device_h (devicetype)
201 import acc_device_kind
202 logical acc_on_device_h
203 integer (acc_device_kind) devicetype
204 end function
205 end interface
207 interface
208 type(c_ptr) function acc_malloc(bytes) bind(C)
209 use iso_c_binding, only: c_ptr, c_size_t
210 integer(c_size_t), value :: bytes
211 end function
212 end interface
214 interface
215 subroutine acc_free(data_dev) bind(C)
216 use iso_c_binding, only: c_ptr
217 type(c_ptr), value :: data_dev
218 end subroutine
219 end interface
221 interface acc_copyin
222 subroutine acc_copyin_32_h (a, len)
223 use iso_c_binding, only: c_int32_t
224 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
225 type (*), dimension (*) :: a
226 integer (c_int32_t) len
227 end subroutine
229 subroutine acc_copyin_64_h (a, len)
230 use iso_c_binding, only: c_int64_t
231 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
232 type (*), dimension (*) :: a
233 integer (c_int64_t) len
234 end subroutine
236 subroutine acc_copyin_array_h (a)
237 type (*), dimension (..), contiguous :: a
238 end subroutine
239 end interface
241 interface acc_present_or_copyin
242 subroutine acc_present_or_copyin_32_h (a, len)
243 use iso_c_binding, only: c_int32_t
244 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
245 type (*), dimension (*) :: a
246 integer (c_int32_t) len
247 end subroutine
249 subroutine acc_present_or_copyin_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
256 subroutine acc_present_or_copyin_array_h (a)
257 type (*), dimension (..), contiguous :: a
258 end subroutine
259 end interface
261 interface acc_pcopyin
262 procedure :: acc_present_or_copyin_32_h
263 procedure :: acc_present_or_copyin_64_h
264 procedure :: acc_present_or_copyin_array_h
265 end interface
267 interface acc_create
268 subroutine acc_create_32_h (a, len)
269 use iso_c_binding, only: c_int32_t
270 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
271 type (*), dimension (*) :: a
272 integer (c_int32_t) len
273 end subroutine
275 subroutine acc_create_64_h (a, len)
276 use iso_c_binding, only: c_int64_t
277 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
278 type (*), dimension (*) :: a
279 integer (c_int64_t) len
280 end subroutine
282 subroutine acc_create_array_h (a)
283 type (*), dimension (..), contiguous :: a
284 end subroutine
285 end interface
287 interface acc_present_or_create
288 subroutine acc_present_or_create_32_h (a, len)
289 use iso_c_binding, only: c_int32_t
290 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
291 type (*), dimension (*) :: a
292 integer (c_int32_t) len
293 end subroutine
295 subroutine acc_present_or_create_64_h (a, len)
296 use iso_c_binding, only: c_int64_t
297 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
298 type (*), dimension (*) :: a
299 integer (c_int64_t) len
300 end subroutine
302 subroutine acc_present_or_create_array_h (a)
303 type (*), dimension (..), contiguous :: a
304 end subroutine
305 end interface
307 interface acc_pcreate
308 procedure :: acc_present_or_create_32_h
309 procedure :: acc_present_or_create_64_h
310 procedure :: acc_present_or_create_array_h
311 end interface
313 interface acc_copyout
314 subroutine acc_copyout_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_copyout_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_copyout_array_h (a)
329 type (*), dimension (..), contiguous :: a
330 end subroutine
331 end interface
333 interface acc_copyout_finalize
334 subroutine acc_copyout_finalize_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_copyout_finalize_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_copyout_finalize_array_h (a)
349 type (*), dimension (..), contiguous :: a
350 end subroutine
351 end interface
353 interface acc_delete
354 subroutine acc_delete_32_h (a, len)
355 use iso_c_binding, only: c_int32_t
356 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
357 type (*), dimension (*) :: a
358 integer (c_int32_t) len
359 end subroutine
361 subroutine acc_delete_64_h (a, len)
362 use iso_c_binding, only: c_int64_t
363 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
364 type (*), dimension (*) :: a
365 integer (c_int64_t) len
366 end subroutine
368 subroutine acc_delete_array_h (a)
369 type (*), dimension (..), contiguous :: a
370 end subroutine
371 end interface
373 interface acc_delete_finalize
374 subroutine acc_delete_finalize_32_h (a, len)
375 use iso_c_binding, only: c_int32_t
376 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
377 type (*), dimension (*) :: a
378 integer (c_int32_t) len
379 end subroutine
381 subroutine acc_delete_finalize_64_h (a, len)
382 use iso_c_binding, only: c_int64_t
383 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
384 type (*), dimension (*) :: a
385 integer (c_int64_t) len
386 end subroutine
388 subroutine acc_delete_finalize_array_h (a)
389 type (*), dimension (..), contiguous :: a
390 end subroutine
391 end interface
393 interface acc_update_device
394 subroutine acc_update_device_32_h (a, len)
395 use iso_c_binding, only: c_int32_t
396 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
397 type (*), dimension (*) :: a
398 integer (c_int32_t) len
399 end subroutine
401 subroutine acc_update_device_64_h (a, len)
402 use iso_c_binding, only: c_int64_t
403 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
404 type (*), dimension (*) :: a
405 integer (c_int64_t) len
406 end subroutine
408 subroutine acc_update_device_array_h (a)
409 type (*), dimension (..), contiguous :: a
410 end subroutine
411 end interface
413 interface acc_update_self
414 subroutine acc_update_self_32_h (a, len)
415 use iso_c_binding, only: c_int32_t
416 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
417 type (*), dimension (*) :: a
418 integer (c_int32_t) len
419 end subroutine
421 subroutine acc_update_self_64_h (a, len)
422 use iso_c_binding, only: c_int64_t
423 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
424 type (*), dimension (*) :: a
425 integer (c_int64_t) len
426 end subroutine
428 subroutine acc_update_self_array_h (a)
429 type (*), dimension (..), contiguous :: a
430 end subroutine
431 end interface
433 interface
434 subroutine acc_map_data(data_arg, data_dev, bytes) bind(C)
435 use iso_c_binding, only: c_ptr, c_size_t
436 type(*), dimension(*) :: data_arg
437 type(c_ptr), value :: data_dev
438 integer(c_size_t), value :: bytes
439 end subroutine
440 end interface
442 interface
443 subroutine acc_unmap_data(data_arg) bind(C)
444 type(*), dimension(*) :: data_arg
445 end subroutine
446 end interface
448 interface
449 type(c_ptr) function acc_deviceptr(data_arg) bind(C)
450 use iso_c_binding, only: c_ptr
451 type(*), dimension(*) :: data_arg
452 end function
453 end interface
455 interface
456 type(c_ptr) function acc_hostptr(data_dev) bind(C)
457 use iso_c_binding, only: c_ptr
458 type(c_ptr), value :: data_dev
459 end function
460 end interface
462 interface acc_is_present
463 function acc_is_present_32_h (a, len)
464 use iso_c_binding, only: c_int32_t
465 logical acc_is_present_32_h
466 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
467 type (*), dimension (*) :: a
468 integer (c_int32_t) len
469 end function
471 function acc_is_present_64_h (a, len)
472 use iso_c_binding, only: c_int64_t
473 logical acc_is_present_64_h
474 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
475 type (*), dimension (*) :: a
476 integer (c_int64_t) len
477 end function
479 function acc_is_present_array_h (a)
480 logical acc_is_present_array_h
481 type (*), dimension (..), contiguous :: a
482 end function
483 end interface
485 interface
486 subroutine acc_memcpy_to_device(data_dev_dest, data_host_src, &
487 & bytes) bind(C)
488 use iso_c_binding, only: c_ptr, c_size_t
489 type(c_ptr), value :: data_dev_dest
490 type(*),dimension(*) :: data_host_src
491 integer(c_size_t), value :: bytes
492 end subroutine
493 end interface
495 interface
496 subroutine acc_memcpy_to_device_async(data_dev_dest, &
497 & data_host_src, bytes, &
498 & async_arg) bind(C)
499 use iso_c_binding, only: c_ptr, c_size_t
500 import :: acc_handle_kind
501 type(c_ptr), value :: data_dev_dest
502 type(*),dimension(*) :: data_host_src
503 integer(c_size_t), value :: bytes
504 integer(acc_handle_kind), value :: async_arg
505 end subroutine
506 end interface
508 interface
509 subroutine acc_memcpy_from_device(data_host_dest, &
510 & data_dev_src, bytes) bind(C)
511 use iso_c_binding, only: c_ptr, c_size_t
512 type(*),dimension(*) :: data_host_dest
513 type(c_ptr), value :: data_dev_src
514 integer(c_size_t), value :: bytes
515 end subroutine
516 end interface
518 interface
519 subroutine acc_memcpy_from_device_async(data_host_dest, &
520 & data_dev_src, bytes, &
521 & async_arg) bind(C)
522 use iso_c_binding, only: c_ptr, c_size_t
523 import :: acc_handle_kind
524 type(*),dimension(*) :: data_host_dest
525 type(c_ptr), value :: data_dev_src
526 integer(c_size_t), value :: bytes
527 integer(acc_handle_kind), value :: async_arg
528 end subroutine
529 end interface
531 interface acc_copyin_async
532 subroutine acc_copyin_async_32_h (a, len, async)
533 use iso_c_binding, only: c_int32_t
534 import acc_handle_kind
535 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
536 type (*), dimension (*) :: a
537 integer (c_int32_t) len
538 integer (acc_handle_kind) async
539 end subroutine
541 subroutine acc_copyin_async_64_h (a, len, async)
542 use iso_c_binding, only: c_int64_t
543 import acc_handle_kind
544 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
545 type (*), dimension (*) :: a
546 integer (c_int64_t) len
547 integer (acc_handle_kind) async
548 end subroutine
550 subroutine acc_copyin_async_array_h (a, async_)
551 import acc_handle_kind
552 type (*), dimension (..), contiguous :: a
553 integer (acc_handle_kind) async_
554 end subroutine
555 end interface
557 interface acc_create_async
558 subroutine acc_create_async_32_h (a, len, async)
559 use iso_c_binding, only: c_int32_t
560 import acc_handle_kind
561 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
562 type (*), dimension (*) :: a
563 integer (c_int32_t) len
564 integer (acc_handle_kind) async
565 end subroutine
567 subroutine acc_create_async_64_h (a, len, async)
568 use iso_c_binding, only: c_int64_t
569 import acc_handle_kind
570 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
571 type (*), dimension (*) :: a
572 integer (c_int64_t) len
573 integer (acc_handle_kind) async
574 end subroutine
576 subroutine acc_create_async_array_h (a, async_)
577 import acc_handle_kind
578 type (*), dimension (..), contiguous :: a
579 integer (acc_handle_kind) async_
580 end subroutine
581 end interface
583 interface acc_copyout_async
584 subroutine acc_copyout_async_32_h (a, len, async)
585 use iso_c_binding, only: c_int32_t
586 import acc_handle_kind
587 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
588 type (*), dimension (*) :: a
589 integer (c_int32_t) len
590 integer (acc_handle_kind) async
591 end subroutine
593 subroutine acc_copyout_async_64_h (a, len, async)
594 use iso_c_binding, only: c_int64_t
595 import acc_handle_kind
596 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
597 type (*), dimension (*) :: a
598 integer (c_int64_t) len
599 integer (acc_handle_kind) async
600 end subroutine
602 subroutine acc_copyout_async_array_h (a, async_)
603 import acc_handle_kind
604 type (*), dimension (..), contiguous :: a
605 integer (acc_handle_kind) async_
606 end subroutine
607 end interface
609 interface acc_delete_async
610 subroutine acc_delete_async_32_h (a, len, async)
611 use iso_c_binding, only: c_int32_t
612 import acc_handle_kind
613 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
614 type (*), dimension (*) :: a
615 integer (c_int32_t) len
616 integer (acc_handle_kind) async
617 end subroutine
619 subroutine acc_delete_async_64_h (a, len, async)
620 use iso_c_binding, only: c_int64_t
621 import acc_handle_kind
622 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
623 type (*), dimension (*) :: a
624 integer (c_int64_t) len
625 integer (acc_handle_kind) async
626 end subroutine
628 subroutine acc_delete_async_array_h (a, async_)
629 import acc_handle_kind
630 type (*), dimension (..), contiguous :: a
631 integer (acc_handle_kind) async_
632 end subroutine
633 end interface
635 interface acc_update_device_async
636 subroutine acc_update_device_async_32_h (a, len, async)
637 use iso_c_binding, only: c_int32_t
638 import acc_handle_kind
639 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
640 type (*), dimension (*) :: a
641 integer (c_int32_t) len
642 integer (acc_handle_kind) async
643 end subroutine
645 subroutine acc_update_device_async_64_h (a, len, async)
646 use iso_c_binding, only: c_int64_t
647 import acc_handle_kind
648 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
649 type (*), dimension (*) :: a
650 integer (c_int64_t) len
651 integer (acc_handle_kind) async
652 end subroutine
654 subroutine acc_update_device_async_array_h (a, async_)
655 import acc_handle_kind
656 type (*), dimension (..), contiguous :: a
657 integer (acc_handle_kind) async_
658 end subroutine
659 end interface
661 interface acc_update_self_async
662 subroutine acc_update_self_async_32_h (a, len, async)
663 use iso_c_binding, only: c_int32_t
664 import acc_handle_kind
665 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
666 type (*), dimension (*) :: a
667 integer (c_int32_t) len
668 integer (acc_handle_kind) async
669 end subroutine
671 subroutine acc_update_self_async_64_h (a, len, async)
672 use iso_c_binding, only: c_int64_t
673 import acc_handle_kind
674 !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
675 type (*), dimension (*) :: a
676 integer (c_int64_t) len
677 integer (acc_handle_kind) async
678 end subroutine
680 subroutine acc_update_self_async_array_h (a, async_)
681 import acc_handle_kind
682 type (*), dimension (..), contiguous :: a
683 integer (acc_handle_kind) async_
684 end subroutine
685 end interface