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 ! 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
277 subroutine
acc_delete_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_delete_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_delete_array_h (a
)
292 type (*), dimension (..), contiguous :: a
296 interface acc_update_device
297 subroutine
acc_update_device_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_update_device_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_update_device_array_h (a
)
312 type (*), dimension (..), contiguous :: a
316 interface acc_update_self
317 subroutine
acc_update_self_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_update_self_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_update_self_array_h (a
)
332 type (*), dimension (..), contiguous :: a
336 ! acc_map_data
: Only available in C
/C
++
337 ! acc_unmap_data
: Only available in C
/C
++
338 ! acc_deviceptr
: Only available in C
/C
++
339 ! acc_hostptr
: Only available in C
/C
++
341 interface acc_is_present
342 function
acc_is_present_32_h (a
, len
)
343 use iso_c_binding
, only
: c_int32_t
344 logical acc_is_present_32_h
345 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
346 type (*), dimension (*) :: a
347 integer (c_int32_t
) len
350 function
acc_is_present_64_h (a
, len
)
351 use iso_c_binding
, only
: c_int64_t
352 logical acc_is_present_64_h
353 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
354 type (*), dimension (*) :: a
355 integer (c_int64_t
) len
358 function
acc_is_present_array_h (a
)
359 logical acc_is_present_array_h
360 type (*), dimension (..), contiguous :: a
364 ! acc_memcpy_to_device
: Only available in C
/C
++
365 ! acc_memcpy_from_device
: Only available in C
/C
++