Neko 1.99.11
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
compressible_res.hip
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
35#include <hip/hip_runtime.h>
37#include <device/hip/check.h>
38
40
41extern "C" {
42
43 void compressible_res_part_visc_hip(void *rhs_rho, void *rhs_m_x,
44 void *rhs_m_y, void *rhs_m_z, void *rhs_E,
45 void *visc_rho, void *visc_m_x, void *visc_m_y,
46 void *visc_m_z, void *visc_E,
47 void *Binv, void *h1, int *n) {
48
49 const dim3 nthrds(1024, 1, 1);
50 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
51
52 hipLaunchKernelGGL(HIP_KERNEL_NAME( compressible_res_part_visc_kernel<real> ),
53 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
54 (real *) rhs_rho, (real *) rhs_m_x,
55 (real *) rhs_m_y, (real *) rhs_m_z, (real *) rhs_E,
56 (real *) visc_rho, (real *) visc_m_x,
57 (real *) visc_m_y, (real *) visc_m_z, (real *) visc_E,
58 (real *) Binv, (real *) h1, *n);
59 HIP_CHECK(hipGetLastError());
60 }
61
62 void inviscid_res_part_mx_flux_hip(void *f_x, void *f_y, void *f_z,
63 void *m_x, void *m_y, void *m_z,
64 void *rho_field, void *p, int *n) {
65
66 const dim3 nthrds(1024, 1, 1);
67 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
68
69 hipLaunchKernelGGL(HIP_KERNEL_NAME( inviscid_res_part_mx_flux_kernel<real> ),
70 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
71 (real *) f_x, (real *) f_y, (real *) f_z,
72 (real *) m_x, (real *) m_y, (real *) m_z,
73 (real *) rho_field, (real *) p, *n);
74 HIP_CHECK(hipGetLastError());
75 }
76
77 void inviscid_res_part_my_flux_hip(void *f_x, void *f_y, void *f_z,
78 void *m_x, void *m_y, void *m_z,
79 void *rho_field, void *p, int *n) {
80
81 const dim3 nthrds(1024, 1, 1);
82 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
83
84 hipLaunchKernelGGL(HIP_KERNEL_NAME( inviscid_res_part_my_flux_kernel<real> ),
85 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
86 (real *) f_x, (real *) f_y, (real *) f_z,
87 (real *) m_x, (real *) m_y, (real *) m_z,
88 (real *) rho_field, (real *) p, *n);
89 HIP_CHECK(hipGetLastError());
90 }
91
92 void inviscid_res_part_mz_flux_hip(void *f_x, void *f_y, void *f_z,
93 void *m_x, void *m_y, void *m_z,
94 void *rho_field, void *p, int *n) {
95
96 const dim3 nthrds(1024, 1, 1);
97 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
98
99 hipLaunchKernelGGL(HIP_KERNEL_NAME( inviscid_res_part_mz_flux_kernel<real> ),
100 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
101 (real *) f_x, (real *) f_y, (real *) f_z,
102 (real *) m_x, (real *) m_y, (real *) m_z,
103 (real *) rho_field, (real *) p, *n);
104 HIP_CHECK(hipGetLastError());
105 }
106
107 void inviscid_res_part_E_flux_hip(void *f_x, void *f_y, void *f_z,
108 void *m_x, void *m_y, void *m_z,
109 void *rho_field, void *p, void *E,
110 int *n) {
111
112 const dim3 nthrds(1024, 1, 1);
113 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
114
115 hipLaunchKernelGGL(HIP_KERNEL_NAME( inviscid_res_part_E_flux_kernel<real> ),
116 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
117 (real *) f_x, (real *) f_y, (real *) f_z,
118 (real *) m_x, (real *) m_y, (real *) m_z,
119 (real *) rho_field, (real *) p, (real *) E, *n);
120 HIP_CHECK(hipGetLastError());
121 }
122
123 void compressible_res_part_coef_mult_hip(void *rhs_rho, void *rhs_m_x,
124 void *rhs_m_y, void *rhs_m_z,
125 void *rhs_E, void *mult, int *n) {
126 const dim3 nthrds(1024, 1, 1);
127 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
128
129 hipLaunchKernelGGL(HIP_KERNEL_NAME( compressible_res_part_coef_mult_kernel<real> ),
130 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
131 (real *) rhs_rho, (real *) rhs_m_x,
132 (real *) rhs_m_y, (real *) rhs_m_z,
133 (real *) rhs_E, (real *) mult, *n);
134 HIP_CHECK(hipGetLastError());
135 }
136
137 void compressible_res_part_rk_sum_hip(void *rho, void *m_x, void *m_y,
138 void *m_z, void *E,
139 void *k_rho_i, void *k_m_x_i, void *k_m_y_i,
140 void *k_m_z_i, void *k_E_i,
141 real *dt, real *c, int *n) {
142 const dim3 nthrds(1024, 1, 1);
143 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
144
145 hipLaunchKernelGGL(HIP_KERNEL_NAME( compressible_res_part_rk_sum_kernel<real> ),
146 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
147 (real *) rho, (real *) m_x, (real *) m_y,
148 (real *) m_z, (real *) E,
149 (real *) k_rho_i, (real *) k_m_x_i, (real *) k_m_y_i,
150 (real *) k_m_z_i, (real *) k_E_i,
151 *dt, *c, *n);
152 HIP_CHECK(hipGetLastError());
153 }
154}
155
void inviscid_res_part_my_flux_hip(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)
void compressible_res_part_visc_hip(void *rhs_rho, void *rhs_m_x, void *rhs_m_y, void *rhs_m_z, void *rhs_E, void *visc_rho, void *visc_m_x, void *visc_m_y, void *visc_m_z, void *visc_E, void *Binv, void *h1, int *n)
void compressible_res_part_coef_mult_hip(void *rhs_rho, void *rhs_m_x, void *rhs_m_y, void *rhs_m_z, void *rhs_E, void *mult, int *n)
void inviscid_res_part_mx_flux_hip(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)
void inviscid_res_part_E_flux_hip(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)
void inviscid_res_part_mz_flux_hip(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)
void compressible_res_part_rk_sum_hip(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)
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ h1
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dt
__global__ void compressible_res_part_coef_mult_kernel(T *__restrict__ rhs_rho, T *__restrict__ rhs_m_x, T *__restrict__ rhs_m_y, T *__restrict__ rhs_m_z, T *__restrict__ rhs_E, const T *__restrict__ mult, const int n)
__global__ void inviscid_res_part_my_flux_kernel(T *__restrict__ f_x, T *__restrict__ f_y, T *__restrict__ f_z, const T *__restrict__ m_x, const T *__restrict__ m_y, const T *__restrict__ m_z, const T *__restrict__ rho_field, const T *__restrict__ p, const int n)
__global__ void compressible_res_part_visc_kernel(T *__restrict__ rhs_rho, T *__restrict__ rhs_m_x, T *__restrict__ rhs_m_y, T *__restrict__ rhs_m_z, T *__restrict__ rhs_E, const T *__restrict__ visc_rho, const T *__restrict__ visc_m_x, const T *__restrict__ visc_m_y, const T *__restrict__ visc_m_z, const T *__restrict__ visc_E, const T *__restrict__ Binv, T *__restrict__ h1, const int n)
__global__ void inviscid_res_part_mz_flux_kernel(T *__restrict__ f_x, T *__restrict__ f_y, T *__restrict__ f_z, const T *__restrict__ m_x, const T *__restrict__ m_y, const T *__restrict__ m_z, const T *__restrict__ rho_field, const T *__restrict__ p, const int n)
__global__ void compressible_res_part_rk_sum_kernel(T *__restrict__ rho, T *__restrict__ m_x, T *__restrict__ m_y, T *__restrict__ m_z, T *__restrict__ E, const T *__restrict__ k_rho_i, const T *__restrict__ k_m_x_i, const T *__restrict__ k_m_y_i, const T *__restrict__ k_m_z_i, const T *__restrict__ k_E_i, const T dt, const T c, const int n)
__global__ void inviscid_res_part_E_flux_kernel(T *__restrict__ f_x, T *__restrict__ f_y, T *__restrict__ f_z, const T *__restrict__ m_x, const T *__restrict__ m_y, const T *__restrict__ m_z, const T *__restrict__ rho_field, const T *__restrict__ p, const T *__restrict__ E, const int n)
__global__ void inviscid_res_part_mx_flux_kernel(T *__restrict__ f_x, T *__restrict__ f_y, T *__restrict__ f_z, const T *__restrict__ m_x, const T *__restrict__ m_y, const T *__restrict__ m_z, const T *__restrict__ rho_field, const T *__restrict__ p, const int n)
double real
void * glb_cmd_queue
#define HIP_CHECK(err)
Definition check.h:8