svn merge -r 217500:218679 svn+ssh://gcc.gnu.org/svn/gcc/trunk
[official-gcc.git] / libgomp / openacc_lib.h
blob4e335f2c8b0e58fddf9d5eea5939f0925e5ea2ce
1 ! OpenACC Runtime Library Definitions. -*- mode: fortran -*-
3 ! Copyright (C) 2014 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 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)
13 ! any later version.
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
18 ! more details.
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
55 end function
56 end interface
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
62 end subroutine
63 end interface
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
69 end function
70 end interface
72 interface acc_set_device_num
73 subroutine acc_set_device_num_h (n, d)
74 import acc_device_kind
75 integer n
76 integer (acc_device_kind) d
77 end subroutine
78 end interface
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
85 end function
86 end interface
88 interface acc_async_test
89 function acc_async_test_h (a)
90 logical acc_async_test_h
91 integer a
92 end function
93 end interface
95 interface acc_async_test_all
96 function acc_async_test_all_h ()
97 logical acc_async_test_all_h
98 end function
99 end interface
101 interface acc_wait
102 subroutine acc_wait_h (a)
103 integer a
104 end subroutine
105 end interface
107 interface acc_wait_async
108 subroutine acc_wait_async_h (a1, a2)
109 integer a1, a2
110 end subroutine
111 end interface
113 interface acc_wait_all
114 subroutine acc_wait_all_h ()
115 end subroutine
116 end interface
118 interface acc_wait_all_async
119 subroutine acc_wait_all_async_h (a)
120 integer a
121 end subroutine
122 end interface
124 interface acc_init
125 subroutine acc_init_h (devicetype)
126 import acc_device_kind
127 integer (acc_device_kind) devicetype
128 end subroutine
129 end interface
131 interface acc_shutdown
132 subroutine acc_shutdown_h (devicetype)
133 import acc_device_kind
134 integer (acc_device_kind) devicetype
135 end subroutine
136 end interface
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
143 end function
144 end interface
146 ! acc_malloc: Only available in C/C++
147 ! acc_free: Only available in C/C++
149 interface acc_copyin
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
155 end subroutine
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
162 end subroutine
164 subroutine acc_copyin_array_h (a)
165 type (*), dimension (..), contiguous :: a
166 end subroutine
167 end interface
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
175 end subroutine
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
182 end subroutine
184 subroutine acc_present_or_copyin_array_h (a)
185 type (*), dimension (..), contiguous :: a
186 end subroutine
187 end interface
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
195 end subroutine
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
202 end subroutine
204 subroutine acc_pcopyin_array_h (a)
205 type (*), dimension (..), contiguous :: a
206 end subroutine
207 end interface
209 interface acc_create
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
215 end subroutine
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
222 end subroutine
224 subroutine acc_create_array_h (a)
225 type (*), dimension (..), contiguous :: a
226 end subroutine
227 end interface
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
235 end subroutine
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
242 end subroutine
244 subroutine acc_present_or_create_array_h (a)
245 type (*), dimension (..), contiguous :: a
246 end subroutine
247 end interface
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
255 end subroutine
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
262 end subroutine
264 subroutine acc_pcreate_array_h (a)
265 type (*), dimension (..), contiguous :: a
266 end subroutine
267 end interface
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
275 end subroutine
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
282 end subroutine
284 subroutine acc_copyout_array_h (a)
285 type (*), dimension (..), contiguous :: a
286 end subroutine
287 end interface
289 interface acc_delete
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
295 end subroutine
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
302 end subroutine
304 subroutine acc_delete_array_h (a)
305 type (*), dimension (..), contiguous :: a
306 end subroutine
307 end interface
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
315 end subroutine
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
322 end subroutine
324 subroutine acc_update_device_array_h (a)
325 type (*), dimension (..), contiguous :: a
326 end subroutine
327 end interface
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
335 end subroutine
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
342 end subroutine
344 subroutine acc_update_self_array_h (a)
345 type (*), dimension (..), contiguous :: a
346 end subroutine
347 end interface
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
361 end function
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
369 end function
371 function acc_is_present_array_h (a)
372 logical acc_is_present_array_h
373 type (*), dimension (..), contiguous :: a
374 end function
375 end interface
377 ! acc_memcpy_to_device: Only available in C/C++
378 ! acc_memcpy_from_device: Only available in C/C++