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
>
8 ! This file is part of the GNU Offloading
and Multi Processing Library
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
)
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
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
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
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
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
79 interface acc_set_device_num
80 subroutine
acc_set_device_num_h (n
, d
)
81 import acc_device_kind
83 integer (acc_device_kind
) d
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
95 interface acc_async_test
96 function
acc_async_test_h (a
)
97 logical acc_async_test_h
102 interface acc_async_test_all
103 function
acc_async_test_all_h ()
104 logical acc_async_test_all_h
109 subroutine
acc_wait_h (a
)
114 ! acc_async_wait is an OpenACC
1.0 compatibility name
for acc_wait
.
115 interface acc_async_wait
116 procedure :: acc_wait_h
119 interface acc_wait_async
120 subroutine
acc_wait_async_h (a1
, a2
)
125 interface acc_wait_all
126 subroutine
acc_wait_all_h ()
130 ! acc_async_wait_all is an OpenACC
1.0 compatibility name
for
132 interface acc_async_wait_all
133 procedure :: acc_wait_all_h
136 interface acc_wait_all_async
137 subroutine
acc_wait_all_async_h (a
)
143 subroutine
acc_init_h (devicetype
)
144 import acc_device_kind
145 integer (acc_device_kind
) devicetype
149 interface acc_shutdown
150 subroutine
acc_shutdown_h (devicetype
)
151 import acc_device_kind
152 integer (acc_device_kind
) devicetype
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
164 ! acc_malloc
: Only available in C
/C
++
165 ! acc_free
: Only available in C
/C
++
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
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
182 subroutine
acc_copyin_array_h (a
)
183 type (*), dimension (..), contiguous :: a
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
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
202 subroutine
acc_present_or_copyin_array_h (a
)
203 type (*), dimension (..), contiguous :: a
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
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
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
228 subroutine
acc_create_array_h (a
)
229 type (*), dimension (..), contiguous :: a
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
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
248 subroutine
acc_present_or_create_array_h (a
)
249 type (*), dimension (..), contiguous :: a
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
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
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
274 subroutine
acc_copyout_array_h (a
)
275 type (*), dimension (..), contiguous :: a
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
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
294 subroutine
acc_copyout_finalize_array_h (a
)
295 type (*), dimension (..), contiguous :: a
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
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
314 subroutine
acc_delete_array_h (a
)
315 type (*), dimension (..), contiguous :: a
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
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
334 subroutine
acc_delete_finalize_array_h (a
)
335 type (*), dimension (..), contiguous :: a
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
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
354 subroutine
acc_update_device_array_h (a
)
355 type (*), dimension (..), contiguous :: a
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
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
374 subroutine
acc_update_self_array_h (a
)
375 type (*), dimension (..), contiguous :: a
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
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
401 function
acc_is_present_array_h (a
)
402 logical acc_is_present_array_h
403 type (*), dimension (..), contiguous :: a
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
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
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_
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
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
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_
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
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
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_
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
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
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_
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
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
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_
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
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
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_