Loading [MathJax]/extensions/tex2jax.js
Neko 0.9.1
A portable framework for high-order spectral element flow simulations
All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Pages
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 ! use cuda_sigma_nut
41 implicit none
42 private
43
44#ifdef HAVE_HIP
45 interface
46 subroutine hip_sigma_nut_compute(g11_d, g12_d, g13_d, &
47 g21_d, g22_d, g23_d, &
48 g31_d, g32_d, g33_d, &
49 delta_d, nut_d, mult_d, c, eps, n) &
50 bind(c, name = 'hip_sigma_nut_compute')
51 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
52 import c_rp
53 type(c_ptr), value :: g11_d, g12_d, g13_d, &
54 g21_d, g22_d, g23_d, &
55 g31_d, g32_d, g33_d, &
56 delta_d, nut_d, mult_d
57 integer(c_int) :: n
58 real(c_rp) :: c, eps
59 end subroutine hip_sigma_nut_compute
60 end interface
61#elif HAVE_CUDA
62 interface
63 subroutine cuda_sigma_nut_compute(g11_d, g12_d, g13_d, &
64 g21_d, g22_d, g23_d, &
65 g31_d, g32_d, g33_d, &
66 delta_d, nut_d, mult_d, c, eps, n) &
67 bind(c, name = 'cuda_sigma_nut_compute')
68 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
69 import c_rp
70 type(c_ptr), value :: g11_d, g12_d, g13_d, &
71 g21_d, g22_d, g23_d, &
72 g31_d, g32_d, g33_d, &
73 delta_d, nut_d, mult_d
74 integer(c_int) :: n
75 real(c_rp) :: c, eps
76 end subroutine cuda_sigma_nut_compute
77 end interface
78#elif HAVE_OPENCL
79#endif
80
82
83contains
84
86 subroutine device_sigma_nut_compute(g11_d, g12_d, g13_d, &
87 g21_d, g22_d, g23_d, &
88 g31_d, g32_d, g33_d, &
89 delta_d, nut_d, mult_d, c, eps, n)
90 type(c_ptr) :: g11_d, g12_d, g13_d, &
91 g21_d, g22_d, g23_d, &
92 g31_d, g32_d, g33_d, &
93 delta_d, nut_d, mult_d
94 integer :: n
95 real(kind=rp) :: c, eps
96#if HAVE_HIP
97 call hip_sigma_nut_compute(g11_d, g12_d, g13_d, &
98 g21_d, g22_d, g23_d, &
99 g31_d, g32_d, g33_d, &
100 delta_d, nut_d, mult_d, c, eps, n)
101#elif HAVE_CUDA
102 call cuda_sigma_nut_compute(g11_d, g12_d, g13_d, &
103 g21_d, g22_d, g23_d, &
104 g31_d, g32_d, g33_d, &
105 delta_d, nut_d, mult_d, c, eps, n)
106#elif HAVE_OPENCL
107 call neko_error('opencl backend is not supported for device_sigma_nut')
108#else
109 call neko_error('no device backend configured')
110#endif
111 end subroutine device_sigma_nut_compute
112
113
114end 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