Neko 1.99.10
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
dynamic_smagorinsky_nut.hip
Go to the documentation of this file.
1/*
2 Copyright (c) 2024, The Neko Authors
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 * Redistributions in binary form must reproduce the above
13 copyright notice, this list of conditions and the following
14 disclaimer in the documentation and/or other materials provided
15 with the distribution.
16
17 * Neither the name of the authors nor the names of its
18 contributors may be used to endorse or promote products derived
19 from this software without specific prior written permission.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE.
33*/
34
35#include <hip/hip_runtime.h>
37#include <device/hip/check.h>
39
40extern "C" {
41 void hip_s_abs_compute(void *s_abs, void *s11, void *s22, void *s33,
42 void *s12, void *s13, void *s23,
43 int * n){
44
45 const dim3 nthrds(1024, 1, 1);
46 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
47 hipLaunchKernelGGL(HIP_KERNEL_NAME(s_abs_compute<real>),
48 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
49 (real *) s_abs,
50 (real *) s11, (real *) s22, (real *) s33,
51 (real *) s12, (real *) s13, (real *) s23,
52 * n);
53 HIP_CHECK(hipGetLastError());
54 }
55
56 void hip_lij_compute_part1(void *l11, void *l22, void *l33,
57 void *l12, void *l13, void *l23,
58 void *u, void *v, void *w,
59 void *fu, void *fv, void *fw,
60 void *fuu, void *fvv, void *fww,
61 void *fuv, void *fuw, void *fvw,
62 int * n){
63
64 const dim3 nthrds(1024, 1, 1);
65 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
66 hipLaunchKernelGGL(HIP_KERNEL_NAME(lij_compute_part1<real>),
67 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
68 (real *) l11, (real *) l22, (real *) l33,
69 (real *) l12, (real *) l13, (real *) l23,
70 (real *) u, (real *) v, (real *) w,
71 (real *) fu, (real *) fv, (real *) fw,
72 (real *) fuu, (real *) fvv, (real *) fww,
73 (real *) fuv, (real *) fuw, (real *) fvw,
74 * n);
75 HIP_CHECK(hipGetLastError());
76 }
77
78 void hip_lij_compute_part2(void *l11, void *l22, void *l33,
79 void *l12, void *l13, void *l23,
80 void *fuu, void *fvv, void *fww,
81 void *fuv, void *fuw, void *fvw,
82 int * n){
83
84 const dim3 nthrds(1024, 1, 1);
85 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
86 hipLaunchKernelGGL(HIP_KERNEL_NAME(lij_compute_part2<real>),
87 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
88 (real *) l11, (real *) l22, (real *) l33,
89 (real *) l12, (real *) l13, (real *) l23,
90 (real *) fuu, (real *) fvv, (real *) fww,
91 (real *) fuv, (real *) fuw, (real *) fvw,
92 * n);
93 HIP_CHECK(hipGetLastError());
94 }
95
96 void hip_mij_compute_part1(void *m11, void *m22, void *m33,
97 void *m12, void *m13, void *m23,
98 void *s_abs, void *s11, void *s22, void *s33,
99 void *s12, void *s13, void *s23,
100 void *delta, void *fs11, void *fs22, void *fs33,
101 void *fs12, void *fs13, void *fs23,
102 void *fsabss11, void *fsabss22, void *fsabss33,
103 void *fsabss12, void *fsabss13, void *fsabss23,
104 real * delta_ratio2, int * n){
105
106 const dim3 nthrds(1024, 1, 1);
107 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
108 hipLaunchKernelGGL(HIP_KERNEL_NAME(mij_compute_part1<real>),
109 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
110 (real *) m11, (real *) m22, (real *) m33,
111 (real *) m12, (real *) m13, (real *) m23,
112 (real *) s_abs, (real *) s11, (real *) s22,
113 (real *) s33, (real *) s12, (real *) s13, (real *) s23,
114 (real *) delta, (real *) fs11, (real *) fs22,
115 (real *) fs33, (real *) fs12, (real *) fs13, (real *) fs23,
116 (real *) fsabss11, (real *) fsabss22, (real *) fsabss33,
117 (real *) fsabss12, (real *) fsabss13, (real *) fsabss23,
118 * delta_ratio2, * n);
119 HIP_CHECK(hipGetLastError());
120 }
121
122 void hip_mij_nut_compute_part2(void *m11, void *m22, void *m33,
123 void *m12, void *m13, void *m23,
124 void *l11, void *l22, void *l33,
125 void *l12, void *l13, void *l23,
126 void *fsabss11, void *fsabss22, void *fsabss33,
127 void *fsabss12, void *fsabss13, void *fsabss23,
128 void *num, void *den, void *c_dyn, void *delta,
129 void *s_abs, void *nut,
130 real * alpha, int * n){
131
132 const dim3 nthrds(1024, 1, 1);
133 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
134 hipLaunchKernelGGL(HIP_KERNEL_NAME(mij_nut_compute_part2<real>),
135 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
136 (real *) m11, (real *) m22, (real *) m33,
137 (real *) m12, (real *) m13, (real *) m23,
138 (real *) l11, (real *) l22, (real *) l33,
139 (real *) l12, (real *) l13, (real *) l23,
140 (real *) fsabss11, (real *) fsabss22, (real *) fsabss33,
141 (real *) fsabss12, (real *) fsabss13, (real *) fsabss23,
142 (real *) num, (real *) den, (real *) c_dyn,
143 (real *) delta, (real *) s_abs, (real *) nut,
144 * alpha, * n);
145 HIP_CHECK(hipGetLastError());
146 }
147}
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ w
__global__ void const T *__restrict__ u
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ v
__global__ void mij_compute_part1(T *__restrict__ m11, T *__restrict__ m22, T *__restrict__ m33, T *__restrict__ m12, T *__restrict__ m13, T *__restrict__ m23, const T *__restrict__ s_abs, const T *__restrict__ s11, const T *__restrict__ s22, const T *__restrict__ s33, const T *__restrict__ s12, const T *__restrict__ s13, const T *__restrict__ s23, const T *__restrict__ delta, const T *__restrict__ fs11, const T *__restrict__ fs22, const T *__restrict__ fs33, const T *__restrict__ fs12, const T *__restrict__ fs13, const T *__restrict__ fs23, T *__restrict__ fsabss11, T *__restrict__ fsabss22, T *__restrict__ fsabss33, T *__restrict__ fsabss12, T *__restrict__ fsabss13, T *__restrict__ fsabss23, const T delta_ratio2, const int n)
__global__ void mij_nut_compute_part2(const T *__restrict__ m11, const T *__restrict__ m22, const T *__restrict__ m33, const T *__restrict__ m12, const T *__restrict__ m13, const T *__restrict__ m23, T *__restrict__ l11, T *__restrict__ l22, T *__restrict__ l33, T *__restrict__ l12, T *__restrict__ l13, T *__restrict__ l23, const T *__restrict__ fsabss11, const T *__restrict__ fsabss22, const T *__restrict__ fsabss33, const T *__restrict__ fsabss12, const T *__restrict__ fsabss13, const T *__restrict__ fsabss23, T *__restrict__ num, T *__restrict__ den, T *__restrict__ c_dyn, const T *__restrict__ delta, const T *__restrict__ s_abs, T *__restrict__ nut, const T alpha, const int n)
__global__ void lij_compute_part1(T *__restrict__ l11, T *__restrict__ l22, T *__restrict__ l33, T *__restrict__ l12, T *__restrict__ l13, T *__restrict__ l23, const T *__restrict__ u, const T *__restrict__ v, const T *__restrict__ w, const T *__restrict__ fu, const T *__restrict__ fv, const T *__restrict__ fw, T *__restrict__ fuu, T *__restrict__ fvv, T *__restrict__ fww, T *__restrict__ fuv, T *__restrict__ fuw, T *__restrict__ fvw, const int n)
__global__ void lij_compute_part2(T *__restrict__ l11, T *__restrict__ l22, T *__restrict__ l33, T *__restrict__ l12, T *__restrict__ l13, T *__restrict__ l23, const T *__restrict__ fuu, const T *__restrict__ fvv, const T *__restrict__ fww, const T *__restrict__ fuv, const T *__restrict__ fuw, const T *__restrict__ fvw, const int n)
__global__ void s_abs_compute(T *__restrict__ s_abs, const T *__restrict__ s11, const T *__restrict__ s22, const T *__restrict__ s33, const T *__restrict__ s12, const T *__restrict__ s13, const T *__restrict__ s23, const int n)
double real
void * glb_cmd_queue
void hip_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 hip_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 *delta, 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 hip_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, int *n)
void hip_s_abs_compute(void *s_abs, void *s11, void *s22, void *s33, void *s12, void *s13, void *s23, int *n)
void hip_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)
#define HIP_CHECK(err)
Definition check.h:8