Update copyright years.
[platform/upstream/gcc.git] / libgomp / openacc.f90
1 !  OpenACC Runtime Library Definitions.
2
3 !  Copyright (C) 2014-2019 Free Software Foundation, Inc.
4
5 !  Contributed by Tobias Burnus <burnus@net-b.de>
6 !              and Mentor Embedded.
7
8 !  This file is part of the GNU Offloading and Multi Processing Library
9 !  (libgomp).
10
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.
15
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.
20
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.
24
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/>.
29
30 module openacc_kinds
31   use iso_fortran_env, only: int32
32   implicit none
33
34   private :: int32
35   public :: acc_device_kind
36
37   integer, parameter :: acc_device_kind = int32
38
39   public :: acc_device_none, acc_device_default, acc_device_host
40   public :: acc_device_not_host, acc_device_nvidia
41
42   ! Keep in sync with include/gomp-constants.h.
43   integer (acc_device_kind), parameter :: acc_device_none = 0
44   integer (acc_device_kind), parameter :: acc_device_default = 1
45   integer (acc_device_kind), parameter :: acc_device_host = 2
46   ! integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3 removed.
47   integer (acc_device_kind), parameter :: acc_device_not_host = 4
48   integer (acc_device_kind), parameter :: acc_device_nvidia = 5
49
50   public :: acc_handle_kind
51
52   integer, parameter :: acc_handle_kind = int32
53
54   public :: acc_async_noval, acc_async_sync
55
56   ! Keep in sync with include/gomp-constants.h.
57   integer (acc_handle_kind), parameter :: acc_async_noval = -1
58   integer (acc_handle_kind), parameter :: acc_async_sync = -2
59
60 end module
61
62 module openacc_internal
63   use openacc_kinds
64   implicit none
65
66   interface
67     function acc_get_num_devices_h (d)
68       import
69       integer acc_get_num_devices_h
70       integer (acc_device_kind) d
71     end function
72
73     subroutine acc_set_device_type_h (d)
74       import
75       integer (acc_device_kind) d
76     end subroutine
77
78     function acc_get_device_type_h ()
79       import
80       integer (acc_device_kind) acc_get_device_type_h
81     end function
82
83     subroutine acc_set_device_num_h (n, d)
84       import
85       integer n
86       integer (acc_device_kind) d
87     end subroutine
88
89     function acc_get_device_num_h (d)
90       import
91       integer acc_get_device_num_h
92       integer (acc_device_kind) d
93     end function
94
95     function acc_async_test_h (a)
96       logical acc_async_test_h
97       integer a
98     end function
99
100     function acc_async_test_all_h ()
101       logical acc_async_test_all_h
102     end function
103
104     subroutine acc_wait_h (a)
105       integer a
106     end subroutine
107
108     subroutine acc_wait_async_h (a1, a2)
109       integer a1, a2
110     end subroutine
111
112     subroutine acc_wait_all_h ()
113     end subroutine
114
115     subroutine acc_wait_all_async_h (a)
116       integer a
117     end subroutine
118
119     subroutine acc_init_h (d)
120       import
121       integer (acc_device_kind) d
122     end subroutine
123
124     subroutine acc_shutdown_h (d)
125       import
126       integer (acc_device_kind) d
127     end subroutine
128
129     function acc_on_device_h (d)
130       import
131       integer (acc_device_kind) d
132       logical acc_on_device_h
133     end function
134
135     subroutine acc_copyin_32_h (a, len)
136       use iso_c_binding, only: c_int32_t
137       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
138       type (*), dimension (*) :: a
139       integer (c_int32_t) len
140     end subroutine
141
142     subroutine acc_copyin_64_h (a, len)
143       use iso_c_binding, only: c_int64_t
144       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
145       type (*), dimension (*) :: a
146       integer (c_int64_t) len
147     end subroutine
148
149     subroutine acc_copyin_array_h (a)
150       type (*), dimension (..), contiguous :: a
151     end subroutine
152
153     subroutine acc_present_or_copyin_32_h (a, len)
154       use iso_c_binding, only: c_int32_t
155       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
156       type (*), dimension (*) :: a
157       integer (c_int32_t) len
158     end subroutine
159
160     subroutine acc_present_or_copyin_64_h (a, len)
161       use iso_c_binding, only: c_int64_t
162       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
163       type (*), dimension (*) :: a
164       integer (c_int64_t) len
165     end subroutine
166
167     subroutine acc_present_or_copyin_array_h (a)
168       type (*), dimension (..), contiguous :: a
169     end subroutine
170
171     subroutine acc_create_32_h (a, len)
172       use iso_c_binding, only: c_int32_t
173       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
174       type (*), dimension (*) :: a
175       integer (c_int32_t) len
176     end subroutine
177
178     subroutine acc_create_64_h (a, len)
179       use iso_c_binding, only: c_int64_t
180       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
181       type (*), dimension (*) :: a
182       integer (c_int64_t) len
183     end subroutine
184
185     subroutine acc_create_array_h (a)
186       type (*), dimension (..), contiguous :: a
187     end subroutine
188
189     subroutine acc_present_or_create_32_h (a, len)
190       use iso_c_binding, only: c_int32_t
191       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
192       type (*), dimension (*) :: a
193       integer (c_int32_t) len
194     end subroutine
195
196     subroutine acc_present_or_create_64_h (a, len)
197       use iso_c_binding, only: c_int64_t
198       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
199       type (*), dimension (*) :: a
200       integer (c_int64_t) len
201     end subroutine
202
203     subroutine acc_present_or_create_array_h (a)
204       type (*), dimension (..), contiguous :: a
205     end subroutine
206
207     subroutine acc_copyout_32_h (a, len)
208       use iso_c_binding, only: c_int32_t
209       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
210       type (*), dimension (*) :: a
211       integer (c_int32_t) len
212     end subroutine
213
214     subroutine acc_copyout_64_h (a, len)
215       use iso_c_binding, only: c_int64_t
216       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
217       type (*), dimension (*) :: a
218       integer (c_int64_t) len
219     end subroutine
220
221     subroutine acc_copyout_array_h (a)
222       type (*), dimension (..), contiguous :: a
223     end subroutine
224
225     subroutine acc_copyout_finalize_32_h (a, len)
226       use iso_c_binding, only: c_int32_t
227       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
228       type (*), dimension (*) :: a
229       integer (c_int32_t) len
230     end subroutine
231
232     subroutine acc_copyout_finalize_64_h (a, len)
233       use iso_c_binding, only: c_int64_t
234       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
235       type (*), dimension (*) :: a
236       integer (c_int64_t) len
237     end subroutine
238
239     subroutine acc_copyout_finalize_array_h (a)
240       type (*), dimension (..), contiguous :: a
241     end subroutine
242
243     subroutine acc_delete_32_h (a, len)
244       use iso_c_binding, only: c_int32_t
245       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
246       type (*), dimension (*) :: a
247       integer (c_int32_t) len
248     end subroutine
249
250     subroutine acc_delete_64_h (a, len)
251       use iso_c_binding, only: c_int64_t
252       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
253       type (*), dimension (*) :: a
254       integer (c_int64_t) len
255     end subroutine
256
257     subroutine acc_delete_array_h (a)
258       type (*), dimension (..), contiguous :: a
259     end subroutine
260
261     subroutine acc_delete_finalize_32_h (a, len)
262       use iso_c_binding, only: c_int32_t
263       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
264       type (*), dimension (*) :: a
265       integer (c_int32_t) len
266     end subroutine
267
268     subroutine acc_delete_finalize_64_h (a, len)
269       use iso_c_binding, only: c_int64_t
270       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
271       type (*), dimension (*) :: a
272       integer (c_int64_t) len
273     end subroutine
274
275     subroutine acc_delete_finalize_array_h (a)
276       type (*), dimension (..), contiguous :: a
277     end subroutine
278
279     subroutine acc_update_device_32_h (a, len)
280       use iso_c_binding, only: c_int32_t
281       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
282       type (*), dimension (*) :: a
283       integer (c_int32_t) len
284     end subroutine
285
286     subroutine acc_update_device_64_h (a, len)
287       use iso_c_binding, only: c_int64_t
288       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
289       type (*), dimension (*) :: a
290       integer (c_int64_t) len
291     end subroutine
292
293     subroutine acc_update_device_array_h (a)
294       type (*), dimension (..), contiguous :: a
295     end subroutine
296
297     subroutine acc_update_self_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
302     end subroutine
303
304     subroutine acc_update_self_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
309     end subroutine
310
311     subroutine acc_update_self_array_h (a)
312       type (*), dimension (..), contiguous :: a
313     end subroutine
314
315     function acc_is_present_32_h (a, len)
316       use iso_c_binding, only: c_int32_t
317       logical acc_is_present_32_h
318       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
319       type (*), dimension (*) :: a
320       integer (c_int32_t) len
321     end function
322
323     function acc_is_present_64_h (a, len)
324       use iso_c_binding, only: c_int64_t
325       logical acc_is_present_64_h
326       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
327       type (*), dimension (*) :: a
328       integer (c_int64_t) len
329     end function
330
331     function acc_is_present_array_h (a)
332       logical acc_is_present_array_h
333       type (*), dimension (..), contiguous :: a
334     end function
335
336     subroutine acc_copyin_async_32_h (a, len, async)
337       use iso_c_binding, only: c_int32_t
338       use openacc_kinds, only: acc_handle_kind
339       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
340       type (*), dimension (*) :: a
341       integer (c_int32_t) len
342       integer (acc_handle_kind) async
343     end subroutine
344
345     subroutine acc_copyin_async_64_h (a, len, async)
346       use iso_c_binding, only: c_int64_t
347       use openacc_kinds, only: acc_handle_kind
348       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
349       type (*), dimension (*) :: a
350       integer (c_int64_t) len
351       integer (acc_handle_kind) async
352     end subroutine
353
354     subroutine acc_copyin_async_array_h (a, async)
355       use openacc_kinds, only: acc_handle_kind
356       type (*), dimension (..), contiguous :: a
357       integer (acc_handle_kind) async
358     end subroutine
359
360     subroutine acc_create_async_32_h (a, len, async)
361       use iso_c_binding, only: c_int32_t
362       use openacc_kinds, only: acc_handle_kind
363       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
364       type (*), dimension (*) :: a
365       integer (c_int32_t) len
366       integer (acc_handle_kind) async
367     end subroutine
368
369     subroutine acc_create_async_64_h (a, len, async)
370       use iso_c_binding, only: c_int64_t
371       use openacc_kinds, only: acc_handle_kind
372       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
373       type (*), dimension (*) :: a
374       integer (c_int64_t) len
375       integer (acc_handle_kind) async
376     end subroutine
377
378     subroutine acc_create_async_array_h (a, async)
379       use openacc_kinds, only: acc_handle_kind
380       type (*), dimension (..), contiguous :: a
381       integer (acc_handle_kind) async
382     end subroutine
383
384     subroutine acc_copyout_async_32_h (a, len, async)
385       use iso_c_binding, only: c_int32_t
386       use openacc_kinds, only: acc_handle_kind
387       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
388       type (*), dimension (*) :: a
389       integer (c_int32_t) len
390       integer (acc_handle_kind) async
391     end subroutine
392
393     subroutine acc_copyout_async_64_h (a, len, async)
394       use iso_c_binding, only: c_int64_t
395       use openacc_kinds, only: acc_handle_kind
396       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
397       type (*), dimension (*) :: a
398       integer (c_int64_t) len
399       integer (acc_handle_kind) async
400     end subroutine
401
402     subroutine acc_copyout_async_array_h (a, async)
403       use openacc_kinds, only: acc_handle_kind
404       type (*), dimension (..), contiguous :: a
405       integer (acc_handle_kind) async
406     end subroutine
407
408     subroutine acc_delete_async_32_h (a, len, async)
409       use iso_c_binding, only: c_int32_t
410       use openacc_kinds, only: 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
415     end subroutine
416
417     subroutine acc_delete_async_64_h (a, len, async)
418       use iso_c_binding, only: c_int64_t
419       use openacc_kinds, only: 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
424     end subroutine
425
426     subroutine acc_delete_async_array_h (a, async)
427       use openacc_kinds, only: acc_handle_kind
428       type (*), dimension (..), contiguous :: a
429       integer (acc_handle_kind) async
430     end subroutine
431
432     subroutine acc_update_device_async_32_h (a, len, async)
433       use iso_c_binding, only: c_int32_t
434       use openacc_kinds, only: acc_handle_kind
435       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
436       type (*), dimension (*) :: a
437       integer (c_int32_t) len
438       integer (acc_handle_kind) async
439     end subroutine
440
441     subroutine acc_update_device_async_64_h (a, len, async)
442       use iso_c_binding, only: c_int64_t
443       use openacc_kinds, only: acc_handle_kind
444       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
445       type (*), dimension (*) :: a
446       integer (c_int64_t) len
447       integer (acc_handle_kind) async
448     end subroutine
449
450     subroutine acc_update_device_async_array_h (a, async)
451       use openacc_kinds, only: acc_handle_kind
452       type (*), dimension (..), contiguous :: a
453       integer (acc_handle_kind) async
454     end subroutine
455
456     subroutine acc_update_self_async_32_h (a, len, async)
457       use iso_c_binding, only: c_int32_t
458       use openacc_kinds, only: acc_handle_kind
459       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
460       type (*), dimension (*) :: a
461       integer (c_int32_t) len
462       integer (acc_handle_kind) async
463     end subroutine
464
465     subroutine acc_update_self_async_64_h (a, len, async)
466       use iso_c_binding, only: c_int64_t
467       use openacc_kinds, only: acc_handle_kind
468       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
469       type (*), dimension (*) :: a
470       integer (c_int64_t) len
471       integer (acc_handle_kind) async
472     end subroutine
473
474     subroutine acc_update_self_async_array_h (a, async)
475       use openacc_kinds, only: acc_handle_kind
476       type (*), dimension (..), contiguous :: a
477       integer (acc_handle_kind) async
478     end subroutine
479   end interface
480
481   interface
482     function acc_get_num_devices_l (d) &
483         bind (C, name = "acc_get_num_devices")
484       use iso_c_binding, only: c_int
485       integer (c_int) :: acc_get_num_devices_l
486       integer (c_int), value :: d
487     end function
488
489     subroutine acc_set_device_type_l (d) &
490         bind (C, name = "acc_set_device_type")
491       use iso_c_binding, only: c_int
492       integer (c_int), value :: d
493     end subroutine
494
495     function acc_get_device_type_l () &
496         bind (C, name = "acc_get_device_type")
497       use iso_c_binding, only: c_int
498       integer (c_int) :: acc_get_device_type_l
499     end function
500
501     subroutine acc_set_device_num_l (n, d) &
502         bind (C, name = "acc_set_device_num")
503       use iso_c_binding, only: c_int
504       integer (c_int), value :: n, d
505     end subroutine
506
507     function acc_get_device_num_l (d) &
508         bind (C, name = "acc_get_device_num")
509       use iso_c_binding, only: c_int
510       integer (c_int) :: acc_get_device_num_l
511       integer (c_int), value :: d
512     end function
513
514     function acc_async_test_l (a) &
515         bind (C, name = "acc_async_test")
516       use iso_c_binding, only: c_int
517       integer (c_int) :: acc_async_test_l
518       integer (c_int), value :: a
519     end function
520
521     function acc_async_test_all_l () &
522         bind (C, name = "acc_async_test_all")
523       use iso_c_binding, only: c_int
524       integer (c_int) :: acc_async_test_all_l
525     end function
526
527     subroutine acc_wait_l (a) &
528         bind (C, name = "acc_wait")
529       use iso_c_binding, only: c_int
530       integer (c_int), value :: a
531     end subroutine
532
533     subroutine acc_wait_async_l (a1, a2) &
534         bind (C, name = "acc_wait_async")
535       use iso_c_binding, only: c_int
536       integer (c_int), value :: a1, a2
537     end subroutine
538
539     subroutine acc_wait_all_l () &
540         bind (C, name = "acc_wait_all")
541       use iso_c_binding, only: c_int
542     end subroutine
543
544     subroutine acc_wait_all_async_l (a) &
545         bind (C, name = "acc_wait_all_async")
546       use iso_c_binding, only: c_int
547       integer (c_int), value :: a
548     end subroutine
549
550     subroutine acc_init_l (d) &
551         bind (C, name = "acc_init")
552       use iso_c_binding, only: c_int
553       integer (c_int), value :: d
554     end subroutine
555
556     subroutine acc_shutdown_l (d) &
557         bind (C, name = "acc_shutdown")
558       use iso_c_binding, only: c_int
559       integer (c_int), value :: d
560     end subroutine
561
562     function acc_on_device_l (d) &
563         bind (C, name = "acc_on_device")
564       use iso_c_binding, only: c_int
565       integer (c_int) :: acc_on_device_l
566       integer (c_int), value :: d
567     end function
568
569     subroutine acc_copyin_l (a, len) &
570         bind (C, name = "acc_copyin")
571       use iso_c_binding, only: c_size_t
572       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
573       type (*), dimension (*) :: a
574       integer (c_size_t), value :: len
575     end subroutine
576
577     subroutine acc_present_or_copyin_l (a, len) &
578         bind (C, name = "acc_present_or_copyin")
579       use iso_c_binding, only: c_size_t
580       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
581       type (*), dimension (*) :: a
582       integer (c_size_t), value :: len
583     end subroutine
584
585     subroutine acc_create_l (a, len) &
586         bind (C, name = "acc_create")
587       use iso_c_binding, only: c_size_t
588       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
589       type (*), dimension (*) :: a
590       integer (c_size_t), value :: len
591     end subroutine
592
593     subroutine acc_present_or_create_l (a, len) &
594         bind (C, name = "acc_present_or_create")
595       use iso_c_binding, only: c_size_t
596       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
597       type (*), dimension (*) :: a
598       integer (c_size_t), value :: len
599     end subroutine
600
601     subroutine acc_copyout_l (a, len) &
602         bind (C, name = "acc_copyout")
603       use iso_c_binding, only: c_size_t
604       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
605       type (*), dimension (*) :: a
606       integer (c_size_t), value :: len
607     end subroutine
608
609     subroutine acc_copyout_finalize_l (a, len) &
610         bind (C, name = "acc_copyout_finalize")
611       use iso_c_binding, only: c_size_t
612       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
613       type (*), dimension (*) :: a
614       integer (c_size_t), value :: len
615     end subroutine
616
617     subroutine acc_delete_l (a, len) &
618         bind (C, name = "acc_delete")
619       use iso_c_binding, only: c_size_t
620       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
621       type (*), dimension (*) :: a
622       integer (c_size_t), value :: len
623     end subroutine
624
625     subroutine acc_delete_finalize_l (a, len) &
626         bind (C, name = "acc_delete_finalize")
627       use iso_c_binding, only: c_size_t
628       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
629       type (*), dimension (*) :: a
630       integer (c_size_t), value :: len
631     end subroutine
632
633     subroutine acc_update_device_l (a, len) &
634         bind (C, name = "acc_update_device")
635       use iso_c_binding, only: c_size_t
636       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
637       type (*), dimension (*) :: a
638       integer (c_size_t), value :: len
639     end subroutine
640
641     subroutine acc_update_self_l (a, len) &
642         bind (C, name = "acc_update_self")
643       use iso_c_binding, only: c_size_t
644       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
645       type (*), dimension (*) :: a
646       integer (c_size_t), value :: len
647     end subroutine
648
649     function acc_is_present_l (a, len) &
650         bind (C, name = "acc_is_present")
651       use iso_c_binding, only: c_int32_t, c_size_t
652       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
653       integer (c_int32_t) :: acc_is_present_l
654       type (*), dimension (*) :: a
655       integer (c_size_t), value :: len
656     end function
657
658     subroutine acc_copyin_async_l (a, len, async) &
659         bind (C, name = "acc_copyin_async")
660       use iso_c_binding, only: c_size_t, c_int
661       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
662       type (*), dimension (*) :: a
663       integer (c_size_t), value :: len
664       integer (c_int), value :: async
665     end subroutine
666
667     subroutine acc_create_async_l (a, len, async) &
668         bind (C, name = "acc_create_async")
669       use iso_c_binding, only: c_size_t, c_int
670       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
671       type (*), dimension (*) :: a
672       integer (c_size_t), value :: len
673       integer (c_int), value :: async
674     end subroutine
675
676     subroutine acc_copyout_async_l (a, len, async) &
677         bind (C, name = "acc_copyout_async")
678       use iso_c_binding, only: c_size_t, c_int
679       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
680       type (*), dimension (*) :: a
681       integer (c_size_t), value :: len
682       integer (c_int), value :: async
683     end subroutine
684
685     subroutine acc_delete_async_l (a, len, async) &
686         bind (C, name = "acc_delete_async")
687       use iso_c_binding, only: c_size_t, c_int
688       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
689       type (*), dimension (*) :: a
690       integer (c_size_t), value :: len
691       integer (c_int), value :: async
692     end subroutine
693
694     subroutine acc_update_device_async_l (a, len, async) &
695         bind (C, name = "acc_update_device_async")
696       use iso_c_binding, only: c_size_t, c_int
697       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
698       type (*), dimension (*) :: a
699       integer (c_size_t), value :: len
700       integer (c_int), value :: async
701     end subroutine
702
703     subroutine acc_update_self_async_l (a, len, async) &
704         bind (C, name = "acc_update_self_async")
705       use iso_c_binding, only: c_size_t, c_int
706       !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
707       type (*), dimension (*) :: a
708       integer (c_size_t), value :: len
709       integer (c_int), value :: async
710     end subroutine
711   end interface
712 end module
713
714 module openacc
715   use openacc_kinds
716   use openacc_internal
717   implicit none
718
719   public :: openacc_version
720
721   public :: acc_get_num_devices, acc_set_device_type, acc_get_device_type
722   public :: acc_set_device_num, acc_get_device_num, acc_async_test
723   public :: acc_async_test_all
724   public :: acc_wait, acc_async_wait, acc_wait_async
725   public :: acc_wait_all, acc_async_wait_all, acc_wait_all_async
726   public :: acc_init, acc_shutdown, acc_on_device
727   public :: acc_copyin, acc_present_or_copyin, acc_pcopyin, acc_create
728   public :: acc_present_or_create, acc_pcreate, acc_copyout, acc_delete
729   public :: acc_update_device, acc_update_self, acc_is_present
730   public :: acc_copyin_async, acc_create_async, acc_copyout_async
731   public :: acc_delete_async, acc_update_device_async, acc_update_self_async
732
733   integer, parameter :: openacc_version = 201306
734
735   interface acc_get_num_devices
736     procedure :: acc_get_num_devices_h
737   end interface
738
739   interface acc_set_device_type
740     procedure :: acc_set_device_type_h
741   end interface
742
743   interface acc_get_device_type
744     procedure :: acc_get_device_type_h
745   end interface
746
747   interface acc_set_device_num
748     procedure :: acc_set_device_num_h
749   end interface
750
751   interface acc_get_device_num
752     procedure :: acc_get_device_num_h
753   end interface
754
755   interface acc_async_test
756     procedure :: acc_async_test_h
757   end interface
758
759   interface acc_async_test_all
760     procedure :: acc_async_test_all_h
761   end interface
762
763   interface acc_wait
764     procedure :: acc_wait_h
765   end interface
766
767   ! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait.
768   interface acc_async_wait
769     procedure :: acc_wait_h
770   end interface
771
772   interface acc_wait_async
773     procedure :: acc_wait_async_h
774   end interface
775
776   interface acc_wait_all
777     procedure :: acc_wait_all_h
778   end interface
779
780   ! acc_async_wait_all is an OpenACC 1.0 compatibility name for acc_wait_all.
781   interface acc_async_wait_all
782     procedure :: acc_wait_all_h
783   end interface
784
785   interface acc_wait_all_async
786     procedure :: acc_wait_all_async_h
787   end interface
788
789   interface acc_init
790     procedure :: acc_init_h
791   end interface
792
793   interface acc_shutdown
794     procedure :: acc_shutdown_h
795   end interface
796
797   interface acc_on_device
798     procedure :: acc_on_device_h
799   end interface
800
801   ! acc_malloc: Only available in C/C++
802   ! acc_free: Only available in C/C++
803
804   ! As vendor extension, the following code supports both 32bit and 64bit
805   ! arguments for "size"; the OpenACC standard only permits default-kind
806   ! integers, which are of kind 4 (i.e. 32 bits).
807   ! Additionally, the two-argument version also takes arrays as argument.
808   ! and the one argument version also scalars. Note that the code assumes
809   ! that the arrays are contiguous.
810
811   interface acc_copyin
812     procedure :: acc_copyin_32_h
813     procedure :: acc_copyin_64_h
814     procedure :: acc_copyin_array_h
815   end interface
816
817   interface acc_present_or_copyin
818     procedure :: acc_present_or_copyin_32_h
819     procedure :: acc_present_or_copyin_64_h
820     procedure :: acc_present_or_copyin_array_h
821   end interface
822
823   interface acc_pcopyin
824     procedure :: acc_present_or_copyin_32_h
825     procedure :: acc_present_or_copyin_64_h
826     procedure :: acc_present_or_copyin_array_h
827   end interface
828
829   interface acc_create
830     procedure :: acc_create_32_h
831     procedure :: acc_create_64_h
832     procedure :: acc_create_array_h
833   end interface
834
835   interface acc_present_or_create
836     procedure :: acc_present_or_create_32_h
837     procedure :: acc_present_or_create_64_h
838     procedure :: acc_present_or_create_array_h
839   end interface
840
841   interface acc_pcreate
842     procedure :: acc_present_or_create_32_h
843     procedure :: acc_present_or_create_64_h
844     procedure :: acc_present_or_create_array_h
845   end interface
846
847   interface acc_copyout
848     procedure :: acc_copyout_32_h
849     procedure :: acc_copyout_64_h
850     procedure :: acc_copyout_array_h
851   end interface
852
853   interface acc_copyout_finalize
854     procedure :: acc_copyout_finalize_32_h
855     procedure :: acc_copyout_finalize_64_h
856     procedure :: acc_copyout_finalize_array_h
857   end interface
858
859   interface acc_delete
860     procedure :: acc_delete_32_h
861     procedure :: acc_delete_64_h
862     procedure :: acc_delete_array_h
863   end interface
864
865   interface acc_delete_finalize
866     procedure :: acc_delete_finalize_32_h
867     procedure :: acc_delete_finalize_64_h
868     procedure :: acc_delete_finalize_array_h
869   end interface
870
871   interface acc_update_device
872     procedure :: acc_update_device_32_h
873     procedure :: acc_update_device_64_h
874     procedure :: acc_update_device_array_h
875   end interface
876
877   interface acc_update_self
878     procedure :: acc_update_self_32_h
879     procedure :: acc_update_self_64_h
880     procedure :: acc_update_self_array_h
881   end interface
882
883   ! acc_map_data: Only available in C/C++
884   ! acc_unmap_data: Only available in C/C++
885   ! acc_deviceptr: Only available in C/C++
886   ! acc_hostptr: Only available in C/C++
887
888   interface acc_is_present
889     procedure :: acc_is_present_32_h
890     procedure :: acc_is_present_64_h
891     procedure :: acc_is_present_array_h
892   end interface
893
894   ! acc_memcpy_to_device: Only available in C/C++
895   ! acc_memcpy_from_device: Only available in C/C++
896
897   interface acc_copyin_async
898     procedure :: acc_copyin_async_32_h
899     procedure :: acc_copyin_async_64_h
900     procedure :: acc_copyin_async_array_h
901   end interface
902
903   interface acc_create_async
904     procedure :: acc_create_async_32_h
905     procedure :: acc_create_async_64_h
906     procedure :: acc_create_async_array_h
907   end interface
908
909   interface acc_copyout_async
910     procedure :: acc_copyout_async_32_h
911     procedure :: acc_copyout_async_64_h
912     procedure :: acc_copyout_async_array_h
913   end interface
914
915   interface acc_delete_async
916     procedure :: acc_delete_async_32_h
917     procedure :: acc_delete_async_64_h
918     procedure :: acc_delete_async_array_h
919   end interface
920
921   interface acc_update_device_async
922     procedure :: acc_update_device_async_32_h
923     procedure :: acc_update_device_async_64_h
924     procedure :: acc_update_device_async_array_h
925   end interface
926
927   interface acc_update_self_async
928     procedure :: acc_update_self_async_32_h
929     procedure :: acc_update_self_async_64_h
930     procedure :: acc_update_self_async_array_h
931   end interface
932
933 end module
934
935 function acc_get_num_devices_h (d)
936   use openacc_internal, only: acc_get_num_devices_l
937   use openacc_kinds
938   integer acc_get_num_devices_h
939   integer (acc_device_kind) d
940   acc_get_num_devices_h = acc_get_num_devices_l (d)
941 end function
942
943 subroutine acc_set_device_type_h (d)
944   use openacc_internal, only: acc_set_device_type_l
945   use openacc_kinds
946   integer (acc_device_kind) d
947   call acc_set_device_type_l (d)
948 end subroutine
949
950 function acc_get_device_type_h ()
951   use openacc_internal, only: acc_get_device_type_l
952   use openacc_kinds
953   integer (acc_device_kind) acc_get_device_type_h
954   acc_get_device_type_h = acc_get_device_type_l ()
955 end function
956
957 subroutine acc_set_device_num_h (n, d)
958   use openacc_internal, only: acc_set_device_num_l
959   use openacc_kinds
960   integer n
961   integer (acc_device_kind) d
962   call acc_set_device_num_l (n, d)
963 end subroutine
964
965 function acc_get_device_num_h (d)
966   use openacc_internal, only: acc_get_device_num_l
967   use openacc_kinds
968   integer acc_get_device_num_h
969   integer (acc_device_kind) d
970   acc_get_device_num_h = acc_get_device_num_l (d)
971 end function
972
973 function acc_async_test_h (a)
974   use openacc_internal, only: acc_async_test_l
975   logical acc_async_test_h
976   integer a
977   if (acc_async_test_l (a) .eq. 1) then
978     acc_async_test_h = .TRUE.
979   else
980     acc_async_test_h = .FALSE.
981   end if
982 end function
983
984 function acc_async_test_all_h ()
985   use openacc_internal, only: acc_async_test_all_l
986   logical acc_async_test_all_h
987   if (acc_async_test_all_l () .eq. 1) then
988     acc_async_test_all_h = .TRUE.
989   else
990     acc_async_test_all_h = .FALSE.
991   end if
992 end function
993
994 subroutine acc_wait_h (a)
995   use openacc_internal, only: acc_wait_l
996   integer a
997   call acc_wait_l (a)
998 end subroutine
999
1000 subroutine acc_wait_async_h (a1, a2)
1001   use openacc_internal, only: acc_wait_async_l
1002   integer a1, a2
1003   call acc_wait_async_l (a1, a2)
1004 end subroutine
1005
1006 subroutine acc_wait_all_h ()
1007   use openacc_internal, only: acc_wait_all_l
1008   call acc_wait_all_l ()
1009 end subroutine
1010
1011 subroutine acc_wait_all_async_h (a)
1012   use openacc_internal, only: acc_wait_all_async_l
1013   integer a
1014   call acc_wait_all_async_l (a)
1015 end subroutine
1016
1017 subroutine acc_init_h (d)
1018   use openacc_internal, only: acc_init_l
1019   use openacc_kinds
1020   integer (acc_device_kind) d
1021   call acc_init_l (d)
1022 end subroutine
1023
1024 subroutine acc_shutdown_h (d)
1025   use openacc_internal, only: acc_shutdown_l
1026   use openacc_kinds
1027   integer (acc_device_kind) d
1028   call acc_shutdown_l (d)
1029 end subroutine
1030
1031 function acc_on_device_h (d)
1032   use openacc_internal, only: acc_on_device_l
1033   use openacc_kinds
1034   integer (acc_device_kind) d
1035   logical acc_on_device_h
1036   if (acc_on_device_l (d) .eq. 1) then
1037     acc_on_device_h = .TRUE.
1038   else
1039     acc_on_device_h = .FALSE.
1040   end if
1041 end function
1042
1043 subroutine acc_copyin_32_h (a, len)
1044   use iso_c_binding, only: c_int32_t, c_size_t
1045   use openacc_internal, only: acc_copyin_l
1046   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1047   type (*), dimension (*) :: a
1048   integer (c_int32_t) len
1049   call acc_copyin_l (a, int (len, kind = c_size_t))
1050 end subroutine
1051
1052 subroutine acc_copyin_64_h (a, len)
1053   use iso_c_binding, only: c_int64_t, c_size_t
1054   use openacc_internal, only: acc_copyin_l
1055   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1056   type (*), dimension (*) :: a
1057   integer (c_int64_t) len
1058   call acc_copyin_l (a, int (len, kind = c_size_t))
1059 end subroutine
1060
1061 subroutine acc_copyin_array_h (a)
1062   use openacc_internal, only: acc_copyin_l
1063   type (*), dimension (..), contiguous :: a
1064   call acc_copyin_l (a, sizeof (a))
1065 end subroutine
1066
1067 subroutine acc_present_or_copyin_32_h (a, len)
1068   use iso_c_binding, only: c_int32_t, c_size_t
1069   use openacc_internal, only: acc_present_or_copyin_l
1070   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1071   type (*), dimension (*) :: a
1072   integer (c_int32_t) len
1073   call acc_present_or_copyin_l (a, int (len, kind = c_size_t))
1074 end subroutine
1075
1076 subroutine acc_present_or_copyin_64_h (a, len)
1077   use iso_c_binding, only: c_int64_t, c_size_t
1078   use openacc_internal, only: acc_present_or_copyin_l
1079   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1080   type (*), dimension (*) :: a
1081   integer (c_int64_t) len
1082   call acc_present_or_copyin_l (a, int (len, kind = c_size_t))
1083 end subroutine
1084
1085 subroutine acc_present_or_copyin_array_h (a)
1086   use openacc_internal, only: acc_present_or_copyin_l
1087   type (*), dimension (..), contiguous :: a
1088   call acc_present_or_copyin_l (a, sizeof (a))
1089 end subroutine
1090
1091 subroutine acc_create_32_h (a, len)
1092   use iso_c_binding, only: c_int32_t, c_size_t
1093   use openacc_internal, only: acc_create_l
1094   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1095   type (*), dimension (*) :: a
1096   integer (c_int32_t) len
1097   call acc_create_l (a, int (len, kind = c_size_t))
1098 end subroutine
1099
1100 subroutine acc_create_64_h (a, len)
1101   use iso_c_binding, only: c_int64_t, c_size_t
1102   use openacc_internal, only: acc_create_l
1103   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1104   type (*), dimension (*) :: a
1105   integer (c_int64_t) len
1106   call acc_create_l (a, int (len, kind = c_size_t))
1107 end subroutine
1108
1109 subroutine acc_create_array_h (a)
1110   use openacc_internal, only: acc_create_l
1111   type (*), dimension (..), contiguous :: a
1112   call acc_create_l (a, sizeof (a))
1113 end subroutine
1114
1115 subroutine acc_present_or_create_32_h (a, len)
1116   use iso_c_binding, only: c_int32_t, c_size_t
1117   use openacc_internal, only: acc_present_or_create_l
1118   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1119   type (*), dimension (*) :: a
1120   integer (c_int32_t) len
1121   call acc_present_or_create_l (a, int (len, kind = c_size_t))
1122 end subroutine
1123
1124 subroutine acc_present_or_create_64_h (a, len)
1125   use iso_c_binding, only: c_int64_t, c_size_t
1126   use openacc_internal, only: acc_present_or_create_l
1127   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1128   type (*), dimension (*) :: a
1129   integer (c_int64_t) len
1130   call acc_present_or_create_l (a, int (len, kind = c_size_t))
1131 end subroutine
1132
1133 subroutine acc_present_or_create_array_h (a)
1134   use openacc_internal, only: acc_present_or_create_l
1135   type (*), dimension (..), contiguous :: a
1136   call acc_present_or_create_l (a, sizeof (a))
1137 end subroutine
1138
1139 subroutine acc_copyout_32_h (a, len)
1140   use iso_c_binding, only: c_int32_t, c_size_t
1141   use openacc_internal, only: acc_copyout_l
1142   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1143   type (*), dimension (*) :: a
1144   integer (c_int32_t) len
1145   call acc_copyout_l (a, int (len, kind = c_size_t))
1146 end subroutine
1147
1148 subroutine acc_copyout_64_h (a, len)
1149   use iso_c_binding, only: c_int64_t, c_size_t
1150   use openacc_internal, only: acc_copyout_l
1151   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1152   type (*), dimension (*) :: a
1153   integer (c_int64_t) len
1154   call acc_copyout_l (a, int (len, kind = c_size_t))
1155 end subroutine
1156
1157 subroutine acc_copyout_array_h (a)
1158   use openacc_internal, only: acc_copyout_l
1159   type (*), dimension (..), contiguous :: a
1160   call acc_copyout_l (a, sizeof (a))
1161 end subroutine
1162
1163 subroutine acc_copyout_finalize_32_h (a, len)
1164   use iso_c_binding, only: c_int32_t, c_size_t
1165   use openacc_internal, only: acc_copyout_finalize_l
1166   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1167   type (*), dimension (*) :: a
1168   integer (c_int32_t) len
1169   call acc_copyout_finalize_l (a, int (len, kind = c_size_t))
1170 end subroutine
1171
1172 subroutine acc_copyout_finalize_64_h (a, len)
1173   use iso_c_binding, only: c_int64_t, c_size_t
1174   use openacc_internal, only: acc_copyout_finalize_l
1175   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1176   type (*), dimension (*) :: a
1177   integer (c_int64_t) len
1178   call acc_copyout_finalize_l (a, int (len, kind = c_size_t))
1179 end subroutine
1180
1181 subroutine acc_copyout_finalize_array_h (a)
1182   use openacc_internal, only: acc_copyout_finalize_l
1183   type (*), dimension (..), contiguous :: a
1184   call acc_copyout_finalize_l (a, sizeof (a))
1185 end subroutine
1186
1187 subroutine acc_delete_32_h (a, len)
1188   use iso_c_binding, only: c_int32_t, c_size_t
1189   use openacc_internal, only: acc_delete_l
1190   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1191   type (*), dimension (*) :: a
1192   integer (c_int32_t) len
1193   call acc_delete_l (a, int (len, kind = c_size_t))
1194 end subroutine
1195
1196 subroutine acc_delete_64_h (a, len)
1197   use iso_c_binding, only: c_int64_t, c_size_t
1198   use openacc_internal, only: acc_delete_l
1199   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1200   type (*), dimension (*) :: a
1201   integer (c_int64_t) len
1202   call acc_delete_l (a, int (len, kind = c_size_t))
1203 end subroutine
1204
1205 subroutine acc_delete_array_h (a)
1206   use openacc_internal, only: acc_delete_l
1207   type (*), dimension (..), contiguous :: a
1208   call acc_delete_l (a, sizeof (a))
1209 end subroutine
1210
1211 subroutine acc_delete_finalize_32_h (a, len)
1212   use iso_c_binding, only: c_int32_t, c_size_t
1213   use openacc_internal, only: acc_delete_finalize_l
1214   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1215   type (*), dimension (*) :: a
1216   integer (c_int32_t) len
1217   call acc_delete_finalize_l (a, int (len, kind = c_size_t))
1218 end subroutine
1219
1220 subroutine acc_delete_finalize_64_h (a, len)
1221   use iso_c_binding, only: c_int64_t, c_size_t
1222   use openacc_internal, only: acc_delete_finalize_l
1223   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1224   type (*), dimension (*) :: a
1225   integer (c_int64_t) len
1226   call acc_delete_finalize_l (a, int (len, kind = c_size_t))
1227 end subroutine
1228
1229 subroutine acc_delete_finalize_array_h (a)
1230   use openacc_internal, only: acc_delete_finalize_l
1231   type (*), dimension (..), contiguous :: a
1232   call acc_delete_finalize_l (a, sizeof (a))
1233 end subroutine
1234
1235 subroutine acc_update_device_32_h (a, len)
1236   use iso_c_binding, only: c_int32_t, c_size_t
1237   use openacc_internal, only: acc_update_device_l
1238   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1239   type (*), dimension (*) :: a
1240   integer (c_int32_t) len
1241   call acc_update_device_l (a, int (len, kind = c_size_t))
1242 end subroutine
1243
1244 subroutine acc_update_device_64_h (a, len)
1245   use iso_c_binding, only: c_int64_t, c_size_t
1246   use openacc_internal, only: acc_update_device_l
1247   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1248   type (*), dimension (*) :: a
1249   integer (c_int64_t) len
1250   call acc_update_device_l (a, int (len, kind = c_size_t))
1251 end subroutine
1252
1253 subroutine acc_update_device_array_h (a)
1254   use openacc_internal, only: acc_update_device_l
1255   type (*), dimension (..), contiguous :: a
1256   call acc_update_device_l (a, sizeof (a))
1257 end subroutine
1258
1259 subroutine acc_update_self_32_h (a, len)
1260   use iso_c_binding, only: c_int32_t, c_size_t
1261   use openacc_internal, only: acc_update_self_l
1262   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1263   type (*), dimension (*) :: a
1264   integer (c_int32_t) len
1265   call acc_update_self_l (a, int (len, kind = c_size_t))
1266 end subroutine
1267
1268 subroutine acc_update_self_64_h (a, len)
1269   use iso_c_binding, only: c_int64_t, c_size_t
1270   use openacc_internal, only: acc_update_self_l
1271   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1272   type (*), dimension (*) :: a
1273   integer (c_int64_t) len
1274   call acc_update_self_l (a, int (len, kind = c_size_t))
1275 end subroutine
1276
1277 subroutine acc_update_self_array_h (a)
1278   use openacc_internal, only: acc_update_self_l
1279   type (*), dimension (..), contiguous :: a
1280   call acc_update_self_l (a, sizeof (a))
1281 end subroutine
1282
1283 function acc_is_present_32_h (a, len)
1284   use iso_c_binding, only: c_int32_t, c_size_t
1285   use openacc_internal, only: acc_is_present_l
1286   logical acc_is_present_32_h
1287   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1288   type (*), dimension (*) :: a
1289   integer (c_int32_t) len
1290   if (acc_is_present_l (a, int (len, kind = c_size_t)) .eq. 1) then
1291     acc_is_present_32_h = .TRUE.
1292   else
1293     acc_is_present_32_h = .FALSE.
1294   end if
1295 end function
1296
1297 function acc_is_present_64_h (a, len)
1298   use iso_c_binding, only: c_int64_t, c_size_t
1299   use openacc_internal, only: acc_is_present_l
1300   logical acc_is_present_64_h
1301   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1302   type (*), dimension (*) :: a
1303   integer (c_int64_t) len
1304   if (acc_is_present_l (a, int (len, kind = c_size_t)) .eq. 1) then
1305     acc_is_present_64_h = .TRUE.
1306   else
1307     acc_is_present_64_h = .FALSE.
1308   end if
1309 end function
1310
1311 function acc_is_present_array_h (a)
1312   use openacc_internal, only: acc_is_present_l
1313   logical acc_is_present_array_h
1314   type (*), dimension (..), contiguous :: a
1315   acc_is_present_array_h = acc_is_present_l (a, sizeof (a)) == 1
1316 end function
1317
1318 subroutine acc_copyin_async_32_h (a, len, async)
1319   use iso_c_binding, only: c_int32_t, c_size_t, c_int
1320   use openacc_internal, only: acc_copyin_async_l
1321   use openacc_kinds, only: acc_handle_kind
1322   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1323   type (*), dimension (*) :: a
1324   integer (c_int32_t) len
1325   integer (acc_handle_kind) async
1326   call acc_copyin_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1327 end subroutine
1328
1329 subroutine acc_copyin_async_64_h (a, len, async)
1330   use iso_c_binding, only: c_int64_t, c_size_t, c_int
1331   use openacc_internal, only: acc_copyin_async_l
1332   use openacc_kinds, only: acc_handle_kind
1333   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1334   type (*), dimension (*) :: a
1335   integer (c_int64_t) len
1336   integer (acc_handle_kind) async
1337   call acc_copyin_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1338 end subroutine
1339
1340 subroutine acc_copyin_async_array_h (a, async)
1341   use iso_c_binding, only: c_int
1342   use openacc_internal, only: acc_copyin_async_l
1343   use openacc_kinds, only: acc_handle_kind
1344   type (*), dimension (..), contiguous :: a
1345   integer (acc_handle_kind) async
1346   call acc_copyin_async_l (a, sizeof (a), int (async, kind = c_int))
1347 end subroutine
1348
1349 subroutine acc_create_async_32_h (a, len, async)
1350   use iso_c_binding, only: c_int32_t, c_size_t, c_int
1351   use openacc_internal, only: acc_create_async_l
1352   use openacc_kinds, only: acc_handle_kind
1353   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1354   type (*), dimension (*) :: a
1355   integer (c_int32_t) len
1356   integer (acc_handle_kind) async
1357   call acc_create_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1358 end subroutine
1359
1360 subroutine acc_create_async_64_h (a, len, async)
1361   use iso_c_binding, only: c_int64_t, c_size_t, c_int
1362   use openacc_internal, only: acc_create_async_l
1363   use openacc_kinds, only: acc_handle_kind
1364   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1365   type (*), dimension (*) :: a
1366   integer (c_int64_t) len
1367   integer (acc_handle_kind) async
1368   call acc_create_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1369 end subroutine
1370
1371 subroutine acc_create_async_array_h (a, async)
1372   use iso_c_binding, only: c_int
1373   use openacc_internal, only: acc_create_async_l
1374   use openacc_kinds, only: acc_handle_kind
1375   type (*), dimension (..), contiguous :: a
1376   integer (acc_handle_kind) async
1377   call acc_create_async_l (a, sizeof (a), int (async, kind = c_int))
1378 end subroutine
1379
1380 subroutine acc_copyout_async_32_h (a, len, async)
1381   use iso_c_binding, only: c_int32_t, c_size_t, c_int
1382   use openacc_internal, only: acc_copyout_async_l
1383   use openacc_kinds, only: acc_handle_kind
1384   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1385   type (*), dimension (*) :: a
1386   integer (c_int32_t) len
1387   integer (acc_handle_kind) async
1388   call acc_copyout_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1389 end subroutine
1390
1391 subroutine acc_copyout_async_64_h (a, len, async)
1392   use iso_c_binding, only: c_int64_t, c_size_t, c_int
1393   use openacc_internal, only: acc_copyout_async_l
1394   use openacc_kinds, only: acc_handle_kind
1395   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1396   type (*), dimension (*) :: a
1397   integer (c_int64_t) len
1398   integer (acc_handle_kind) async
1399   call acc_copyout_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1400 end subroutine
1401
1402 subroutine acc_copyout_async_array_h (a, async)
1403   use iso_c_binding, only: c_int
1404   use openacc_internal, only: acc_copyout_async_l
1405   use openacc_kinds, only: acc_handle_kind
1406   type (*), dimension (..), contiguous :: a
1407   integer (acc_handle_kind) async
1408   call acc_copyout_async_l (a, sizeof (a), int (async, kind = c_int))
1409 end subroutine
1410
1411 subroutine acc_delete_async_32_h (a, len, async)
1412   use iso_c_binding, only: c_int32_t, c_size_t, c_int
1413   use openacc_internal, only: acc_delete_async_l
1414   use openacc_kinds, only: acc_handle_kind
1415   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1416   type (*), dimension (*) :: a
1417   integer (c_int32_t) len
1418   integer (acc_handle_kind) async
1419   call acc_delete_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1420 end subroutine
1421
1422 subroutine acc_delete_async_64_h (a, len, async)
1423   use iso_c_binding, only: c_int64_t, c_size_t, c_int
1424   use openacc_internal, only: acc_delete_async_l
1425   use openacc_kinds, only: acc_handle_kind
1426   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1427   type (*), dimension (*) :: a
1428   integer (c_int64_t) len
1429   integer (acc_handle_kind) async
1430   call acc_delete_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1431 end subroutine
1432
1433 subroutine acc_delete_async_array_h (a, async)
1434   use iso_c_binding, only: c_int
1435   use openacc_internal, only: acc_delete_async_l
1436   use openacc_kinds, only: acc_handle_kind
1437   type (*), dimension (..), contiguous :: a
1438   integer (acc_handle_kind) async
1439   call acc_delete_async_l (a, sizeof (a), int (async, kind = c_int))
1440 end subroutine
1441
1442 subroutine acc_update_device_async_32_h (a, len, async)
1443   use iso_c_binding, only: c_int32_t, c_size_t, c_int
1444   use openacc_internal, only: acc_update_device_async_l
1445   use openacc_kinds, only: acc_handle_kind
1446   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1447   type (*), dimension (*) :: a
1448   integer (c_int32_t) len
1449   integer (acc_handle_kind) async
1450   call acc_update_device_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1451 end subroutine
1452
1453 subroutine acc_update_device_async_64_h (a, len, async)
1454   use iso_c_binding, only: c_int64_t, c_size_t, c_int
1455   use openacc_internal, only: acc_update_device_async_l
1456   use openacc_kinds, only: acc_handle_kind
1457   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1458   type (*), dimension (*) :: a
1459   integer (c_int64_t) len
1460   integer (acc_handle_kind) async
1461   call acc_update_device_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1462 end subroutine
1463
1464 subroutine acc_update_device_async_array_h (a, async)
1465   use iso_c_binding, only: c_int
1466   use openacc_internal, only: acc_update_device_async_l
1467   use openacc_kinds, only: acc_handle_kind
1468   type (*), dimension (..), contiguous :: a
1469   integer (acc_handle_kind) async
1470   call acc_update_device_async_l (a, sizeof (a), int (async, kind = c_int))
1471 end subroutine
1472
1473 subroutine acc_update_self_async_32_h (a, len, async)
1474   use iso_c_binding, only: c_int32_t, c_size_t, c_int
1475   use openacc_internal, only: acc_update_self_async_l
1476   use openacc_kinds, only: acc_handle_kind
1477   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1478   type (*), dimension (*) :: a
1479   integer (c_int32_t) len
1480   integer (acc_handle_kind) async
1481   call acc_update_self_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1482 end subroutine
1483
1484 subroutine acc_update_self_async_64_h (a, len, async)
1485   use iso_c_binding, only: c_int64_t, c_size_t, c_int
1486   use openacc_internal, only: acc_update_self_async_l
1487   use openacc_kinds, only: acc_handle_kind
1488   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
1489   type (*), dimension (*) :: a
1490   integer (c_int64_t) len
1491   integer (acc_handle_kind) async
1492   call acc_update_self_async_l (a, int (len, kind = c_size_t), int (async, kind = c_int))
1493 end subroutine
1494
1495 subroutine acc_update_self_async_array_h (a, async)
1496   use iso_c_binding, only: c_int
1497   use openacc_internal, only: acc_update_self_async_l
1498   use openacc_kinds, only: acc_handle_kind
1499   type (*), dimension (..), contiguous :: a
1500   integer (acc_handle_kind) async
1501   call acc_update_self_async_l (a, sizeof (a), int (async, kind = c_int))
1502 end subroutine