Neko 1.99.3
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
device_inhom_dirichlet.F90
Go to the documentation of this file.
1! Copyright (c) 2021-2025, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
34 use num_types, only : rp, c_rp
35 use utils, only : neko_error
36 use, intrinsic :: iso_c_binding
37 implicit none
38
39#ifdef HAVE_HIP
40 interface
41 subroutine hip_inhom_dirichlet_apply_vector(msk, x, y, z, &
42 bla_x, bla_y, bla_z, m, strm) &
43 bind(c, name = 'hip_inhom_dirichlet_apply_vector')
44 use, intrinsic :: iso_c_binding
45 import c_rp
46 implicit none
47 integer(c_int) :: m
48 type(c_ptr), value :: msk, x, y, z, bla_x, bla_y, bla_z, strm
50 end interface
51#elif HAVE_CUDA
52 interface
53 subroutine cuda_inhom_dirichlet_apply_vector(msk, x, y, z, &
54 bla_x, bla_y, bla_z, m, strm) &
55 bind(c, name = 'cuda_inhom_dirichlet_apply_vector')
56 use, intrinsic :: iso_c_binding
57 import c_rp
58 implicit none
59 integer(c_int) :: m
60 type(c_ptr), value :: msk, x, y, z, bla_x, bla_y, bla_z, strm
62 end interface
63#elif HAVE_OPENCL
64 interface
65 subroutine opencl_inhom_dirichlet_apply_vector(msk, x, y, z, &
66 bla_x, bla_y, bla_z, m, strm) &
67 bind(c, name = 'opencl_inhom_dirichlet_apply_vector')
68 use, intrinsic :: iso_c_binding
69 import c_rp
70 implicit none
71 integer(c_int) :: m
72 type(c_ptr), value :: msk, x, y, z, bla_x, bla_y, bla_z, strm
74 end interface
75
76#elif HAVE_METAL
77 interface
78 subroutine metal_inhom_dirichlet_apply_vector(msk, x, y, z, &
79 bla_x, bla_y, bla_z, m, strm) &
80 bind(c, name = 'metal_inhom_dirichlet_apply_vector')
81 use, intrinsic :: iso_c_binding
82 import c_rp
83 implicit none
84 integer(c_int) :: m
85 type(c_ptr), value :: msk, x, y, z, bla_x, bla_y, bla_z, strm
86 end subroutine metal_inhom_dirichlet_apply_vector
87 end interface
88
89#endif
90
91#ifdef HAVE_HIP
92 interface
93 subroutine hip_inhom_dirichlet_apply_scalar(msk, x, bla_x, m, strm) &
94 bind(c, name = 'hip_inhom_dirichlet_apply_scalar')
95 use, intrinsic :: iso_c_binding
96 import c_rp
97 implicit none
98 integer(c_int) :: m
99 type(c_ptr), value :: msk, x, bla_x, strm
101 end interface
102#elif HAVE_CUDA
103 interface
104 subroutine cuda_inhom_dirichlet_apply_scalar(msk, x, bla_x, m, strm) &
105 bind(c, name = 'cuda_inhom_dirichlet_apply_scalar')
106 use, intrinsic :: iso_c_binding
107 import c_rp
108 implicit none
109 integer(c_int) :: m
110 type(c_ptr), value :: msk, x, bla_x, strm
112 end interface
113#elif HAVE_OPENCL
114 interface
115 subroutine opencl_inhom_dirichlet_apply_scalar(msk, x, bla_x, m, strm) &
116 bind(c, name = 'opencl_inhom_dirichlet_apply_scalar')
117 use, intrinsic :: iso_c_binding
118 import c_rp
119 implicit none
120 integer(c_int) :: m
121 type(c_ptr), value :: msk, x, bla_x, strm
123 end interface
124#elif HAVE_METAL
125 interface
126 subroutine metal_inhom_dirichlet_apply_scalar(msk, x, bla_x, m, strm) &
127 bind(c, name = 'metal_inhom_dirichlet_apply_scalar')
128 use, intrinsic :: iso_c_binding
129 import c_rp
130 implicit none
131 integer(c_int) :: m
132 type(c_ptr), value :: msk, x, bla_x, strm
133 end subroutine metal_inhom_dirichlet_apply_scalar
134 end interface
135#endif
136
137contains
138
139 subroutine device_inhom_dirichlet_apply_vector(msk, x, y, z, &
140 bla_x, bla_y, bla_z, m, strm)
141 integer, intent(in) :: m
142 type(c_ptr) :: msk, x, y, z, bla_x, bla_y, bla_z, strm
143
144 if (m .lt. 1) return
145#ifdef HAVE_HIP
146 call hip_inhom_dirichlet_apply_vector(msk, x, y, z, &
147 bla_x, bla_y, bla_z, m, strm)
148#elif HAVE_CUDA
149 call cuda_inhom_dirichlet_apply_vector(msk, x, y, z, &
150 bla_x, bla_y, bla_z, m, strm)
151#elif HAVE_OPENCL
152 call opencl_inhom_dirichlet_apply_vector(msk, x, y, z, &
153 bla_x, bla_y, bla_z, m, strm)
154#elif HAVE_METAL
155 call metal_inhom_dirichlet_apply_vector(msk, x, y, z, &
156 bla_x, bla_y, bla_z, m, strm)
157#else
158 call neko_error('No device backend configured')
159#endif
160
162
163 subroutine device_inhom_dirichlet_apply_scalar(msk, x, bla_x, m, strm)
164 integer, intent(in) :: m
165 type(c_ptr) :: msk, x, bla_x, strm
166
167 if (m .lt. 1) return
168#ifdef HAVE_HIP
169 call hip_inhom_dirichlet_apply_scalar(msk, x, bla_x, m, strm)
170#elif HAVE_CUDA
171 call cuda_inhom_dirichlet_apply_scalar(msk, x, bla_x, m, strm)
172#elif HAVE_OPENCL
173 call opencl_inhom_dirichlet_apply_scalar(msk, x, bla_x, m, strm)
174#elif HAVE_METAL
175 call metal_inhom_dirichlet_apply_scalar(msk, x, bla_x, m, strm)
176#else
177 call neko_error('No device backend configured')
178#endif
179
181
182end module device_inhom_dirichlet
void opencl_inhom_dirichlet_apply_scalar(void *msk, void *x, void *bla_x, int *m, cl_command_queue cmd_queue)
void opencl_inhom_dirichlet_apply_vector(void *msk, void *x, void *y, void *z, void *bla_x, void *bla_y, void *bla_z, int *m, cl_command_queue cmd_queue)
void cuda_inhom_dirichlet_apply_scalar(void *msk, void *x, void *bla_x, int *m, cudaStream_t strm)
void cuda_inhom_dirichlet_apply_vector(void *msk, void *x, void *y, void *z, void *bla_x, void *bla_y, void *bla_z, int *m, cudaStream_t strm)
subroutine device_inhom_dirichlet_apply_scalar(msk, x, bla_x, m, strm)
subroutine device_inhom_dirichlet_apply_vector(msk, x, y, z, bla_x, bla_y, bla_z, m, strm)
integer, parameter, public c_rp
Definition num_types.f90:13
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Utilities.
Definition utils.f90:35