Neko 1.99.2
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
euler_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
39#include "euler_res_kernel.h"
40
41extern "C" {
42
43 void euler_res_part_visc_hip(void *rhs, void *Binv, void *lap_sol,
44 void *effective_visc, int *n) {
45
46 const dim3 nthrds(1024, 1, 1);
47 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
48
50 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
51 (real *) rhs, (real *) Binv,
52 (real *) lap_sol, (real *) effective_visc, *n);
54 }
55
56 void euler_res_part_mx_flux_hip(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
64 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
65 (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_hip(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
79 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
80 (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_hip(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
94 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
95 (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_hip(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
110 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
111 (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 const dim3 nthrds(1024, 1, 1);
121 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
122
124 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
125 (real *) rhs_rho, (real *) rhs_m_x,
126 (real *) rhs_m_y, (real *) rhs_m_z,
127 (real *) rhs_E, (real *) mult, *n);
129 }
130
131 void euler_res_part_rk_sum_hip(void *rho, void *m_x, void *m_y,
132 void *m_z, void *E,
133 void *k_rho_i, void *k_m_x_i, void *k_m_y_i,
134 void *k_m_z_i, void *k_E_i,
135 real *dt, real *c, int *n) {
136 const dim3 nthrds(1024, 1, 1);
137 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
138
140 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
141 (real *) rho, (real *) m_x, (real *) m_y,
142 (real *) m_z, (real *) E,
143 (real *) k_rho_i, (real *) k_m_x_i, (real *) k_m_y_i,
144 (real *) k_m_z_i, (real *) k_E_i,
145 *dt, *c, *n);
147 }
148}
149
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dt
__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_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)
Definition euler_res.hip:71
void euler_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 euler_res_part_visc_hip(void *rhs, void *Binv, void *lap_sol, void *effective_visc, int *n)
Definition euler_res.hip:43
void euler_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 euler_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)
Definition euler_res.hip:56
void euler_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)
void euler_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)
Definition euler_res.hip:86
#define HIP_CHECK(err)
Definition check.h:8