1 ! OpenACC Runtime Library Definitions
. -*- mode
: fortran
-*-
3 ! Copyright (C
) 2014-2019 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 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
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
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
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
76 interface acc_set_device_num
77 subroutine
acc_set_device_num_h (n
, d
)
78 import acc_device_kind
80 integer (acc_device_kind
) d
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
92 interface acc_async_test
93 function
acc_async_test_h (a
)
94 logical acc_async_test_h
99 interface acc_async_test_all
100 function
acc_async_test_all_h ()
101 logical acc_async_test_all_h
106 subroutine
acc_wait_h (a
)
111 ! acc_async_wait is an OpenACC
1.0 compatibility name
for acc_wait
.
112 interface acc_async_wait
113 procedure :: acc_wait_h
116 interface acc_wait_async
117 subroutine
acc_wait_async_h (a1
, a2
)
122 interface acc_wait_all
123 subroutine
acc_wait_all_h ()
127 ! acc_async_wait_all is an OpenACC
1.0 compatibility name
for
129 interface acc_async_wait_all
130 procedure :: acc_wait_all_h
133 interface acc_wait_all_async
134 subroutine
acc_wait_all_async_h (a
)
140 subroutine
acc_init_h (devicetype
)
141 import acc_device_kind
142 integer (acc_device_kind
) devicetype
146 interface acc_shutdown
147 subroutine
acc_shutdown_h (devicetype
)
148 import acc_device_kind
149 integer (acc_device_kind
) devicetype
153 interface acc_on_device
154 function
acc_on_device_h (devicetype
)
155 import acc_device_kind
156 logical acc_on_device_h
157 integer (acc_device_kind
) devicetype
161 ! acc_malloc
: Only available in C
/C
++
162 ! acc_free
: Only available in C
/C
++
165 subroutine
acc_copyin_32_h (a
, len
)
166 use iso_c_binding
, only
: c_int32_t
167 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
168 type (*), dimension (*) :: a
169 integer (c_int32_t
) len
172 subroutine
acc_copyin_64_h (a
, len
)
173 use iso_c_binding
, only
: c_int64_t
174 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
175 type (*), dimension (*) :: a
176 integer (c_int64_t
) len
179 subroutine
acc_copyin_array_h (a
)
180 type (*), dimension (..), contiguous :: a
184 interface acc_present_or_copyin
185 subroutine
acc_present_or_copyin_32_h (a
, len
)
186 use iso_c_binding
, only
: c_int32_t
187 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
188 type (*), dimension (*) :: a
189 integer (c_int32_t
) len
192 subroutine
acc_present_or_copyin_64_h (a
, len
)
193 use iso_c_binding
, only
: c_int64_t
194 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
195 type (*), dimension (*) :: a
196 integer (c_int64_t
) len
199 subroutine
acc_present_or_copyin_array_h (a
)
200 type (*), dimension (..), contiguous :: a
204 interface acc_pcopyin
205 procedure :: acc_present_or_copyin_32_h
206 procedure :: acc_present_or_copyin_64_h
207 procedure :: acc_present_or_copyin_array_h
211 subroutine
acc_create_32_h (a
, len
)
212 use iso_c_binding
, only
: c_int32_t
213 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
214 type (*), dimension (*) :: a
215 integer (c_int32_t
) len
218 subroutine
acc_create_64_h (a
, len
)
219 use iso_c_binding
, only
: c_int64_t
220 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
221 type (*), dimension (*) :: a
222 integer (c_int64_t
) len
225 subroutine
acc_create_array_h (a
)
226 type (*), dimension (..), contiguous :: a
230 interface acc_present_or_create
231 subroutine
acc_present_or_create_32_h (a
, len
)
232 use iso_c_binding
, only
: c_int32_t
233 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
234 type (*), dimension (*) :: a
235 integer (c_int32_t
) len
238 subroutine
acc_present_or_create_64_h (a
, len
)
239 use iso_c_binding
, only
: c_int64_t
240 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
241 type (*), dimension (*) :: a
242 integer (c_int64_t
) len
245 subroutine
acc_present_or_create_array_h (a
)
246 type (*), dimension (..), contiguous :: a
250 interface acc_pcreate
251 procedure :: acc_present_or_create_32_h
252 procedure :: acc_present_or_create_64_h
253 procedure :: acc_present_or_create_array_h
256 interface acc_copyout
257 subroutine
acc_copyout_32_h (a
, len
)
258 use iso_c_binding
, only
: c_int32_t
259 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
260 type (*), dimension (*) :: a
261 integer (c_int32_t
) len
264 subroutine
acc_copyout_64_h (a
, len
)
265 use iso_c_binding
, only
: c_int64_t
266 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
267 type (*), dimension (*) :: a
268 integer (c_int64_t
) len
271 subroutine
acc_copyout_array_h (a
)
272 type (*), dimension (..), contiguous :: a
276 interface acc_copyout_finalize
277 subroutine
acc_copyout_finalize_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
284 subroutine
acc_copyout_finalize_64_h (a
, len
)
285 use iso_c_binding
, only
: c_int64_t
286 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
287 type (*), dimension (*) :: a
288 integer (c_int64_t
) len
291 subroutine
acc_copyout_finalize_array_h (a
)
292 type (*), dimension (..), contiguous :: a
297 subroutine
acc_delete_32_h (a
, len
)
298 use iso_c_binding
, only
: c_int32_t
299 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
300 type (*), dimension (*) :: a
301 integer (c_int32_t
) len
304 subroutine
acc_delete_64_h (a
, len
)
305 use iso_c_binding
, only
: c_int64_t
306 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
307 type (*), dimension (*) :: a
308 integer (c_int64_t
) len
311 subroutine
acc_delete_array_h (a
)
312 type (*), dimension (..), contiguous :: a
316 interface acc_delete_finalize
317 subroutine
acc_delete_finalize_32_h (a
, len
)
318 use iso_c_binding
, only
: c_int32_t
319 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
320 type (*), dimension (*) :: a
321 integer (c_int32_t
) len
324 subroutine
acc_delete_finalize_64_h (a
, len
)
325 use iso_c_binding
, only
: c_int64_t
326 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
327 type (*), dimension (*) :: a
328 integer (c_int64_t
) len
331 subroutine
acc_delete_finalize_array_h (a
)
332 type (*), dimension (..), contiguous :: a
336 interface acc_update_device
337 subroutine
acc_update_device_32_h (a
, len
)
338 use iso_c_binding
, only
: c_int32_t
339 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
340 type (*), dimension (*) :: a
341 integer (c_int32_t
) len
344 subroutine
acc_update_device_64_h (a
, len
)
345 use iso_c_binding
, only
: c_int64_t
346 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
347 type (*), dimension (*) :: a
348 integer (c_int64_t
) len
351 subroutine
acc_update_device_array_h (a
)
352 type (*), dimension (..), contiguous :: a
356 interface acc_update_self
357 subroutine
acc_update_self_32_h (a
, len
)
358 use iso_c_binding
, only
: c_int32_t
359 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
360 type (*), dimension (*) :: a
361 integer (c_int32_t
) len
364 subroutine
acc_update_self_64_h (a
, len
)
365 use iso_c_binding
, only
: c_int64_t
366 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
367 type (*), dimension (*) :: a
368 integer (c_int64_t
) len
371 subroutine
acc_update_self_array_h (a
)
372 type (*), dimension (..), contiguous :: a
376 ! acc_map_data
: Only available in C
/C
++
377 ! acc_unmap_data
: Only available in C
/C
++
378 ! acc_deviceptr
: Only available in C
/C
++
379 ! acc_hostptr
: Only available in C
/C
++
381 interface acc_is_present
382 function
acc_is_present_32_h (a
, len
)
383 use iso_c_binding
, only
: c_int32_t
384 logical acc_is_present_32_h
385 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
386 type (*), dimension (*) :: a
387 integer (c_int32_t
) len
390 function
acc_is_present_64_h (a
, len
)
391 use iso_c_binding
, only
: c_int64_t
392 logical acc_is_present_64_h
393 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
394 type (*), dimension (*) :: a
395 integer (c_int64_t
) len
398 function
acc_is_present_array_h (a
)
399 logical acc_is_present_array_h
400 type (*), dimension (..), contiguous :: a
404 ! acc_memcpy_to_device
: Only available in C
/C
++
405 ! acc_memcpy_from_device
: Only available in C
/C
++
407 interface acc_copyin_async
408 subroutine
acc_copyin_async_32_h (a
, len
, async
)
409 use iso_c_binding
, only
: c_int32_t
410 import acc_handle_kind
411 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
412 type (*), dimension (*) :: a
413 integer (c_int32_t
) len
414 integer (acc_handle_kind
) async
417 subroutine
acc_copyin_async_64_h (a
, len
, async
)
418 use iso_c_binding
, only
: c_int64_t
419 import acc_handle_kind
420 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
421 type (*), dimension (*) :: a
422 integer (c_int64_t
) len
423 integer (acc_handle_kind
) async
426 subroutine
acc_copyin_async_array_h (a
, async_
)
427 import acc_handle_kind
428 type (*), dimension (..), contiguous :: a
429 integer (acc_handle_kind
) async_
433 interface acc_create_async
434 subroutine
acc_create_async_32_h (a
, len
, async
)
435 use iso_c_binding
, only
: c_int32_t
436 import acc_handle_kind
437 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
438 type (*), dimension (*) :: a
439 integer (c_int32_t
) len
440 integer (acc_handle_kind
) async
443 subroutine
acc_create_async_64_h (a
, len
, async
)
444 use iso_c_binding
, only
: c_int64_t
445 import acc_handle_kind
446 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
447 type (*), dimension (*) :: a
448 integer (c_int64_t
) len
449 integer (acc_handle_kind
) async
452 subroutine
acc_create_async_array_h (a
, async_
)
453 import acc_handle_kind
454 type (*), dimension (..), contiguous :: a
455 integer (acc_handle_kind
) async_
459 interface acc_copyout_async
460 subroutine
acc_copyout_async_32_h (a
, len
, async
)
461 use iso_c_binding
, only
: c_int32_t
462 import acc_handle_kind
463 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
464 type (*), dimension (*) :: a
465 integer (c_int32_t
) len
466 integer (acc_handle_kind
) async
469 subroutine
acc_copyout_async_64_h (a
, len
, async
)
470 use iso_c_binding
, only
: c_int64_t
471 import acc_handle_kind
472 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
473 type (*), dimension (*) :: a
474 integer (c_int64_t
) len
475 integer (acc_handle_kind
) async
478 subroutine
acc_copyout_async_array_h (a
, async_
)
479 import acc_handle_kind
480 type (*), dimension (..), contiguous :: a
481 integer (acc_handle_kind
) async_
485 interface acc_delete_async
486 subroutine
acc_delete_async_32_h (a
, len
, async
)
487 use iso_c_binding
, only
: c_int32_t
488 import acc_handle_kind
489 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
490 type (*), dimension (*) :: a
491 integer (c_int32_t
) len
492 integer (acc_handle_kind
) async
495 subroutine
acc_delete_async_64_h (a
, len
, async
)
496 use iso_c_binding
, only
: c_int64_t
497 import acc_handle_kind
498 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
499 type (*), dimension (*) :: a
500 integer (c_int64_t
) len
501 integer (acc_handle_kind
) async
504 subroutine
acc_delete_async_array_h (a
, async_
)
505 import acc_handle_kind
506 type (*), dimension (..), contiguous :: a
507 integer (acc_handle_kind
) async_
511 interface acc_update_device_async
512 subroutine
acc_update_device_async_32_h (a
, len
, async
)
513 use iso_c_binding
, only
: c_int32_t
514 import acc_handle_kind
515 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
516 type (*), dimension (*) :: a
517 integer (c_int32_t
) len
518 integer (acc_handle_kind
) async
521 subroutine
acc_update_device_async_64_h (a
, len
, async
)
522 use iso_c_binding
, only
: c_int64_t
523 import acc_handle_kind
524 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
525 type (*), dimension (*) :: a
526 integer (c_int64_t
) len
527 integer (acc_handle_kind
) async
530 subroutine
acc_update_device_async_array_h (a
, async_
)
531 import acc_handle_kind
532 type (*), dimension (..), contiguous :: a
533 integer (acc_handle_kind
) async_
537 interface acc_update_self_async
538 subroutine
acc_update_self_async_32_h (a
, len
, async
)
539 use iso_c_binding
, only
: c_int32_t
540 import acc_handle_kind
541 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
542 type (*), dimension (*) :: a
543 integer (c_int32_t
) len
544 integer (acc_handle_kind
) async
547 subroutine
acc_update_self_async_64_h (a
, len
, async
)
548 use iso_c_binding
, only
: c_int64_t
549 import acc_handle_kind
550 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
551 type (*), dimension (*) :: a
552 integer (c_int64_t
) len
553 integer (acc_handle_kind
) async
556 subroutine
acc_update_self_async_array_h (a
, async_
)
557 import acc_handle_kind
558 type (*), dimension (..), contiguous :: a
559 integer (acc_handle_kind
) async_