1 ! OpenACC Runtime Library Definitions. -*- mode: fortran -*- 2 3 ! Copyright (C) 2014-2015 Free Software Foundation, Inc. 4 5 ! Contributed by Tobias Burnus <burnus@net-b.de> 6 ! and Mentor Embedded. 7 8 ! This file is part of the GNU Offloading and Multi Processing Library 9 ! (libgomp). 10 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. 15 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. 20 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. 24 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/>. 29 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. 34 35 integer, parameter :: acc_device_kind = 4 36 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 44 45 integer, parameter :: acc_handle_kind = 4 46 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 50 51 integer, parameter :: openacc_version = 201306 52 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 58 end function 59 end interface 60 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 65 end subroutine 66 end interface 67 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 72 end function 73 end interface 74 75 interface acc_set_device_num 76 subroutine acc_set_device_num_h (n, d) 77 import acc_device_kind 78 integer n 79 integer (acc_device_kind) d 80 end subroutine 81 end interface 82 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 88 end function 89 end interface 90 91 interface acc_async_test 92 function acc_async_test_h (a) 93 logical acc_async_test_h 94 integer a 95 end function 96 end interface 97 98 interface acc_async_test_all 99 function acc_async_test_all_h () 100 logical acc_async_test_all_h 101 end function 102 end interface 103 104 interface acc_wait 105 subroutine acc_wait_h (a) 106 integer a 107 end subroutine 108 end interface 109 110 interface acc_wait_async 111 subroutine acc_wait_async_h (a1, a2) 112 integer a1, a2 113 end subroutine 114 end interface 115 116 interface acc_wait_all 117 subroutine acc_wait_all_h () 118 end subroutine 119 end interface 120 121 interface acc_wait_all_async 122 subroutine acc_wait_all_async_h (a) 123 integer a 124 end subroutine 125 end interface 126 127 interface acc_init 128 subroutine acc_init_h (devicetype) 129 import acc_device_kind 130 integer (acc_device_kind) devicetype 131 end subroutine 132 end interface 133 134 interface acc_shutdown 135 subroutine acc_shutdown_h (devicetype) 136 import acc_device_kind 137 integer (acc_device_kind) devicetype 138 end subroutine 139 end interface 140 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 146 end function 147 end interface 148 149 ! acc_malloc: Only available in C/C++ 150 ! acc_free: Only available in C/C++ 151 152 interface acc_copyin 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 158 end subroutine 159 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 165 end subroutine 166 167 subroutine acc_copyin_array_h (a) 168 type (*), dimension (..), contiguous :: a 169 end subroutine 170 end interface 171 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 178 end subroutine 179 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 185 end subroutine 186 187 subroutine acc_present_or_copyin_array_h (a) 188 type (*), dimension (..), contiguous :: a 189 end subroutine 190 end interface 191 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 198 end subroutine 199 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 205 end subroutine 206 207 subroutine acc_pcopyin_array_h (a) 208 type (*), dimension (..), contiguous :: a 209 end subroutine 210 end interface 211 212 interface acc_create 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 218 end subroutine 219 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 225 end subroutine 226 227 subroutine acc_create_array_h (a) 228 type (*), dimension (..), contiguous :: a 229 end subroutine 230 end interface 231 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 238 end subroutine 239 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 245 end subroutine 246 247 subroutine acc_present_or_create_array_h (a) 248 type (*), dimension (..), contiguous :: a 249 end subroutine 250 end interface 251 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 258 end subroutine 259 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 265 end subroutine 266 267 subroutine acc_pcreate_array_h (a) 268 type (*), dimension (..), contiguous :: a 269 end subroutine 270 end interface 271 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 278 end subroutine 279 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 285 end subroutine 286 287 subroutine acc_copyout_array_h (a) 288 type (*), dimension (..), contiguous :: a 289 end subroutine 290 end interface 291 292 interface acc_delete 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 298 end subroutine 299 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 305 end subroutine 306 307 subroutine acc_delete_array_h (a) 308 type (*), dimension (..), contiguous :: a 309 end subroutine 310 end interface 311 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 318 end subroutine 319 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 325 end subroutine 326 327 subroutine acc_update_device_array_h (a) 328 type (*), dimension (..), contiguous :: a 329 end subroutine 330 end interface 331 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 338 end subroutine 339 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 345 end subroutine 346 347 subroutine acc_update_self_array_h (a) 348 type (*), dimension (..), contiguous :: a 349 end subroutine 350 end interface 351 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++ 356 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 364 end function 365 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 372 end function 373 374 function acc_is_present_array_h (a) 375 logical acc_is_present_array_h 376 type (*), dimension (..), contiguous :: a 377 end function 378 end interface 379 380 ! acc_memcpy_to_device: Only available in C/C++ 381 ! acc_memcpy_from_device: Only available in C/C++ 382