123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607 |
- ! OpenACC Runtime Library Definitions. -*- mode: fortran -*-
- ! Copyright (C) 2014-2022 Free Software Foundation, Inc.
- ! Contributed by Tobias Burnus <burnus@net-b.de>
- ! and Mentor Embedded.
- ! This file is part of the GNU Offloading and Multi Processing Library
- ! (libgomp).
- ! Libgomp is free software; you can redistribute it and/or modify it
- ! under the terms of the GNU General Public License as published by
- ! the Free Software Foundation; either version 3, or (at your option)
- ! any later version.
- ! Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- ! FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- ! more details.
- ! Under Section 7 of GPL version 3, you are granted additional
- ! permissions described in the GCC Runtime Library Exception, version
- ! 3.1, as published by the Free Software Foundation.
- ! You should have received a copy of the GNU General Public License and
- ! a copy of the GCC Runtime Library Exception along with this program;
- ! see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- ! <http://www.gnu.org/licenses/>.
- ! NOTE: Due to the use of dimension (..), the code only works when compiled
- ! with -std=f2008ts/gnu/legacy but not with other standard settings.
- ! Alternatively, the user can use the module version, which permits
- ! compilation with -std=f95.
- ! Keep in sync with openacc.f90 and config/accel/openacc.f90.
- integer, parameter :: acc_device_kind = 4
- ! Keep in sync with include/gomp-constants.h.
- integer (acc_device_kind), parameter :: acc_device_current = -1
- integer (acc_device_kind), parameter :: acc_device_none = 0
- integer (acc_device_kind), parameter :: acc_device_default = 1
- integer (acc_device_kind), parameter :: acc_device_host = 2
- ! integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3
- ! removed.
- integer (acc_device_kind), parameter :: acc_device_not_host = 4
- integer (acc_device_kind), parameter :: acc_device_nvidia = 5
- integer (acc_device_kind), parameter :: acc_device_radeon = 8
- integer, parameter :: acc_device_property_kind = 4
- ! OpenACC 2.6/2.7/3.0 used acc_device_property; in a spec update the
- ! missing '_kind' was added for consistency. For backward compatibility, keep:
- integer, parameter :: acc_device_property &
- & = acc_device_property_kind
- integer (acc_device_property_kind), parameter :: &
- & acc_property_memory = 1
- integer (acc_device_property_kind), parameter :: &
- & acc_property_free_memory = 2
- integer (acc_device_property_kind), parameter :: &
- & acc_property_name = int(Z'10001')
- integer (acc_device_property_kind), parameter :: &
- & acc_property_vendor = int(Z'10002')
- integer (acc_device_property_kind), parameter :: &
- & acc_property_driver = int(Z'10003')
- integer, parameter :: acc_handle_kind = 4
- ! Keep in sync with include/gomp-constants.h.
- integer (acc_handle_kind), parameter :: acc_async_noval = -1
- integer (acc_handle_kind), parameter :: acc_async_sync = -2
- integer, parameter :: openacc_version = 201711
- interface acc_get_num_devices
- function acc_get_num_devices_h (devicetype)
- import acc_device_kind
- integer acc_get_num_devices_h
- integer (acc_device_kind) devicetype
- end function
- end interface
- interface acc_set_device_type
- subroutine acc_set_device_type_h (devicetype)
- import acc_device_kind
- integer (acc_device_kind) devicetype
- end subroutine
- end interface
- interface acc_get_device_type
- function acc_get_device_type_h ()
- import acc_device_kind
- integer (acc_device_kind) acc_get_device_type_h
- end function
- end interface
- interface acc_set_device_num
- subroutine acc_set_device_num_h (devicenum, devicetype)
- import acc_device_kind
- integer devicenum
- integer (acc_device_kind) devicetype
- end subroutine
- end interface
- interface acc_get_device_num
- function acc_get_device_num_h (devicetype)
- import acc_device_kind
- integer acc_get_device_num_h
- integer (acc_device_kind) devicetype
- end function
- end interface
- interface acc_get_property
- function acc_get_property_h (devicenum, devicetype, &
- & property)
- use iso_c_binding, only: c_size_t
- import acc_device_kind, acc_device_property_kind
- implicit none (type, external)
- integer (c_size_t) :: acc_get_property_h
- integer, value :: devicenum
- integer (acc_device_kind), value :: devicetype
- integer (acc_device_property_kind), value :: property
- end function
- end interface
- interface acc_get_property_string
- subroutine acc_get_property_string_h (devicenum, devicetype, &
- & property, string)
- import acc_device_kind, acc_device_property_kind
- implicit none (type, external)
- integer, value :: devicenum
- integer (acc_device_kind), value :: devicetype
- integer (acc_device_property_kind), value :: property
- character (*) :: string
- end subroutine
- end interface
- interface acc_async_test
- function acc_async_test_h (arg)
- logical acc_async_test_h
- integer arg
- end function
- end interface
- interface acc_async_test_all
- function acc_async_test_all_h ()
- logical acc_async_test_all_h
- end function
- end interface
- interface acc_wait
- subroutine acc_wait_h (arg)
- integer arg
- end subroutine
- end interface
- ! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait.
- interface acc_async_wait
- procedure :: acc_wait_h
- end interface
- interface acc_wait_async
- subroutine acc_wait_async_h (arg, async)
- integer arg, async
- end subroutine
- end interface
- interface acc_wait_all
- subroutine acc_wait_all_h ()
- end subroutine
- end interface
- ! acc_async_wait_all is an OpenACC 1.0 compatibility name for
- ! acc_wait_all.
- interface acc_async_wait_all
- procedure :: acc_wait_all_h
- end interface
- interface acc_wait_all_async
- subroutine acc_wait_all_async_h (async)
- integer async
- end subroutine
- end interface
- interface acc_init
- subroutine acc_init_h (devicetype)
- import acc_device_kind
- integer (acc_device_kind) devicetype
- end subroutine
- end interface
- interface acc_shutdown
- subroutine acc_shutdown_h (devicetype)
- import acc_device_kind
- integer (acc_device_kind) devicetype
- end subroutine
- end interface
- interface acc_on_device
- function acc_on_device_h (devicetype)
- import acc_device_kind
- logical acc_on_device_h
- integer (acc_device_kind) devicetype
- end function
- end interface
- ! acc_malloc: Only available in C/C++
- ! acc_free: Only available in C/C++
- interface acc_copyin
- subroutine acc_copyin_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end subroutine
- subroutine acc_copyin_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end subroutine
- subroutine acc_copyin_array_h (a)
- type (*), dimension (..), contiguous :: a
- end subroutine
- end interface
- interface acc_present_or_copyin
- subroutine acc_present_or_copyin_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end subroutine
- subroutine acc_present_or_copyin_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end subroutine
- subroutine acc_present_or_copyin_array_h (a)
- type (*), dimension (..), contiguous :: a
- end subroutine
- end interface
- interface acc_pcopyin
- procedure :: acc_present_or_copyin_32_h
- procedure :: acc_present_or_copyin_64_h
- procedure :: acc_present_or_copyin_array_h
- end interface
- interface acc_create
- subroutine acc_create_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end subroutine
- subroutine acc_create_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end subroutine
- subroutine acc_create_array_h (a)
- type (*), dimension (..), contiguous :: a
- end subroutine
- end interface
- interface acc_present_or_create
- subroutine acc_present_or_create_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end subroutine
- subroutine acc_present_or_create_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end subroutine
- subroutine acc_present_or_create_array_h (a)
- type (*), dimension (..), contiguous :: a
- end subroutine
- end interface
- interface acc_pcreate
- procedure :: acc_present_or_create_32_h
- procedure :: acc_present_or_create_64_h
- procedure :: acc_present_or_create_array_h
- end interface
- interface acc_copyout
- subroutine acc_copyout_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end subroutine
- subroutine acc_copyout_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end subroutine
- subroutine acc_copyout_array_h (a)
- type (*), dimension (..), contiguous :: a
- end subroutine
- end interface
- interface acc_copyout_finalize
- subroutine acc_copyout_finalize_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end subroutine
- subroutine acc_copyout_finalize_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end subroutine
- subroutine acc_copyout_finalize_array_h (a)
- type (*), dimension (..), contiguous :: a
- end subroutine
- end interface
- interface acc_delete
- subroutine acc_delete_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end subroutine
- subroutine acc_delete_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end subroutine
- subroutine acc_delete_array_h (a)
- type (*), dimension (..), contiguous :: a
- end subroutine
- end interface
- interface acc_delete_finalize
- subroutine acc_delete_finalize_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end subroutine
- subroutine acc_delete_finalize_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end subroutine
- subroutine acc_delete_finalize_array_h (a)
- type (*), dimension (..), contiguous :: a
- end subroutine
- end interface
- interface acc_update_device
- subroutine acc_update_device_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end subroutine
- subroutine acc_update_device_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end subroutine
- subroutine acc_update_device_array_h (a)
- type (*), dimension (..), contiguous :: a
- end subroutine
- end interface
- interface acc_update_self
- subroutine acc_update_self_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end subroutine
- subroutine acc_update_self_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end subroutine
- subroutine acc_update_self_array_h (a)
- type (*), dimension (..), contiguous :: a
- end subroutine
- end interface
- ! acc_map_data: Only available in C/C++
- ! acc_unmap_data: Only available in C/C++
- ! acc_deviceptr: Only available in C/C++
- ! acc_hostptr: Only available in C/C++
- interface acc_is_present
- function acc_is_present_32_h (a, len)
- use iso_c_binding, only: c_int32_t
- logical acc_is_present_32_h
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- end function
- function acc_is_present_64_h (a, len)
- use iso_c_binding, only: c_int64_t
- logical acc_is_present_64_h
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- end function
- function acc_is_present_array_h (a)
- logical acc_is_present_array_h
- type (*), dimension (..), contiguous :: a
- end function
- end interface
- ! acc_memcpy_to_device: Only available in C/C++
- ! acc_memcpy_from_device: Only available in C/C++
- interface acc_copyin_async
- subroutine acc_copyin_async_32_h (a, len, async)
- use iso_c_binding, only: c_int32_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_copyin_async_64_h (a, len, async)
- use iso_c_binding, only: c_int64_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_copyin_async_array_h (a, async_)
- import acc_handle_kind
- type (*), dimension (..), contiguous :: a
- integer (acc_handle_kind) async_
- end subroutine
- end interface
- interface acc_create_async
- subroutine acc_create_async_32_h (a, len, async)
- use iso_c_binding, only: c_int32_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_create_async_64_h (a, len, async)
- use iso_c_binding, only: c_int64_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_create_async_array_h (a, async_)
- import acc_handle_kind
- type (*), dimension (..), contiguous :: a
- integer (acc_handle_kind) async_
- end subroutine
- end interface
- interface acc_copyout_async
- subroutine acc_copyout_async_32_h (a, len, async)
- use iso_c_binding, only: c_int32_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_copyout_async_64_h (a, len, async)
- use iso_c_binding, only: c_int64_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_copyout_async_array_h (a, async_)
- import acc_handle_kind
- type (*), dimension (..), contiguous :: a
- integer (acc_handle_kind) async_
- end subroutine
- end interface
- interface acc_delete_async
- subroutine acc_delete_async_32_h (a, len, async)
- use iso_c_binding, only: c_int32_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_delete_async_64_h (a, len, async)
- use iso_c_binding, only: c_int64_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_delete_async_array_h (a, async_)
- import acc_handle_kind
- type (*), dimension (..), contiguous :: a
- integer (acc_handle_kind) async_
- end subroutine
- end interface
- interface acc_update_device_async
- subroutine acc_update_device_async_32_h (a, len, async)
- use iso_c_binding, only: c_int32_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_update_device_async_64_h (a, len, async)
- use iso_c_binding, only: c_int64_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_update_device_async_array_h (a, async_)
- import acc_handle_kind
- type (*), dimension (..), contiguous :: a
- integer (acc_handle_kind) async_
- end subroutine
- end interface
- interface acc_update_self_async
- subroutine acc_update_self_async_32_h (a, len, async)
- use iso_c_binding, only: c_int32_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int32_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_update_self_async_64_h (a, len, async)
- use iso_c_binding, only: c_int64_t
- import acc_handle_kind
- !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
- type (*), dimension (*) :: a
- integer (c_int64_t) len
- integer (acc_handle_kind) async
- end subroutine
- subroutine acc_update_self_async_array_h (a, async_)
- import acc_handle_kind
- type (*), dimension (..), contiguous :: a
- integer (acc_handle_kind) async_
- end subroutine
- end interface
|