Loading [MathJax]/extensions/tex2jax.js
Neko 0.9.99
A portable framework for high-order spectral element flow simulations
All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Pages
device_dynamic_smagorinsky_nut.F90
Go to the documentation of this file.
1! Copyright (c) 2024, 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, intrinsic :: iso_c_binding, only: c_ptr, c_int
35 use num_types, only: rp, c_rp
36 use utils, only: neko_error
38 use mpi_f08, only: mpi_sum, mpi_in_place, mpi_allreduce
39
40 implicit none
41 private
42
43#ifdef HAVE_HIP
44 interface
45 subroutine hip_s_abs_compute(s_abs_d, s11_d, s22_d, s33_d, &
46 s12_d, s13_d, s23_d, &
47 n) &
48 bind(c, name = 'hip_s_abs_compute')
49 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
50 import c_rp
51 type(c_ptr), value :: s_abs_d, s11_d, s22_d, s33_d, &
52 s12_d, s13_d, s23_d
53 integer(c_int) :: n
54 end subroutine hip_s_abs_compute
55 end interface
56 interface
57 subroutine hip_lij_compute_part1(l11_d, l22_d, l33_d, &
58 l12_d, l13_d, l23_d, &
59 u_d, v_d, w_d, &
60 fu_d, fv_d, fw_d, &
61 fuu_d, fvv_d, fww_d, &
62 fuv_d, fuw_d, fvw_d, n) &
63 bind(c, name = 'hip_lij_compute_part1')
64 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
65 import c_rp
66 type(c_ptr), value :: l11_d, l22_d, l33_d, l12_d, l13_d, l23_d, &
67 u_d, v_d, w_d, fu_d, fv_d, fw_d, &
68 fuu_d, fvv_d, fww_d, fuv_d, fuw_d, fvw_d
69 integer(c_int) :: n
70 end subroutine hip_lij_compute_part1
71 end interface
72 interface
73 subroutine hip_lij_compute_part2(l11_d, l22_d, l33_d, &
74 l12_d, l13_d, l23_d, &
75 fuu_d, fvv_d, fww_d, &
76 fuv_d, fuw_d, fvw_d, n) &
77 bind(c, name = 'hip_lij_compute_part2')
78 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
79 import c_rp
80 type(c_ptr), value :: l11_d, l22_d, l33_d, l12_d, l13_d, l23_d, &
81 fuu_d, fvv_d, fww_d, fuv_d, fuw_d, fvw_d
82 integer(c_int) :: n
83 end subroutine hip_lij_compute_part2
84 end interface
85 interface
86 subroutine hip_mij_compute_part1(m11_d, m22_d, m33_d, &
87 m12_d, m13_d, m23_d, &
88 s_abs_d, s11_d, s22_d, s33_d, &
89 s12_d, s13_d, s23_d, &
90 fs_abs_d, fs11_d, fs22_d, fs33_d, &
91 fs12_d, fs13_d, fs23_d, &
92 fsabss11_d, fsabss22_d, fsabss33_d, &
93 fsabss12_d, fsabss13_d, fsabss23_d, &
94 delta_ratio2, n) &
95 bind(c, name = 'hip_mij_compute_part1')
96 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
97 import c_rp
98 type(c_ptr), value :: m11_d, m22_d, m33_d, &
99 m12_d, m13_d, m23_d, &
100 s_abs_d, s11_d, s22_d, s33_d, &
101 s12_d, s13_d, s23_d, &
102 fs_abs_d, fs11_d, fs22_d, fs33_d, &
103 fs12_d, fs13_d, fs23_d, &
104 fsabss11_d, fsabss22_d, fsabss33_d, &
105 fsabss12_d, fsabss13_d, fsabss23_d
106 real(c_rp) :: delta_ratio2
107 integer(c_int) :: n
108 end subroutine hip_mij_compute_part1
109 end interface
110 interface
111 subroutine hip_mij_nut_compute_part2(m11_d, m22_d, m33_d, &
112 m12_d, m13_d, m23_d, &
113 l11_d, l22_d, l33_d, &
114 l12_d, l13_d, l23_d, &
115 fsabss11_d, fsabss22_d, fsabss33_d, &
116 fsabss12_d, fsabss13_d, fsabss23_d, &
117 num_d, den_d, c_dyn_d, delta_d, &
118 s_abs_d, nut_d, alpha, mult_d, n) &
119 bind(c, name = 'hip_mij_nut_compute_part2')
120 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
121 import c_rp
122 type(c_ptr), value :: m11_d, m22_d, m33_d, &
123 m12_d, m13_d, m23_d, &
124 l11_d, l22_d, l33_d, &
125 l12_d, l13_d, l23_d, &
126 fsabss11_d, fsabss22_d, fsabss33_d, &
127 fsabss12_d, fsabss13_d, fsabss23_d, &
128 num_d, den_d, c_dyn_d, delta_d, s_abs_d, nut_d, mult_d
129 real(c_rp) :: alpha
130 integer(c_int) :: n
131 end subroutine hip_mij_nut_compute_part2
132 end interface
133#elif HAVE_CUDA
134 interface
135 subroutine cuda_s_abs_compute(s_abs_d, s11_d, s22_d, s33_d, &
136 s12_d, s13_d, s23_d, &
137 n) &
138 bind(c, name = 'cuda_s_abs_compute')
139 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
140 import c_rp
141 type(c_ptr), value :: s_abs_d, s11_d, s22_d, s33_d, &
142 s12_d, s13_d, s23_d
143 integer(c_int) :: n
144 end subroutine cuda_s_abs_compute
145 end interface
146 interface
147 subroutine cuda_lij_compute_part1(l11_d, l22_d, l33_d, &
148 l12_d, l13_d, l23_d, &
149 u_d, v_d, w_d, &
150 fu_d, fv_d, fw_d, &
151 fuu_d, fvv_d, fww_d, &
152 fuv_d, fuw_d, fvw_d, n) &
153 bind(c, name = 'cuda_lij_compute_part1')
154 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
155 import c_rp
156 type(c_ptr), value :: l11_d, l22_d, l33_d, l12_d, l13_d, l23_d, &
157 u_d, v_d, w_d, fu_d, fv_d, fw_d, &
158 fuu_d, fvv_d, fww_d, fuv_d, fuw_d, fvw_d
159 integer(c_int) :: n
160 end subroutine cuda_lij_compute_part1
161 end interface
162 interface
163 subroutine cuda_lij_compute_part2(l11_d, l22_d, l33_d, &
164 l12_d, l13_d, l23_d, &
165 fuu_d, fvv_d, fww_d, &
166 fuv_d, fuw_d, fvw_d, n) &
167 bind(c, name = 'cuda_lij_compute_part2')
168 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
169 import c_rp
170 type(c_ptr), value :: l11_d, l22_d, l33_d, l12_d, l13_d, l23_d, &
171 fuu_d, fvv_d, fww_d, fuv_d, fuw_d, fvw_d
172 integer(c_int) :: n
173 end subroutine cuda_lij_compute_part2
174 end interface
175 interface
176 subroutine cuda_mij_compute_part1(m11_d, m22_d, m33_d, &
177 m12_d, m13_d, m23_d, &
178 s_abs_d, s11_d, s22_d, s33_d, &
179 s12_d, s13_d, s23_d, &
180 fs_abs_d, fs11_d, fs22_d, fs33_d, &
181 fs12_d, fs13_d, fs23_d, &
182 fsabss11_d, fsabss22_d, fsabss33_d, &
183 fsabss12_d, fsabss13_d, fsabss23_d, &
184 delta_ratio2, n) &
185 bind(c, name = 'cuda_mij_compute_part1')
186 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
187 import c_rp
188 type(c_ptr), value :: m11_d, m22_d, m33_d, &
189 m12_d, m13_d, m23_d, &
190 s_abs_d, s11_d, s22_d, s33_d, &
191 s12_d, s13_d, s23_d, &
192 fs_abs_d, fs11_d, fs22_d, fs33_d, &
193 fs12_d, fs13_d, fs23_d, &
194 fsabss11_d, fsabss22_d, fsabss33_d, &
195 fsabss12_d, fsabss13_d, fsabss23_d
196 real(c_rp) :: delta_ratio2
197 integer(c_int) :: n
198 end subroutine cuda_mij_compute_part1
199 end interface
200 interface
201 subroutine cuda_mij_nut_compute_part2(m11_d, m22_d, m33_d, &
202 m12_d, m13_d, m23_d, &
203 l11_d, l22_d, l33_d, &
204 l12_d, l13_d, l23_d, &
205 fsabss11_d, fsabss22_d, fsabss33_d, &
206 fsabss12_d, fsabss13_d, fsabss23_d, &
207 num_d, den_d, c_dyn_d, delta_d, &
208 s_abs_d, nut_d, alpha, mult_d, n) &
209 bind(c, name = 'cuda_mij_nut_compute_part2')
210 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
211 import c_rp
212 type(c_ptr), value :: m11_d, m22_d, m33_d, &
213 m12_d, m13_d, m23_d, &
214 l11_d, l22_d, l33_d, &
215 l12_d, l13_d, l23_d, &
216 fsabss11_d, fsabss22_d, fsabss33_d, &
217 fsabss12_d, fsabss13_d, fsabss23_d, &
218 num_d, den_d, c_dyn_d, delta_d, s_abs_d, nut_d, mult_d
219 real(c_rp) :: alpha
220 integer(c_int) :: n
221 end subroutine cuda_mij_nut_compute_part2
222 end interface
223#elif HAVE_OPENCL
224#endif
225
229contains
230
232 subroutine device_s_abs_compute(s_abs_d, s11_d, s22_d, s33_d, &
233 s12_d, s13_d, s23_d, &
234 n)
235 type(c_ptr) :: s_abs_d, s11_d, s22_d, s33_d, &
236 s12_d, s13_d, s23_d
237 integer :: n
238#if HAVE_HIP
239 call hip_s_abs_compute(s_abs_d, s11_d, s22_d, s33_d, &
240 s12_d, s13_d, s23_d, &
241 n)
242#elif HAVE_CUDA
243 call cuda_s_abs_compute(s_abs_d, s11_d, s22_d, s33_d, &
244 s12_d, s13_d, s23_d, &
245 n)
246#elif HAVE_OPENCL
247 call neko_error('opencl backend is not supported for device_s_abs_compute')
248#else
249 call neko_error('no device backend configured')
250#endif
251 end subroutine device_s_abs_compute
252
254 subroutine device_lij_compute_part1(l11_d, l22_d, l33_d, &
255 l12_d, l13_d, l23_d, &
256 u_d, v_d, w_d, &
257 fu_d, fv_d, fw_d, &
258 fuu_d, fvv_d, fww_d, &
259 fuv_d, fuw_d, fvw_d, n)
260 type(c_ptr) :: l11_d, l22_d, l33_d, l12_d, l13_d, l23_d, &
261 u_d, v_d, w_d, fu_d, fv_d, fw_d, &
262 fuu_d, fvv_d, fww_d, fuv_d, fuw_d, fvw_d
263 integer :: n
264#if HAVE_HIP
265 call hip_lij_compute_part1(l11_d, l22_d, l33_d, &
266 l12_d, l13_d, l23_d, &
267 u_d, v_d, w_d, &
268 fu_d, fv_d, fw_d, &
269 fuu_d, fvv_d, fww_d, &
270 fuv_d, fuw_d, fvw_d, n)
271#elif HAVE_CUDA
272 call cuda_lij_compute_part1(l11_d, l22_d, l33_d, &
273 l12_d, l13_d, l23_d, &
274 u_d, v_d, w_d, &
275 fu_d, fv_d, fw_d, &
276 fuu_d, fvv_d, fww_d, &
277 fuv_d, fuw_d, fvw_d, n)
278#elif HAVE_OPENCL
279 call neko_error('opencl backend is not supported &
280 &for device_lij_compute_part1')
281#else
282 call neko_error('no device backend configured')
283#endif
284 end subroutine device_lij_compute_part1
285
287 subroutine device_lij_compute_part2(l11_d, l22_d, l33_d, &
288 l12_d, l13_d, l23_d, &
289 fuu_d, fvv_d, fww_d, &
290 fuv_d, fuw_d, fvw_d, n)
291 type(c_ptr) :: l11_d, l22_d, l33_d, l12_d, l13_d, l23_d, &
292 fuu_d, fvv_d, fww_d, fuv_d, fuw_d, fvw_d
293 integer :: n
294#if HAVE_HIP
295 call hip_lij_compute_part2(l11_d, l22_d, l33_d, &
296 l12_d, l13_d, l23_d, &
297 fuu_d, fvv_d, fww_d, &
298 fuv_d, fuw_d, fvw_d, n)
299#elif HAVE_CUDA
300 call cuda_lij_compute_part2(l11_d, l22_d, l33_d, &
301 l12_d, l13_d, l23_d, &
302 fuu_d, fvv_d, fww_d, &
303 fuv_d, fuw_d, fvw_d, n)
304#elif HAVE_OPENCL
305 call neko_error('opencl backend is not supported &
306 &for device_lij_compute_part2')
307#else
308 call neko_error('no device backend configured')
309#endif
310 end subroutine device_lij_compute_part2
311
313 subroutine device_mij_compute_part1(m11_d, m22_d, m33_d, &
314 m12_d, m13_d, m23_d, &
315 s_abs_d, s11_d, s22_d, s33_d, &
316 s12_d, s13_d, s23_d, &
317 fs_abs_d, fs11_d, fs22_d, fs33_d, &
318 fs12_d, fs13_d, fs23_d, &
319 fsabss11_d, fsabss22_d, fsabss33_d, &
320 fsabss12_d, fsabss13_d, fsabss23_d, &
321 delta_ratio2, n)
322 type(c_ptr) :: m11_d, m22_d, m33_d, &
323 m12_d, m13_d, m23_d, &
324 s_abs_d, s11_d, s22_d, s33_d, &
325 s12_d, s13_d, s23_d, &
326 fs_abs_d, fs11_d, fs22_d, fs33_d, &
327 fs12_d, fs13_d, fs23_d, &
328 fsabss11_d, fsabss22_d, fsabss33_d, &
329 fsabss12_d, fsabss13_d, fsabss23_d
330 real(kind=rp) :: delta_ratio2
331 integer :: n
332
333#if HAVE_HIP
334 call hip_mij_compute_part1(m11_d, m22_d, m33_d, &
335 m12_d, m13_d, m23_d, &
336 s_abs_d, s11_d, s22_d, s33_d, &
337 s12_d, s13_d, s23_d, &
338 fs_abs_d, fs11_d, fs22_d, fs33_d, &
339 fs12_d, fs13_d, fs23_d, &
340 fsabss11_d, fsabss22_d, fsabss33_d, &
341 fsabss12_d, fsabss13_d, fsabss23_d, &
342 delta_ratio2, n)
343#elif HAVE_CUDA
344 call cuda_mij_compute_part1(m11_d, m22_d, m33_d, &
345 m12_d, m13_d, m23_d, &
346 s_abs_d, s11_d, s22_d, s33_d, &
347 s12_d, s13_d, s23_d, &
348 fs_abs_d, fs11_d, fs22_d, fs33_d, &
349 fs12_d, fs13_d, fs23_d, &
350 fsabss11_d, fsabss22_d, fsabss33_d, &
351 fsabss12_d, fsabss13_d, fsabss23_d, &
352 delta_ratio2, n)
353#elif HAVE_OPENCL
354 call neko_error('opencl backend is not supported for &
355 &device_mij_compute_part1')
356#else
357 call neko_error('no device backend configured')
358#endif
359 end subroutine device_mij_compute_part1
360
362 subroutine device_mij_nut_compute_part2(m11_d, m22_d, m33_d, &
363 m12_d, m13_d, m23_d, &
364 l11_d, l22_d, l33_d, &
365 l12_d, l13_d, l23_d, &
366 fsabss11_d, fsabss22_d, fsabss33_d, &
367 fsabss12_d, fsabss13_d, fsabss23_d, &
368 num_d, den_d, c_dyn_d, delta_d, &
369 s_abs_d, nut_d, alpha, mult_d, n)
370 type(c_ptr) :: m11_d, m22_d, m33_d, &
371 m12_d, m13_d, m23_d, &
372 l11_d, l22_d, l33_d, &
373 l12_d, l13_d, l23_d, &
374 fsabss11_d, fsabss22_d, fsabss33_d, &
375 fsabss12_d, fsabss13_d, fsabss23_d, &
376 num_d, den_d, c_dyn_d, delta_d, s_abs_d, nut_d , mult_d
377 real(kind=rp) :: alpha
378 integer :: n
379
380#if HAVE_HIP
381 call hip_mij_nut_compute_part2(m11_d, m22_d, m33_d, &
382 m12_d, m13_d, m23_d, &
383 l11_d, l22_d, l33_d, &
384 l12_d, l13_d, l23_d, &
385 fsabss11_d, fsabss22_d, fsabss33_d, &
386 fsabss12_d, fsabss13_d, fsabss23_d, &
387 num_d, den_d, c_dyn_d, delta_d, &
388 s_abs_d, nut_d, alpha, mult_d, n)
389#elif HAVE_CUDA
390 call cuda_mij_nut_compute_part2(m11_d, m22_d, m33_d, &
391 m12_d, m13_d, m23_d, &
392 l11_d, l22_d, l33_d, &
393 l12_d, l13_d, l23_d, &
394 fsabss11_d, fsabss22_d, fsabss33_d, &
395 fsabss12_d, fsabss13_d, fsabss23_d, &
396 num_d, den_d, c_dyn_d, delta_d, &
397 s_abs_d, nut_d, alpha, mult_d, n)
398#elif HAVE_OPENCL
399 call neko_error('opencl backend is not supported for &
400 &device_mij_nut_compute_part2')
401#else
402 call neko_error('no device backend configured')
403#endif
404 end subroutine device_mij_nut_compute_part2
405
406
407end module device_dynamic_smagorinsky_nut
void cuda_mij_nut_compute_part2(void *m11, void *m22, void *m33, void *m12, void *m13, void *m23, void *l11, void *l22, void *l33, void *l12, void *l13, void *l23, void *fsabss11, void *fsabss22, void *fsabss33, void *fsabss12, void *fsabss13, void *fsabss23, void *num, void *den, void *c_dyn, void *delta, void *s_abs, void *nut, real *alpha, void *mult, int *n)
void cuda_mij_compute_part1(void *m11, void *m22, void *m33, void *m12, void *m13, void *m23, void *s_abs, void *s11, void *s22, void *s33, void *s12, void *s13, void *s23, void *fs_abs, void *fs11, void *fs22, void *fs33, void *fs12, void *fs13, void *fs23, void *fsabss11, void *fsabss22, void *fsabss33, void *fsabss12, void *fsabss13, void *fsabss23, real *delta_ratio2, int *n)
void cuda_s_abs_compute(void *s_abs, void *s11, void *s22, void *s33, void *s12, void *s13, void *s23, int *n)
void cuda_lij_compute_part1(void *l11, void *l22, void *l33, void *l12, void *l13, void *l23, void *u, void *v, void *w, void *fu, void *fv, void *fw, void *fuu, void *fvv, void *fww, void *fuv, void *fuw, void *fvw, int *n)
void cuda_lij_compute_part2(void *l11, void *l22, void *l33, void *l12, void *l13, void *l23, void *fuu, void *fvv, void *fww, void *fuv, void *fuw, void *fvw, int *n)
Definition comm.F90:1
type(mpi_comm) neko_comm
MPI communicator.
Definition comm.F90:38
type(mpi_datatype) mpi_real_precision
MPI type for working precision of REAL types.
Definition comm.F90:45
integer pe_size
MPI size of communicator.
Definition comm.F90:53
subroutine, public device_lij_compute_part1(l11_d, l22_d, l33_d, l12_d, l13_d, l23_d, u_d, v_d, w_d, fu_d, fv_d, fw_d, fuu_d, fvv_d, fww_d, fuv_d, fuw_d, fvw_d, n)
part 1 of the computing of the lij field
subroutine, public device_mij_compute_part1(m11_d, m22_d, m33_d, m12_d, m13_d, m23_d, s_abs_d, s11_d, s22_d, s33_d, s12_d, s13_d, s23_d, fs_abs_d, fs11_d, fs22_d, fs33_d, fs12_d, fs13_d, fs23_d, fsabss11_d, fsabss22_d, fsabss33_d, fsabss12_d, fsabss13_d, fsabss23_d, delta_ratio2, n)
part 1 of the computing of the mij field
subroutine, public device_s_abs_compute(s_abs_d, s11_d, s22_d, s33_d, s12_d, s13_d, s23_d, n)
Compute the s_abs field for the Sigma model indevice.
subroutine, public device_lij_compute_part2(l11_d, l22_d, l33_d, l12_d, l13_d, l23_d, fuu_d, fvv_d, fww_d, fuv_d, fuw_d, fvw_d, n)
part 2 of the computing of the lij field
subroutine, public device_mij_nut_compute_part2(m11_d, m22_d, m33_d, m12_d, m13_d, m23_d, l11_d, l22_d, l33_d, l12_d, l13_d, l23_d, fsabss11_d, fsabss22_d, fsabss33_d, fsabss12_d, fsabss13_d, fsabss23_d, num_d, den_d, c_dyn_d, delta_d, s_abs_d, nut_d, alpha, mult_d, n)
part 1 of the computing of the mij field
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