1 ! OpenACC Runtime Library Definitions
. -*- mode
: fortran
-*-
3 ! Copyright (C
) 2014 Free Software Foundation
, Inc
.
5 ! Contributed by Tobias Burnus
<burnus@net
-b
.de
>
8 ! This file is part of the GNU OpenMP
Library (libgomp
).
10 ! Libgomp is free software
; you can redistribute it
and/or modify it
11 ! under the terms of the GNU General Public License as published by
12 ! the Free Software Foundation
; either version
3, or (at your option
)
15 ! Libgomp is distributed in the hope that it will be useful
, but WITHOUT ANY
16 ! WARRANTY
; without even the implied warranty of MERCHANTABILITY
or FITNESS
17 ! FOR A PARTICULAR PURPOSE
. See the GNU General Public License
for
20 ! Under Section
7 of GPL version
3, you are granted additional
21 ! permissions described in the GCC Runtime Library Exception
, version
22 ! 3.1, as published by the Free Software Foundation
.
24 ! You should have received a copy of the GNU General Public License
and
25 ! a copy of the GCC Runtime Library Exception along with
this program
;
26 ! see the files COPYING3
and COPYING
.RUNTIME respectively
. If
not, see
27 ! <http
://www.gnu.org/licenses/>.
29 ! NOTE
: Due to the use of
dimension (..), the code only works when compiled
30 ! with
-std
=f2008ts
/gnu
/legacy but
not with other standard settings
.
31 ! Alternatively
, the user can use the module version
, which permits
32 ! compilation with
-std
=f95
.
34 integer
, parameter :: acc_device_kind
= 4
36 integer (acc_device_kind
), parameter :: acc_device_none
= 0
37 integer (acc_device_kind
), parameter :: acc_device_default
= 1
38 integer (acc_device_kind
), parameter :: acc_device_host
= 2
39 integer (acc_device_kind
), parameter :: acc_device_host_nonshm
= 3
40 integer (acc_device_kind
), parameter :: acc_device_not_host
= 4
41 integer (acc_device_kind
), parameter :: acc_device_nvidia
= 5
43 integer
, parameter :: acc_handle_kind
= 4
45 integer (acc_handle_kind
), parameter :: acc_async_noval
= -1
46 integer (acc_handle_kind
), parameter :: acc_async_sync
= -2
48 integer
, parameter :: openacc_version
= 201306
50 interface acc_get_num_devices
51 function
acc_get_num_devices_h (d
)
52 import acc_device_kind
53 integer acc_get_num_devices_h
54 integer (acc_device_kind
) d
58 interface acc_set_device_type
59 subroutine
acc_set_device_type_h (d
)
60 import acc_device_kind
61 integer (acc_device_kind
) d
65 interface acc_get_device_type
66 function
acc_get_device_type_h ()
67 import acc_device_kind
68 integer (acc_device_kind
) acc_get_device_type_h
72 interface acc_set_device_num
73 subroutine
acc_set_device_num_h (n
, d
)
74 import acc_device_kind
76 integer (acc_device_kind
) d
80 interface acc_get_device_num
81 function
acc_get_device_num_h (d
)
82 import acc_device_kind
83 integer acc_get_device_num_h
84 integer (acc_device_kind
) d
88 interface acc_async_test
89 function
acc_async_test_h (a
)
90 logical acc_async_test_h
95 interface acc_async_test_all
96 function
acc_async_test_all_h ()
97 logical acc_async_test_all_h
102 subroutine
acc_wait_h (a
)
107 interface acc_wait_async
108 subroutine
acc_wait_async_h (a1
, a2
)
113 interface acc_wait_all
114 subroutine
acc_wait_all_h ()
118 interface acc_wait_all_async
119 subroutine
acc_wait_all_async_h (a
)
125 subroutine
acc_init_h (devicetype
)
126 import acc_device_kind
127 integer (acc_device_kind
) devicetype
131 interface acc_shutdown
132 subroutine
acc_shutdown_h (devicetype
)
133 import acc_device_kind
134 integer (acc_device_kind
) devicetype
138 interface acc_on_device
139 function
acc_on_device_h (devicetype
)
140 import acc_device_kind
141 logical acc_on_device_h
142 integer (acc_device_kind
) devicetype
146 ! acc_malloc
: Only available in C
/C
++
147 ! acc_free
: Only available in C
/C
++
150 subroutine
acc_copyin_32_h (a
, len
)
151 use iso_c_binding
, only
: c_int32_t
152 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
153 type (*), dimension (*) :: a
154 integer (c_int32_t
) len
157 subroutine
acc_copyin_64_h (a
, len
)
158 use iso_c_binding
, only
: c_int64_t
159 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
160 type (*), dimension (*) :: a
161 integer (c_int64_t
) len
164 subroutine
acc_copyin_array_h (a
)
165 type (*), dimension (..), contiguous :: a
169 interface acc_present_or_copyin
170 subroutine
acc_present_or_copyin_32_h (a
, len
)
171 use iso_c_binding
, only
: c_int32_t
172 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
173 type (*), dimension (*) :: a
174 integer (c_int32_t
) len
177 subroutine
acc_present_or_copyin_64_h (a
, len
)
178 use iso_c_binding
, only
: c_int64_t
179 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
180 type (*), dimension (*) :: a
181 integer (c_int64_t
) len
184 subroutine
acc_present_or_copyin_array_h (a
)
185 type (*), dimension (..), contiguous :: a
189 interface acc_pcopyin
190 subroutine
acc_pcopyin_32_h (a
, len
)
191 use iso_c_binding
, only
: c_int32_t
192 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
193 type (*), dimension (*) :: a
194 integer (c_int32_t
) len
197 subroutine
acc_pcopyin_64_h (a
, len
)
198 use iso_c_binding
, only
: c_int64_t
199 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
200 type (*), dimension (*) :: a
201 integer (c_int64_t
) len
204 subroutine
acc_pcopyin_array_h (a
)
205 type (*), dimension (..), contiguous :: a
210 subroutine
acc_create_32_h (a
, len
)
211 use iso_c_binding
, only
: c_int32_t
212 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
213 type (*), dimension (*) :: a
214 integer (c_int32_t
) len
217 subroutine
acc_create_64_h (a
, len
)
218 use iso_c_binding
, only
: c_int64_t
219 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
220 type (*), dimension (*) :: a
221 integer (c_int64_t
) len
224 subroutine
acc_create_array_h (a
)
225 type (*), dimension (..), contiguous :: a
229 interface acc_present_or_create
230 subroutine
acc_present_or_create_32_h (a
, len
)
231 use iso_c_binding
, only
: c_int32_t
232 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
233 type (*), dimension (*) :: a
234 integer (c_int32_t
) len
237 subroutine
acc_present_or_create_64_h (a
, len
)
238 use iso_c_binding
, only
: c_int64_t
239 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
240 type (*), dimension (*) :: a
241 integer (c_int64_t
) len
244 subroutine
acc_present_or_create_array_h (a
)
245 type (*), dimension (..), contiguous :: a
249 interface acc_pcreate
250 subroutine
acc_pcreate_32_h (a
, len
)
251 use iso_c_binding
, only
: c_int32_t
252 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
253 type (*), dimension (*) :: a
254 integer (c_int32_t
) len
257 subroutine
acc_pcreate_64_h (a
, len
)
258 use iso_c_binding
, only
: c_int64_t
259 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
260 type (*), dimension (*) :: a
261 integer (c_int64_t
) len
264 subroutine
acc_pcreate_array_h (a
)
265 type (*), dimension (..), contiguous :: a
269 interface acc_copyout
270 subroutine
acc_copyout_32_h (a
, len
)
271 use iso_c_binding
, only
: c_int32_t
272 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
273 type (*), dimension (*) :: a
274 integer (c_int32_t
) len
277 subroutine
acc_copyout_64_h (a
, len
)
278 use iso_c_binding
, only
: c_int64_t
279 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
280 type (*), dimension (*) :: a
281 integer (c_int64_t
) len
284 subroutine
acc_copyout_array_h (a
)
285 type (*), dimension (..), contiguous :: a
290 subroutine
acc_delete_32_h (a
, len
)
291 use iso_c_binding
, only
: c_int32_t
292 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
293 type (*), dimension (*) :: a
294 integer (c_int32_t
) len
297 subroutine
acc_delete_64_h (a
, len
)
298 use iso_c_binding
, only
: c_int64_t
299 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
300 type (*), dimension (*) :: a
301 integer (c_int64_t
) len
304 subroutine
acc_delete_array_h (a
)
305 type (*), dimension (..), contiguous :: a
309 interface acc_update_device
310 subroutine
acc_update_device_32_h (a
, len
)
311 use iso_c_binding
, only
: c_int32_t
312 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
313 type (*), dimension (*) :: a
314 integer (c_int32_t
) len
317 subroutine
acc_update_device_64_h (a
, len
)
318 use iso_c_binding
, only
: c_int64_t
319 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
320 type (*), dimension (*) :: a
321 integer (c_int64_t
) len
324 subroutine
acc_update_device_array_h (a
)
325 type (*), dimension (..), contiguous :: a
329 interface acc_update_self
330 subroutine
acc_update_self_32_h (a
, len
)
331 use iso_c_binding
, only
: c_int32_t
332 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
333 type (*), dimension (*) :: a
334 integer (c_int32_t
) len
337 subroutine
acc_update_self_64_h (a
, len
)
338 use iso_c_binding
, only
: c_int64_t
339 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
340 type (*), dimension (*) :: a
341 integer (c_int64_t
) len
344 subroutine
acc_update_self_array_h (a
)
345 type (*), dimension (..), contiguous :: a
349 ! acc_map_data
: Only available in C
/C
++
350 ! acc_unmap_data
: Only available in C
/C
++
351 ! acc_deviceptr
: Only available in C
/C
++
352 ! acc_ostptr
: Only available in C
/C
++
354 interface acc_is_present
355 function
acc_is_present_32_h (a
, len
)
356 use iso_c_binding
, only
: c_int32_t
357 logical acc_is_present_32_h
358 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
359 type (*), dimension (*) :: a
360 integer (c_int32_t
) len
363 function
acc_is_present_64_h (a
, len
)
364 use iso_c_binding
, only
: c_int64_t
365 logical acc_is_present_64_h
366 !GCC$ ATTRIBUTES
NO_ARG_CHECK :: a
367 type (*), dimension (*) :: a
368 integer (c_int64_t
) len
371 function
acc_is_present_array_h (a
)
372 logical acc_is_present_array_h
373 type (*), dimension (..), contiguous :: a
377 ! acc_memcpy_to_device
: Only available in C
/C
++
378 ! acc_memcpy_from_device
: Only available in C
/C
++