1 ! OpenACC Runtime Library Definitions
. -*- mode
: fortran
-*-
3 ! Copyright (C
) 2014-2015 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
42 integer (acc_device_kind
), parameter :: acc_device_not_host
= 4
43 integer (acc_device_kind
), parameter :: acc_device_nvidia
= 5
45 integer
, parameter :: acc_handle_kind
= 4
47 ! Keep in sync with include
/gomp
-constants
.h
.
48 integer (acc_handle_kind
), parameter :: acc_async_noval
= -1
49 integer (acc_handle_kind
), parameter :: acc_async_sync
= -2
51 integer
, parameter :: openacc_version
= 201306
53 interface acc_get_num_devices
54 function
acc_get_num_devices_h (d
)
55 import acc_device_kind
56 integer acc_get_num_devices_h
57 integer (acc_device_kind
) d
61 interface acc_set_device_type
62 subroutine
acc_set_device_type_h (d
)
63 import acc_device_kind
64 integer (acc_device_kind
) d
68 interface acc_get_device_type
69 function
acc_get_device_type_h ()
70 import acc_device_kind
71 integer (acc_device_kind
) acc_get_device_type_h
75 interface acc_set_device_num
76 subroutine
acc_set_device_num_h (n
, d
)
77 import acc_device_kind
79 integer (acc_device_kind
) d
83 interface acc_get_device_num
84 function
acc_get_device_num_h (d
)
85 import acc_device_kind
86 integer acc_get_device_num_h
87 integer (acc_device_kind
) d
91 interface acc_async_test
92 function
acc_async_test_h (a
)
93 logical acc_async_test_h
98 interface acc_async_test_all
99 function
acc_async_test_all_h ()
100 logical acc_async_test_all_h
105 subroutine
acc_wait_h (a
)
110 interface acc_wait_async
111 subroutine
acc_wait_async_h (a1
, a2
)
116 interface acc_wait_all
117 subroutine
acc_wait_all_h ()
121 interface acc_wait_all_async
122 subroutine
acc_wait_all_async_h (a
)
128 subroutine
acc_init_h (devicetype
)
129 import acc_device_kind
130 integer (acc_device_kind
) devicetype
134 interface acc_shutdown
135 subroutine
acc_shutdown_h (devicetype
)
136 import acc_device_kind
137 integer (acc_device_kind
) devicetype
141 interface acc_on_device
142 function
acc_on_device_h (devicetype
)
143 import acc_device_kind
144 logical acc_on_device_h
145 integer (acc_device_kind
) devicetype
149 ! acc_malloc
: Only available in C
/C
++
150 ! acc_free
: Only available in C
/C
++
153 subroutine
acc_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
160 subroutine
acc_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
167 subroutine
acc_copyin_array_h (a
)
168 type (*), dimension (..), contiguous :: a
172 interface acc_present_or_copyin
173 subroutine
acc_present_or_copyin_32_h (a
, len
)
174 use iso_c_binding
, only
: c_int32_t
175 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
176 type (*), dimension (*) :: a
177 integer (c_int32_t
) len
180 subroutine
acc_present_or_copyin_64_h (a
, len
)
181 use iso_c_binding
, only
: c_int64_t
182 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
183 type (*), dimension (*) :: a
184 integer (c_int64_t
) len
187 subroutine
acc_present_or_copyin_array_h (a
)
188 type (*), dimension (..), contiguous :: a
192 interface acc_pcopyin
193 subroutine
acc_pcopyin_32_h (a
, len
)
194 use iso_c_binding
, only
: c_int32_t
195 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
196 type (*), dimension (*) :: a
197 integer (c_int32_t
) len
200 subroutine
acc_pcopyin_64_h (a
, len
)
201 use iso_c_binding
, only
: c_int64_t
202 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
203 type (*), dimension (*) :: a
204 integer (c_int64_t
) len
207 subroutine
acc_pcopyin_array_h (a
)
208 type (*), dimension (..), contiguous :: a
213 subroutine
acc_create_32_h (a
, len
)
214 use iso_c_binding
, only
: c_int32_t
215 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
216 type (*), dimension (*) :: a
217 integer (c_int32_t
) len
220 subroutine
acc_create_64_h (a
, len
)
221 use iso_c_binding
, only
: c_int64_t
222 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
223 type (*), dimension (*) :: a
224 integer (c_int64_t
) len
227 subroutine
acc_create_array_h (a
)
228 type (*), dimension (..), contiguous :: a
232 interface acc_present_or_create
233 subroutine
acc_present_or_create_32_h (a
, len
)
234 use iso_c_binding
, only
: c_int32_t
235 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
236 type (*), dimension (*) :: a
237 integer (c_int32_t
) len
240 subroutine
acc_present_or_create_64_h (a
, len
)
241 use iso_c_binding
, only
: c_int64_t
242 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
243 type (*), dimension (*) :: a
244 integer (c_int64_t
) len
247 subroutine
acc_present_or_create_array_h (a
)
248 type (*), dimension (..), contiguous :: a
252 interface acc_pcreate
253 subroutine
acc_pcreate_32_h (a
, len
)
254 use iso_c_binding
, only
: c_int32_t
255 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
256 type (*), dimension (*) :: a
257 integer (c_int32_t
) len
260 subroutine
acc_pcreate_64_h (a
, len
)
261 use iso_c_binding
, only
: c_int64_t
262 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
263 type (*), dimension (*) :: a
264 integer (c_int64_t
) len
267 subroutine
acc_pcreate_array_h (a
)
268 type (*), dimension (..), contiguous :: a
272 interface acc_copyout
273 subroutine
acc_copyout_32_h (a
, len
)
274 use iso_c_binding
, only
: c_int32_t
275 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
276 type (*), dimension (*) :: a
277 integer (c_int32_t
) len
280 subroutine
acc_copyout_64_h (a
, len
)
281 use iso_c_binding
, only
: c_int64_t
282 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
283 type (*), dimension (*) :: a
284 integer (c_int64_t
) len
287 subroutine
acc_copyout_array_h (a
)
288 type (*), dimension (..), contiguous :: a
293 subroutine
acc_delete_32_h (a
, len
)
294 use iso_c_binding
, only
: c_int32_t
295 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
296 type (*), dimension (*) :: a
297 integer (c_int32_t
) len
300 subroutine
acc_delete_64_h (a
, len
)
301 use iso_c_binding
, only
: c_int64_t
302 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
303 type (*), dimension (*) :: a
304 integer (c_int64_t
) len
307 subroutine
acc_delete_array_h (a
)
308 type (*), dimension (..), contiguous :: a
312 interface acc_update_device
313 subroutine
acc_update_device_32_h (a
, len
)
314 use iso_c_binding
, only
: c_int32_t
315 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
316 type (*), dimension (*) :: a
317 integer (c_int32_t
) len
320 subroutine
acc_update_device_64_h (a
, len
)
321 use iso_c_binding
, only
: c_int64_t
322 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
323 type (*), dimension (*) :: a
324 integer (c_int64_t
) len
327 subroutine
acc_update_device_array_h (a
)
328 type (*), dimension (..), contiguous :: a
332 interface acc_update_self
333 subroutine
acc_update_self_32_h (a
, len
)
334 use iso_c_binding
, only
: c_int32_t
335 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
336 type (*), dimension (*) :: a
337 integer (c_int32_t
) len
340 subroutine
acc_update_self_64_h (a
, len
)
341 use iso_c_binding
, only
: c_int64_t
342 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
343 type (*), dimension (*) :: a
344 integer (c_int64_t
) len
347 subroutine
acc_update_self_array_h (a
)
348 type (*), dimension (..), contiguous :: a
352 ! acc_map_data
: Only available in C
/C
++
353 ! acc_unmap_data
: Only available in C
/C
++
354 ! acc_deviceptr
: Only available in C
/C
++
355 ! acc_ostptr
: Only available in C
/C
++
357 interface acc_is_present
358 function
acc_is_present_32_h (a
, len
)
359 use iso_c_binding
, only
: c_int32_t
360 logical acc_is_present_32_h
361 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
362 type (*), dimension (*) :: a
363 integer (c_int32_t
) len
366 function
acc_is_present_64_h (a
, len
)
367 use iso_c_binding
, only
: c_int64_t
368 logical acc_is_present_64_h
369 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
370 type (*), dimension (*) :: a
371 integer (c_int64_t
) len
374 function
acc_is_present_array_h (a
)
375 logical acc_is_present_array_h
376 type (*), dimension (..), contiguous :: a
380 ! acc_memcpy_to_device
: Only available in C
/C
++
381 ! acc_memcpy_from_device
: Only available in C
/C
++