Neko 1.99.5
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
rhs_maker.cu
Go to the documentation of this file.
1/*
2 Copyright (c) 2022, 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
36#include <device/cuda/check.h>
37
38#include "sumab_kernel.h"
39#include "makeext_kernel.h"
40#include "makebdf_kernel.h"
41#include "makeoifs_kernel.h"
42
43extern "C" {
44 void rhs_maker_sumab_cuda(void *u, void *v, void *w,
45 void *uu, void *vv, void *ww,
46 void *ulag1, void *ulag2, void *vlag1,
47 void *vlag2, void *wlag1, void *wlag2,
48 real *ab1, real *ab2, real *ab3, int *nab, int *n) {
49
50 const dim3 nthrds(1024, 1, 1);
51 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
52 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
53
55 <<<nblcks, nthrds, 0, stream>>>((real *) u, (real *) v, (real *) w,
56 (real *) uu, (real *) vv, (real *) ww,
57 (real *) ulag1, (real *) ulag2, (real *) vlag1,
58 (real *) vlag2, (real *) wlag1, (real *) wlag2,
59 *ab1, *ab2, *ab3, *nab, *n);
61 }
62
63 void rhs_maker_ext_cuda(void *abx1, void *aby1, void *abz1,
64 void *abx2, void *aby2, void *abz2,
65 void *bfx, void *bfy, void *bfz,
66 real *rho, real *ab1, real *ab2, real *ab3, int *n) {
67
68 const dim3 nthrds(1024, 1, 1);
69 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
70 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
71
73 <<<nblcks, nthrds, 0, stream>>>((real *) abx1, (real *) aby1,
74 (real *) abz1, (real *) abx2,
75 (real *) aby2, (real *) abz2,
76 (real *) bfx, (real *) bfy,
77 (real *) bfz, *rho, *ab1,
78 *ab2, *ab3, *n);
80 }
81
82 void scalar_rhs_maker_ext_cuda(void *fs_lag, void *fs_laglag, void *fs,
83 real *rho, real *ext1, real *ext2, real *ext3,
84 int *n) {
85
86 const dim3 nthrds(1024, 1, 1);
87 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
88 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
89
91 <<<nblcks, nthrds, 0, stream>>>((real *) fs_lag,
92 (real *) fs_laglag,
93 (real *) fs,
94 *rho, *ext1, *ext2, *ext3, *n);
96 }
97
98 void rhs_maker_bdf_cuda(void *ulag1, void *ulag2, void *vlag1,
99 void *vlag2, void *wlag1, void *wlag2,
100 void *bfx, void *bfy, void *bfz,
101 void *u, void *v, void *w, void *B,
102 void *Blag, void *Blaglag,
103 real *rho, real *dt, real *bd2,
104 real *bd3, real *bd4, int *nbd, int *n) {
105
106 const dim3 nthrds(1024, 1, 1);
107 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
108 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
109
111 <<<nblcks, nthrds, 0, stream>>>((real *) ulag1, (real *) ulag2,
112 (real *) vlag1, (real *) vlag2,
113 (real *) wlag1, (real *) wlag2,
114 (real *) bfx, (real *) bfy, (real *) bfz,
115 (real *) u, (real *) v, (real *) w,
116 (real *) B, (real *) Blag, (real *) Blaglag,
117 *rho, *dt, *bd2, *bd3, *bd4, *nbd, *n);
119 }
120
121 void scalar_rhs_maker_bdf_cuda(void *s_lag, void *s_laglag,
122 void *fs,
123 void *s, void *B,
124 real *rho, real *dt, real *bd2,
125 real *bd3, real *bd4, int *nbd, int *n) {
126
127 const dim3 nthrds(1024, 1, 1);
128 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
129 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
130
132 <<<nblcks, nthrds, 0, stream>>>((real *) s_lag,
133 (real *) s_laglag,
134 (real *) fs,
135 (real *) s,
136 (real *) B,
137 *rho, *dt, *bd2, *bd3, *bd4, *nbd, *n);
139 }
140
141 void rhs_maker_oifs_cuda(void *phi_x, void *phi_y, void *phi_z,
142 void *bf_x, void *bf_y, void *bf_z,
143 real *rho, real *dt, int *n) {
144
145 const dim3 nthrds(1024, 1, 1);
146 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
147 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
148
150 <<<nblcks, nthrds, 0, stream>>>((real *) phi_x, (real *) phi_y,
151 (real *) phi_z, (real *) bf_x,
152 (real *) bf_y, (real *) bf_z,
153 *rho, *dt, *n);
155
156 }
157
159 real *rho, real *dt, int *n) {
160
161 const dim3 nthrds(1024, 1, 1);
162 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
163 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
164
166 <<<nblcks, nthrds, 0, stream>>>((real *) phi_s, (real *) bf_s,
167 *rho, *dt, *n);
169
170 }
171}
172
__global__ void ale_add_kinematics_kernel(const int n, T *__restrict__ wx, T *__restrict__ wy, T *__restrict__ wz, const T *__restrict__ x_ref, const T *__restrict__ y_ref, const T *__restrict__ z_ref, const T *__restrict__ phi, const T *__restrict__ x, const T *__restrict__ y, const T *__restrict__ z, const kinematics_params_t kin_params)
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ w
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ u
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ v
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dt
#define CUDA_CHECK(err)
Definition check.h:6
double real
void scalar_rhs_maker_oifs_cuda(void *phi_s, void *bf_s, real *rho, real *dt, int *n)
Definition rhs_maker.cu:158
void scalar_rhs_maker_bdf_cuda(void *s_lag, void *s_laglag, void *fs, void *s, void *B, real *rho, real *dt, real *bd2, real *bd3, real *bd4, int *nbd, int *n)
Definition rhs_maker.cu:121
void rhs_maker_oifs_cuda(void *phi_x, void *phi_y, void *phi_z, void *bf_x, void *bf_y, void *bf_z, real *rho, real *dt, int *n)
Definition rhs_maker.cu:141
void rhs_maker_ext_cuda(void *abx1, void *aby1, void *abz1, void *abx2, void *aby2, void *abz2, void *bfx, void *bfy, void *bfz, real *rho, real *ab1, real *ab2, real *ab3, int *n)
Definition rhs_maker.cu:63
void scalar_rhs_maker_ext_cuda(void *fs_lag, void *fs_laglag, void *fs, real *rho, real *ext1, real *ext2, real *ext3, int *n)
Definition rhs_maker.cu:82
void rhs_maker_sumab_cuda(void *u, void *v, void *w, void *uu, void *vv, void *ww, void *ulag1, void *ulag2, void *vlag1, void *vlag2, void *wlag1, void *wlag2, real *ab1, real *ab2, real *ab3, int *nab, int *n)
Definition rhs_maker.cu:44
void rhs_maker_bdf_cuda(void *ulag1, void *ulag2, void *vlag1, void *vlag2, void *wlag1, void *wlag2, void *bfx, void *bfy, void *bfz, void *u, void *v, void *w, void *B, void *Blag, void *Blaglag, real *rho, real *dt, real *bd2, real *bd3, real *bd4, int *nbd, int *n)
Definition rhs_maker.cu:98