Loading [MathJax]/extensions/tex2jax.js
Neko 0.9.99
A portable framework for high-order spectral element flow simulations
All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Pages
euler_res.cu
Go to the documentation of this file.
1/*
2 Copyright (c) 2025, 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 "euler_res_kernel.h"
39
40extern "C" {
41
42 void euler_res_part_visc_cuda(void *rhs_u, void *Binv, void *lap_sol,
43 void *h, real *c_avisc, int *n) {
44
45 const dim3 nthrds(1024, 1, 1);
46 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
47 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
48
50 <<<nblcks, nthrds, 0, stream>>>((real *) rhs_u, (real *) Binv,
51 (real *) lap_sol, (real *) h,
52 *c_avisc, *n);
54 }
55
56 void euler_res_part_mx_flux_cuda(void *f_x, void *f_y, void *f_z,
57 void *m_x, void *m_y, void *m_z,
58 void *rho_field, void *p, int *n) {
59
60 const dim3 nthrds(1024, 1, 1);
61 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
62 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
63
65 <<<nblcks, nthrds, 0, stream>>>((real *) f_x, (real *) f_y, (real *) f_z,
66 (real *) m_x, (real *) m_y, (real *) m_z,
67 (real *) rho_field, (real *) p, *n);
69 }
70
71 void euler_res_part_my_flux_cuda(void *f_x, void *f_y, void *f_z,
72 void *m_x, void *m_y, void *m_z,
73 void *rho_field, void *p, int *n) {
74
75 const dim3 nthrds(1024, 1, 1);
76 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
77 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
78
80 <<<nblcks, nthrds, 0, stream>>>((real *) f_x, (real *) f_y, (real *) f_z,
81 (real *) m_x, (real *) m_y, (real *) m_z,
82 (real *) rho_field, (real *) p, *n);
84 }
85
86 void euler_res_part_mz_flux_cuda(void *f_x, void *f_y, void *f_z,
87 void *m_x, void *m_y, void *m_z,
88 void *rho_field, void *p, int *n) {
89
90 const dim3 nthrds(1024, 1, 1);
91 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
92 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
93
95 <<<nblcks, nthrds, 0, stream>>>((real *) f_x, (real *) f_y, (real *) f_z,
96 (real *) m_x, (real *) m_y, (real *) m_z,
97 (real *) rho_field, (real *) p, *n);
99 }
100
101 void euler_res_part_E_flux_cuda(void *f_x, void *f_y, void *f_z,
102 void *m_x, void *m_y, void *m_z,
103 void *rho_field, void *p, void *E,
104 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 *) f_x, (real *) f_y, (real *) f_z,
112 (real *) m_x, (real *) m_y, (real *) m_z,
113 (real *) rho_field, (real *) p, (real *) E, *n);
115 }
116
118 void *rhs_m_y, void *rhs_m_z,
119 void *rhs_E, void *mult, int *n) {
120
121 const dim3 nthrds(1024, 1, 1);
122 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
123 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
124
126 <<<nblcks, nthrds, 0, stream>>>((real *) rhs_rho, (real *) rhs_m_x,
127 (real *) rhs_m_y, (real *) rhs_m_z,
128 (real *) rhs_E, (real *) mult, *n);
130 }
131
132 void euler_res_part_rk_sum_cuda(void *rho, void *m_x, void *m_y,
133 void *m_z, void *E,
134 void *k_rho_i, void *k_m_x_i, void *k_m_y_i,
135 void *k_m_z_i, void *k_E_i,
136 real *dt, real *c, int *n) {
137 const dim3 nthrds(1024, 1, 1);
138 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
139 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
140
142 <<<nblcks, nthrds, 0, stream>>>((real *) rho, (real *) m_x, (real *) m_y,
143 (real *) m_z, (real *) E,
144 (real *) k_rho_i, (real *) k_m_x_i, (real *) k_m_y_i,
145 (real *) k_m_z_i, (real *) k_E_i,
146 *dt, *c, *n);
148 }
149}
150
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dt
#define CUDA_CHECK(err)
Definition check.h:6
__global__ void dirichlet_apply_scalar_kernel(const int *__restrict__ msk, T *__restrict__ x, const T g, const int m)
double real
void euler_res_part_mx_flux_cuda(void *f_x, void *f_y, void *f_z, void *m_x, void *m_y, void *m_z, void *rho_field, void *p, int *n)
Definition euler_res.cu:56
void euler_res_part_my_flux_cuda(void *f_x, void *f_y, void *f_z, void *m_x, void *m_y, void *m_z, void *rho_field, void *p, int *n)
Definition euler_res.cu:71
void euler_res_part_visc_cuda(void *rhs_u, void *Binv, void *lap_sol, void *h, real *c_avisc, int *n)
Definition euler_res.cu:42
void euler_res_part_rk_sum_cuda(void *rho, void *m_x, void *m_y, void *m_z, void *E, void *k_rho_i, void *k_m_x_i, void *k_m_y_i, void *k_m_z_i, void *k_E_i, real *dt, real *c, int *n)
Definition euler_res.cu:132
void euler_res_part_coef_mult_cuda(void *rhs_rho, void *rhs_m_x, void *rhs_m_y, void *rhs_m_z, void *rhs_E, void *mult, int *n)
Definition euler_res.cu:117
void euler_res_part_mz_flux_cuda(void *f_x, void *f_y, void *f_z, void *m_x, void *m_y, void *m_z, void *rho_field, void *p, int *n)
Definition euler_res.cu:86
void euler_res_part_E_flux_cuda(void *f_x, void *f_y, void *f_z, void *m_x, void *m_y, void *m_z, void *rho_field, void *p, void *E, int *n)
Definition euler_res.cu:101