* builtins.def (BUILT_IN_SETJMP): Revert latest change.
[official-gcc.git] / libgomp / openacc_lib.h
blob289b5512bcc60978ff7c447de855d2b0703e52a1
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>
6 ! and Mentor Embedded.
8 ! This file is part of the GNU Offloading and Multi Processing Library
9 ! (libgomp).
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.
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.
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 ! removed.
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
59 end function
60 end interface
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
66 end subroutine
67 end interface
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
73 end function
74 end interface
76 interface acc_set_device_num
77 subroutine acc_set_device_num_h (n, d)
78 import acc_device_kind
79 integer n
80 integer (acc_device_kind) d
81 end subroutine
82 end interface
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
89 end function
90 end interface
92 interface acc_async_test
93 function acc_async_test_h (a)
94 logical acc_async_test_h
95 integer a
96 end function
97 end interface
99 interface acc_async_test_all
100 function acc_async_test_all_h ()
101 logical acc_async_test_all_h
102 end function
103 end interface
105 interface acc_wait
106 subroutine acc_wait_h (a)
107 integer a
108 end subroutine
109 end interface
111 ! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait.
112 interface acc_async_wait
113 procedure :: acc_wait_h
114 end interface
116 interface acc_wait_async
117 subroutine acc_wait_async_h (a1, a2)
118 integer a1, a2
119 end subroutine
120 end interface
122 interface acc_wait_all
123 subroutine acc_wait_all_h ()
124 end subroutine
125 end interface
127 ! acc_async_wait_all is an OpenACC 1.0 compatibility name for
128 ! acc_wait_all.
129 interface acc_async_wait_all
130 procedure :: acc_wait_all_h
131 end interface
133 interface acc_wait_all_async
134 subroutine acc_wait_all_async_h (a)
135 integer a
136 end subroutine
137 end interface
139 interface acc_init
140 subroutine acc_init_h (devicetype)
141 import acc_device_kind
142 integer (acc_device_kind) devicetype
143 end subroutine
144 end interface
146 interface acc_shutdown
147 subroutine acc_shutdown_h (devicetype)
148 import acc_device_kind
149 integer (acc_device_kind) devicetype
150 end subroutine
151 end interface
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
158 end function
159 end interface
161 ! acc_malloc: Only available in C/C++
162 ! acc_free: Only available in C/C++
164 interface acc_copyin
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
170 end subroutine
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
177 end subroutine
179 subroutine acc_copyin_array_h (a)
180 type (*), dimension (..), contiguous :: a
181 end subroutine
182 end interface
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
190 end subroutine
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
197 end subroutine
199 subroutine acc_present_or_copyin_array_h (a)
200 type (*), dimension (..), contiguous :: a
201 end subroutine
202 end interface
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
208 end interface
210 interface acc_create
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
216 end subroutine
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
223 end subroutine
225 subroutine acc_create_array_h (a)
226 type (*), dimension (..), contiguous :: a
227 end subroutine
228 end interface
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
236 end subroutine
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
243 end subroutine
245 subroutine acc_present_or_create_array_h (a)
246 type (*), dimension (..), contiguous :: a
247 end subroutine
248 end interface
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
254 end interface
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
262 end subroutine
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
269 end subroutine
271 subroutine acc_copyout_array_h (a)
272 type (*), dimension (..), contiguous :: a
273 end subroutine
274 end interface
276 interface acc_delete
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
282 end subroutine
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
289 end subroutine
291 subroutine acc_delete_array_h (a)
292 type (*), dimension (..), contiguous :: a
293 end subroutine
294 end interface
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
302 end subroutine
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
309 end subroutine
311 subroutine acc_update_device_array_h (a)
312 type (*), dimension (..), contiguous :: a
313 end subroutine
314 end interface
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
322 end subroutine
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
329 end subroutine
331 subroutine acc_update_self_array_h (a)
332 type (*), dimension (..), contiguous :: a
333 end subroutine
334 end interface
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
348 end function
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
356 end function
358 function acc_is_present_array_h (a)
359 logical acc_is_present_array_h
360 type (*), dimension (..), contiguous :: a
361 end function
362 end interface
364 ! acc_memcpy_to_device: Only available in C/C++
365 ! acc_memcpy_from_device: Only available in C/C++