Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
device_sigma_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_sigma_nut_compute(g11_d, g12_d, g13_d, &
46 g21_d, g22_d, g23_d, &
47 g31_d, g32_d, g33_d, &
48 delta_d, nut_d, mult_d, c, eps, n) &
49 bind(c, name = 'hip_sigma_nut_compute')
50 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
51 import c_rp
52 type(c_ptr), value :: g11_d, g12_d, g13_d, &
53 g21_d, g22_d, g23_d, &
54 g31_d, g32_d, g33_d, &
55 delta_d, nut_d, mult_d
56 integer(c_int) :: n
57 real(c_rp) :: c, eps
58 end subroutine hip_sigma_nut_compute
59 end interface
60#elif HAVE_CUDA
61 interface
62 subroutine cuda_sigma_nut_compute(g11_d, g12_d, g13_d, &
63 g21_d, g22_d, g23_d, &
64 g31_d, g32_d, g33_d, &
65 delta_d, nut_d, mult_d, c, eps, n) &
66 bind(c, name = 'cuda_sigma_nut_compute')
67 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
68 import c_rp
69 type(c_ptr), value :: g11_d, g12_d, g13_d, &
70 g21_d, g22_d, g23_d, &
71 g31_d, g32_d, g33_d, &
72 delta_d, nut_d, mult_d
73 integer(c_int) :: n
74 real(c_rp) :: c, eps
75 end subroutine cuda_sigma_nut_compute
76 end interface
77#elif HAVE_OPENCL
78#endif
79
81
82contains
83
85 subroutine device_sigma_nut_compute(g11_d, g12_d, g13_d, &
86 g21_d, g22_d, g23_d, &
87 g31_d, g32_d, g33_d, &
88 delta_d, nut_d, mult_d, c, eps, n)
89 type(c_ptr) :: g11_d, g12_d, g13_d, &
90 g21_d, g22_d, g23_d, &
91 g31_d, g32_d, g33_d, &
92 delta_d, nut_d, mult_d
93 integer :: n
94 real(kind=rp) :: c, eps
95#if HAVE_HIP
96 call hip_sigma_nut_compute(g11_d, g12_d, g13_d, &
97 g21_d, g22_d, g23_d, &
98 g31_d, g32_d, g33_d, &
99 delta_d, nut_d, mult_d, c, eps, n)
100#elif HAVE_CUDA
101 call cuda_sigma_nut_compute(g11_d, g12_d, g13_d, &
102 g21_d, g22_d, g23_d, &
103 g31_d, g32_d, g33_d, &
104 delta_d, nut_d, mult_d, c, eps, n)
105#elif HAVE_OPENCL
106 call neko_error('opencl backend is not supported for device_sigma_nut')
107#else
108 call neko_error('no device backend configured')
109#endif
110 end subroutine device_sigma_nut_compute
111
112
113end module device_sigma_nut
Definition comm.F90:1
type(mpi_comm) neko_comm
MPI communicator.
Definition comm.F90:16
type(mpi_datatype) mpi_real_precision
MPI type for working precision of REAL types.
Definition comm.F90:23
integer pe_size
MPI size of communicator.
Definition comm.F90:31
subroutine, public device_sigma_nut_compute(g11_d, g12_d, g13_d, g21_d, g22_d, g23_d, g31_d, g32_d, g33_d, delta_d, nut_d, mult_d, c, eps, n)
Compute the eddy viscosity field for the Sigma model indevice.
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
void cuda_sigma_nut_compute(void *g11, void *g12, void *g13, void *g21, void *g22, void *g23, void *g31, void *g32, void *g33, void *delta, void *nut, void *mult, real *c, real *eps, int *n)
Definition sigma_nut.cu:47