]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgomp/config/nvptx/openacc.f90
Update copyright years.
[thirdparty/gcc.git] / libgomp / config / nvptx / openacc.f90
CommitLineData
113020dc
TS
1! OpenACC Runtime Library Definitions.
2
a5544970 3! Copyright (C) 2014-2019 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
35module openacc_kinds
36 use iso_fortran_env, only: int32
37 implicit none
38
39 private :: int32
40 public :: acc_device_kind
41
42 integer, parameter :: acc_device_kind = int32
43
44 public :: acc_device_none, acc_device_default, acc_device_host
45 public :: acc_device_not_host, acc_device_nvidia
46
47 ! Keep in sync with include/gomp-constants.h.
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
54
55end module
56
57module openacc_internal
58 use openacc_kinds
59 implicit none
60
61 interface
62 function acc_on_device_h (d)
63 import
64 integer (acc_device_kind) d
65 logical acc_on_device_h
66 end function
67 end interface
68
69 interface
70 function acc_on_device_l (d) &
71 bind (C, name = "acc_on_device")
72 use iso_c_binding, only: c_int
73 integer (c_int) :: acc_on_device_l
74 integer (c_int), value :: d
75 end function
76 end interface
77end module
78
79module openacc
80 use openacc_kinds
81 use openacc_internal
82 implicit none
83
84 public :: acc_on_device
85
86 interface acc_on_device
87 procedure :: acc_on_device_h
88 end interface
89
90end module openacc
91
92function acc_on_device_h (d)
93 use openacc_internal, only: acc_on_device_l
94 use openacc_kinds
95 integer (acc_device_kind) d
96 logical acc_on_device_h
97 if (acc_on_device_l (d) .eq. 1) then
98 acc_on_device_h = .TRUE.
99 else
100 acc_on_device_h = .FALSE.
101 end if
102end function