Neko 1.99.1
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 * h,
44 void *lap_sol, real *c_avisc, 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 *) h,
53 *c_avisc, *n);
55 }
56
57 void euler_res_part_mx_flux_hip(void *f_x, void *f_y, void *f_z,
58 void *m_x, void *m_y, void *m_z,
59 void *rho_field, void *p, int *n) {
60
61 const dim3 nthrds(1024, 1, 1);
62 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
63
65 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
66 (real *) f_x, (real *) f_y, (real *) f_z,
67 (real *) m_x, (real *) m_y, (real *) m_z,
68 (real *) rho_field, (real *) p, *n);
70 }
71
72 void euler_res_part_my_flux_hip(void *f_x, void *f_y, void *f_z,
73 void *m_x, void *m_y, void *m_z,
74 void *rho_field, void *p, int *n) {
75
76 const dim3 nthrds(1024, 1, 1);
77 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
78
80 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
81 (real *) f_x, (real *) f_y, (real *) f_z,
82 (real *) m_x, (real *) m_y, (real *) m_z,
83 (real *) rho_field, (real *) p, *n);
85 }
86
87 void euler_res_part_mz_flux_hip(void *f_x, void *f_y, void *f_z,
88 void *m_x, void *m_y, void *m_z,
89 void *rho_field, void *p, int *n) {
90
91 const dim3 nthrds(1024, 1, 1);
92 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
93
95 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
96 (real *) f_x, (real *) f_y, (real *) f_z,
97 (real *) m_x, (real *) m_y, (real *) m_z,
98 (real *) rho_field, (real *) p, *n);
100 }
101
102 void euler_res_part_E_flux_hip(void *f_x, void *f_y, void *f_z,
103 void *m_x, void *m_y, void *m_z,
104 void *rho_field, void *p, void *E,
105 int *n) {
106
107 const dim3 nthrds(1024, 1, 1);
108 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
109
111 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
112 (real *) f_x, (real *) f_y, (real *) f_z,
113 (real *) m_x, (real *) m_y, (real *) m_z,
114 (real *) rho_field, (real *) p, (real *) E, *n);
116 }
117
119 void *rhs_m_y, void *rhs_m_z,
120 void *rhs_E, void *mult, int *n) {
121 const dim3 nthrds(1024, 1, 1);
122 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
123
125 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
126 (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_hip(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
141 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
142 (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
__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:72
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 *h, void *lap_sol, real *c_avisc, 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:57
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:87
#define HIP_CHECK(err)
Definition check.h:8