Neko 1.99.11
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
rhs_maker.hip
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
35#include <hip/hip_runtime.h>
37#include <device/hip/check.h>
38
39#include "sumab_kernel.h"
40#include "makeext_kernel.h"
41#include "makebdf_kernel.h"
42#include "makeoifs_kernel.h"
43
44extern "C" {
45 void rhs_maker_sumab_hip(void *u, void *v, void *w,
46 void *uu, void *vv, void *ww,
47 void *ulag1, void *ulag2, void *vlag1,
48 void *vlag2, void *wlag1, void *wlag2,
49 real *ab1, real *ab2, real *ab3, int *nab, int *n) {
50
51 const dim3 nthrds(1024, 1, 1);
52 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
53
54
55 hipLaunchKernelGGL(HIP_KERNEL_NAME( sumab_kernel<real> ),
56 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
57 (real *) u, (real *) v, (real *) w,
58 (real *) uu, (real *) vv, (real *) ww,
59 (real *) ulag1, (real *) ulag2, (real *) vlag1,
60 (real *) vlag2, (real *) wlag1, (real *) wlag2,
61 *ab1, *ab2, *ab3, *nab, *n);
62 HIP_CHECK(hipGetLastError());
63 }
64
65 void rhs_maker_ext_hip(void *abx1, void *aby1, void *abz1,
66 void *abx2, void *aby2, void *abz2,
67 void *bfx, void *bfy, void *bfz,
68 real *rho, real *ab1, real *ab2, real *ab3, int *n) {
69
70 const dim3 nthrds(1024, 1, 1);
71 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
72
73 hipLaunchKernelGGL(HIP_KERNEL_NAME( makeext_kernel<real> ),
74 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
75 (real *) abx1, (real *) aby1, (real *) abz1,
76 (real *) abx2, (real *) aby2, (real *) abz2,
77 (real *) bfx, (real *) bfy, (real *) bfz,
78 *rho, *ab1, *ab2, *ab3, *n);
79 HIP_CHECK(hipGetLastError());
80 }
81
82 void scalar_rhs_maker_ext_hip(void *fs_lag, void *fs_laglag, void *fs,
83 real *ext1, real *ext2, real *ext3, int *n) {
84
85 const dim3 nthrds(1024, 1, 1);
86 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
87
88 hipLaunchKernelGGL(HIP_KERNEL_NAME( scalar_makeext_kernel<real> ),
89 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
90 (real *) fs_lag, (real *) fs_laglag, (real *) fs,
91 *ext1, *ext2, *ext3, *n);
92 HIP_CHECK(hipGetLastError());
93 }
94
95 void rhs_maker_bdf_hip(void *ulag1, void *ulag2, void *vlag1,
96 void *vlag2, void *wlag1, void *wlag2,
97 void *bfx, void *bfy, void *bfz,
98 void *u, void *v, void *w, void *B,
99 void *Blag, void *Blaglag,
100 real *rho, real *dt, real *bd2,
101 real *bd3, real *bd4, int *nbd, int *n) {
102
103 const dim3 nthrds(1024, 1, 1);
104 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
105
106 hipLaunchKernelGGL(HIP_KERNEL_NAME( makebdf_kernel<real> ),
107 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
108 (real *) ulag1, (real *) ulag2, (real *) vlag1,
109 (real *) vlag2, (real *) wlag1, (real *) wlag2,
110 (real *) bfx, (real *) bfy, (real *) bfz,
111 (real *) u, (real *) v, (real *) w, (real *) B,
112 (real *) Blag, (real *) Blaglag,
113 *rho, *dt, *bd2, *bd3, *bd4, *nbd, *n);
114 HIP_CHECK(hipGetLastError());
115 }
116
117 void scalar_rhs_maker_bdf_hip(void *s_lag, void *s_laglag, void *fs,
118 void *s, void *B, void *rho_cp, real *dt,
119 real *bd2, real *bd3, real *bd4,
120 int *nbd, int *n) {
121
122 const dim3 nthrds(1024, 1, 1);
123 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
124
125 hipLaunchKernelGGL(HIP_KERNEL_NAME( scalar_makebdf_kernel<real> ),
126 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
127 (real *) s_lag, (real *) s_laglag, (real *) fs,
128 (real *) s, (real *) B, (real *) rho_cp, *dt,
129 *bd2, *bd3, *bd4, *nbd, *n);
130 HIP_CHECK(hipGetLastError());
131 }
132
133 void rhs_maker_oifs_hip(void *phi_x, void *phi_y, void *phi_z,
134 void *bf_x, void *bf_y, void *bf_z,
135 real *rho, real *dt, int *n) {
136
137 const dim3 nthrds(1024, 1, 1);
138 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
139
140 hipLaunchKernelGGL(HIP_KERNEL_NAME( makeoifs_kernel<real> ),
141 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
142 (real *) phi_x, (real *) phi_y, (real *) phi_z,
143 (real *) bf_x, (real *) bf_y, (real *) bf_z,
144 *rho, *dt, *n);
145 HIP_CHECK(hipGetLastError());
146 }
147
148 void scalar_rhs_maker_oifs_hip(void *phi_s, void *bf_s,
149 void *rho_cp, real *dt, int *n) {
150
151 const dim3 nthrds(1024, 1, 1);
152 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
153
154 hipLaunchKernelGGL(HIP_KERNEL_NAME( scalar_makeoifs_kernel<real> ),
155 nblcks, nthrds, 0, (hipStream_t) glb_cmd_queue,
156 (real *) phi_s, (real *) bf_s,
157 (real *) rho_cp, *dt, *n);
158 HIP_CHECK(hipGetLastError());
159 }
160}
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ w
__global__ void 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
__global__ void makebdf_kernel(const T *__restrict__ ulag1, const T *__restrict__ ulag2, const T *__restrict__ vlag1, const T *__restrict__ vlag2, const T *__restrict__ wlag1, const T *__restrict__ wlag2, T *__restrict__ bfx, T *__restrict__ bfy, T *__restrict__ bfz, const T *__restrict__ u, const T *__restrict__ v, const T *__restrict__ w, const T *__restrict__ B, const T *__restrict__ Blag, const T *__restrict__ Blaglag, const T rho, const T dt, const T bd2, const T bd3, const T bd4, const int nbd, const int n)
__global__ void scalar_makebdf_kernel(const T *__restrict__ s_lag, const T *__restrict__ s_laglag, T *__restrict__ fs, const T *__restrict__ s, const T *__restrict__ B, const T *__restrict__ rho_cp, const T dt, const T bd2, const T bd3, const T bd4, const int nbd, const int n)
__global__ void scalar_makeext_kernel(T *__restrict__ fs_lag, T *__restrict__ fs_laglag, T *__restrict__ fs, const T ext1, const T ext2, const T ext3, const int n)
__global__ void makeext_kernel(T *__restrict__ abx1, T *__restrict__ aby1, T *__restrict__ abz1, T *__restrict__ abx2, T *__restrict__ aby2, T *__restrict__ abz2, T *__restrict__ bfx, T *__restrict__ bfy, T *__restrict__ bfz, const T rho, const T ab1, const T ab2, const T ab3, const int n)
__global__ void makeoifs_kernel(const T *__restrict__ phi_x, const T *__restrict__ phi_y, const T *__restrict__ phi_z, T *__restrict__ bf_x, T *__restrict__ bf_y, T *__restrict__ bf_z, const T rho, const T dt, const int n)
__global__ void scalar_makeoifs_kernel(const T *__restrict__ phi_s, T *__restrict__ bf_s, const T *__restrict__ rho_cp, const T dt, const int n)
__global__ void sumab_kernel(T *__restrict__ u, T *__restrict__ v, T *__restrict__ w, const T *__restrict__ uu, const T *__restrict__ vv, const T *__restrict__ ww, const T *__restrict__ ulag1, const T *__restrict__ ulag2, const T *__restrict__ vlag1, const T *__restrict__ vlag2, const T *__restrict__ wlag1, const T *__restrict__ wlag2, const T ab1, const T ab2, const T ab3, const int nab, const int n)
double real
void * glb_cmd_queue
#define HIP_CHECK(err)
Definition check.h:8
void rhs_maker_bdf_hip(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.hip:95
void scalar_rhs_maker_ext_hip(void *fs_lag, void *fs_laglag, void *fs, real *ext1, real *ext2, real *ext3, int *n)
Definition rhs_maker.hip:82
void rhs_maker_sumab_hip(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.hip:45
void scalar_rhs_maker_oifs_hip(void *phi_s, void *bf_s, void *rho_cp, real *dt, int *n)
void rhs_maker_ext_hip(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.hip:65
void scalar_rhs_maker_bdf_hip(void *s_lag, void *s_laglag, void *fs, void *s, void *B, void *rho_cp, real *dt, real *bd2, real *bd3, real *bd4, int *nbd, int *n)
void rhs_maker_oifs_hip(void *phi_x, void *phi_y, void *phi_z, void *bf_x, void *bf_y, void *bf_z, real *rho, real *dt, int *n)