]>
Commit | Line | Data |
---|---|---|
113020dc TS |
1 | ! OpenACC Runtime Library Definitions. |
2 | ||
83ffe9cd | 3 | ! Copyright (C) 2014-2023 Free Software Foundation, Inc. |
113020dc TS |
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 | ! Wrapper functions will be built from openacc.f90. We use a separate file | |
31 | ! here, because for using ../../openacc.f90, implementations are required for | |
32 | ! all the functions that it wraps, which we currently don't provide, so linking | |
33 | ! would fail. | |
34 | ||
35 | module openacc_kinds | |
36 | use iso_fortran_env, only: int32 | |
37 | implicit none | |
38 | ||
0b8499a4 | 39 | public |
113020dc | 40 | private :: int32 |
113020dc | 41 | |
0b8499a4 | 42 | ! When adding items, also update 'public' setting in 'module openacc' below. |
113020dc | 43 | |
0b8499a4 | 44 | integer, parameter :: acc_device_kind = int32 |
113020dc TS |
45 | |
46 | ! Keep in sync with include/gomp-constants.h. | |
a5d0bc12 | 47 | integer (acc_device_kind), parameter :: acc_device_current = -1 |
113020dc TS |
48 | integer (acc_device_kind), parameter :: acc_device_none = 0 |
49 | integer (acc_device_kind), parameter :: acc_device_default = 1 | |
50 | integer (acc_device_kind), parameter :: acc_device_host = 2 | |
51 | ! integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3 removed. | |
52 | integer (acc_device_kind), parameter :: acc_device_not_host = 4 | |
53 | integer (acc_device_kind), parameter :: acc_device_nvidia = 5 | |
6687d13a | 54 | integer (acc_device_kind), parameter :: acc_device_radeon = 8 |
113020dc | 55 | |
0b8499a4 | 56 | end module openacc_kinds |
113020dc TS |
57 | |
58 | module openacc_internal | |
59 | use openacc_kinds | |
60 | implicit none | |
61 | ||
62 | interface | |
8d1a1cb1 | 63 | function acc_on_device_h (devicetype) |
113020dc | 64 | import |
8d1a1cb1 | 65 | integer (acc_device_kind) devicetype |
113020dc TS |
66 | logical acc_on_device_h |
67 | end function | |
68 | end interface | |
69 | ||
70 | interface | |
8d1a1cb1 | 71 | function acc_on_device_l (devicetype) & |
113020dc TS |
72 | bind (C, name = "acc_on_device") |
73 | use iso_c_binding, only: c_int | |
74 | integer (c_int) :: acc_on_device_l | |
8d1a1cb1 | 75 | integer (c_int), value :: devicetype |
113020dc TS |
76 | end function |
77 | end interface | |
0b8499a4 | 78 | end module openacc_internal |
113020dc TS |
79 | |
80 | module openacc | |
81 | use openacc_kinds | |
82 | use openacc_internal | |
83 | implicit none | |
84 | ||
0b8499a4 TB |
85 | private |
86 | ||
87 | ! From openacc_kinds | |
88 | public :: acc_device_kind | |
89 | public :: acc_device_none, acc_device_default, acc_device_host | |
6687d13a | 90 | public :: acc_device_not_host, acc_device_nvidia, acc_device_radeon |
0b8499a4 | 91 | |
113020dc TS |
92 | public :: acc_on_device |
93 | ||
94 | interface acc_on_device | |
95 | procedure :: acc_on_device_h | |
96 | end interface | |
97 | ||
98 | end module openacc | |
99 | ||
8d1a1cb1 | 100 | function acc_on_device_h (devicetype) |
113020dc TS |
101 | use openacc_internal, only: acc_on_device_l |
102 | use openacc_kinds | |
8d1a1cb1 | 103 | integer (acc_device_kind) devicetype |
113020dc | 104 | logical acc_on_device_h |
8d1a1cb1 | 105 | acc_on_device_h = acc_on_device_l (devicetype) /= 0 |
113020dc | 106 | end function |