Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
wall_model_device.F90
Go to the documentation of this file.
1! Copyright (c) 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!
35 use num_types, only : rp, c_rp
36 use, intrinsic :: iso_c_binding, only : c_ptr
37 use utils, only : neko_error
38 implicit none
39 private
40
41#ifdef HAVE_HIP
42 interface
43 subroutine hip_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
44 tau_field_d, msk_d, m) &
45 bind(c, name = 'hip_wall_model_compute_mag_field')
46 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
47 implicit none
48 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d, tau_field_d, msk_d
49 integer(c_int) :: m
51 end interface
52#elif HAVE_CUDA
53 interface
54 subroutine cuda_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
55 tau_field_d, msk_d, m) &
56 bind(c, name = 'cuda_wall_model_compute_mag_field')
57 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
58 implicit none
59 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d, tau_field_d, msk_d
60 integer(c_int) :: m
62 end interface
63#elif HAVE_OPENCL
64 interface
65 subroutine opencl_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
66 tau_field_d, msk_d, m) &
67 bind(c, name = 'opencl_wall_model_compute_mag_field')
68 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
69 implicit none
70 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d, tau_field_d, msk_d
71 integer(c_int) :: m
73 end interface
74#elif HAVE_METAL
75 interface
76 subroutine metal_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
77 tau_field_d, msk_d, m) &
78 bind(c, name = 'metal_wall_model_compute_mag_field')
79 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
80 implicit none
81 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d, tau_field_d, msk_d
82 integer(c_int) :: m
83 end subroutine metal_wall_model_compute_mag_field
84 end interface
85#endif
87
88contains
92 subroutine wall_model_compute_mag_field_device(tau_x_d, tau_y_d, tau_z_d, &
93 tau_field_d, msk_d, m)
94 type(c_ptr), intent(in) :: tau_x_d, tau_y_d, tau_z_d
95 type(c_ptr), intent(in) :: msk_d
96 type(c_ptr), intent(inout) :: tau_field_d
97 integer, intent(in) :: m
98
99#if HAVE_HIP
100 call hip_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
101 tau_field_d, msk_d, m)
102#elif HAVE_CUDA
103 call cuda_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
104 tau_field_d, msk_d, m)
105#elif HAVE_OPENCL
106 call opencl_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
107 tau_field_d, msk_d, m)
108#elif HAVE_METAL
109 call metal_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
110 tau_field_d, msk_d, m)
111#else
112 call neko_error('No device backend configured')
113#endif
114
116end module wall_model_device
integer, parameter, public c_rp
Definition num_types.f90:15
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:14
Utilities.
Definition utils.f90:35
Implements the device kernel for the wall_model_t type.
subroutine, public wall_model_compute_mag_field_device(tau_x_d, tau_y_d, tau_z_d, tau_field_d, msk_d, m)
Compute the wall shear stress's magnitude on device.
void opencl_wall_model_compute_mag_field(void *tau_x_d, void *tau_y_d, void *tau_z_d, void *tau_field_d, void *msk_d, int *m)
Definition wall_model.c:49
void cuda_wall_model_compute_mag_field(void *tau_x_d, void *tau_y_d, void *tau_z_d, void *tau_field_d, void *msk_d, int *m)
Definition wall_model.cu:42