1 ! OpenACC Runtime Library Definitions
. -*- mode
: fortran
-*-
3 ! Copyright (C
) 2014-2017 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 interface acc_wait_async
112 subroutine
acc_wait_async_h (a1
, a2
)
117 interface acc_wait_all
118 subroutine
acc_wait_all_h ()
122 interface acc_wait_all_async
123 subroutine
acc_wait_all_async_h (a
)
129 subroutine
acc_init_h (devicetype
)
130 import acc_device_kind
131 integer (acc_device_kind
) devicetype
135 interface acc_shutdown
136 subroutine
acc_shutdown_h (devicetype
)
137 import acc_device_kind
138 integer (acc_device_kind
) devicetype
142 interface acc_on_device
143 function
acc_on_device_h (devicetype
)
144 import acc_device_kind
145 logical acc_on_device_h
146 integer (acc_device_kind
) devicetype
150 ! acc_malloc
: Only available in C
/C
++
151 ! acc_free
: Only available in C
/C
++
154 subroutine
acc_copyin_32_h (a
, len
)
155 use iso_c_binding
, only
: c_int32_t
156 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
157 type (*), dimension (*) :: a
158 integer (c_int32_t
) len
161 subroutine
acc_copyin_64_h (a
, len
)
162 use iso_c_binding
, only
: c_int64_t
163 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
164 type (*), dimension (*) :: a
165 integer (c_int64_t
) len
168 subroutine
acc_copyin_array_h (a
)
169 type (*), dimension (..), contiguous :: a
173 interface acc_present_or_copyin
174 subroutine
acc_present_or_copyin_32_h (a
, len
)
175 use iso_c_binding
, only
: c_int32_t
176 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
177 type (*), dimension (*) :: a
178 integer (c_int32_t
) len
181 subroutine
acc_present_or_copyin_64_h (a
, len
)
182 use iso_c_binding
, only
: c_int64_t
183 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
184 type (*), dimension (*) :: a
185 integer (c_int64_t
) len
188 subroutine
acc_present_or_copyin_array_h (a
)
189 type (*), dimension (..), contiguous :: a
193 interface acc_pcopyin
194 subroutine
acc_pcopyin_32_h (a
, len
)
195 use iso_c_binding
, only
: c_int32_t
196 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
197 type (*), dimension (*) :: a
198 integer (c_int32_t
) len
201 subroutine
acc_pcopyin_64_h (a
, len
)
202 use iso_c_binding
, only
: c_int64_t
203 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
204 type (*), dimension (*) :: a
205 integer (c_int64_t
) len
208 subroutine
acc_pcopyin_array_h (a
)
209 type (*), dimension (..), contiguous :: a
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 subroutine
acc_pcreate_32_h (a
, len
)
255 use iso_c_binding
, only
: c_int32_t
256 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
257 type (*), dimension (*) :: a
258 integer (c_int32_t
) len
261 subroutine
acc_pcreate_64_h (a
, len
)
262 use iso_c_binding
, only
: c_int64_t
263 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
264 type (*), dimension (*) :: a
265 integer (c_int64_t
) len
268 subroutine
acc_pcreate_array_h (a
)
269 type (*), dimension (..), contiguous :: a
273 interface acc_copyout
274 subroutine
acc_copyout_32_h (a
, len
)
275 use iso_c_binding
, only
: c_int32_t
276 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
277 type (*), dimension (*) :: a
278 integer (c_int32_t
) len
281 subroutine
acc_copyout_64_h (a
, len
)
282 use iso_c_binding
, only
: c_int64_t
283 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
284 type (*), dimension (*) :: a
285 integer (c_int64_t
) len
288 subroutine
acc_copyout_array_h (a
)
289 type (*), dimension (..), contiguous :: a
294 subroutine
acc_delete_32_h (a
, len
)
295 use iso_c_binding
, only
: c_int32_t
296 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
297 type (*), dimension (*) :: a
298 integer (c_int32_t
) len
301 subroutine
acc_delete_64_h (a
, len
)
302 use iso_c_binding
, only
: c_int64_t
303 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
304 type (*), dimension (*) :: a
305 integer (c_int64_t
) len
308 subroutine
acc_delete_array_h (a
)
309 type (*), dimension (..), contiguous :: a
313 interface acc_update_device
314 subroutine
acc_update_device_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
321 subroutine
acc_update_device_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
328 subroutine
acc_update_device_array_h (a
)
329 type (*), dimension (..), contiguous :: a
333 interface acc_update_self
334 subroutine
acc_update_self_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
341 subroutine
acc_update_self_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
348 subroutine
acc_update_self_array_h (a
)
349 type (*), dimension (..), contiguous :: a
353 ! acc_map_data
: Only available in C
/C
++
354 ! acc_unmap_data
: Only available in C
/C
++
355 ! acc_deviceptr
: Only available in C
/C
++
356 ! acc_ostptr
: Only available in C
/C
++
358 interface acc_is_present
359 function
acc_is_present_32_h (a
, len
)
360 use iso_c_binding
, only
: c_int32_t
361 logical acc_is_present_32_h
362 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
363 type (*), dimension (*) :: a
364 integer (c_int32_t
) len
367 function
acc_is_present_64_h (a
, len
)
368 use iso_c_binding
, only
: c_int64_t
369 logical acc_is_present_64_h
370 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
371 type (*), dimension (*) :: a
372 integer (c_int64_t
) len
375 function
acc_is_present_array_h (a
)
376 logical acc_is_present_array_h
377 type (*), dimension (..), contiguous :: a
381 ! acc_memcpy_to_device
: Only available in C
/C
++
382 ! acc_memcpy_from_device
: Only available in C
/C
++