38 #include <hip/hip_runtime.h>
47 template < const
int >
49 void *
dx,
void *
dy,
void *
dz,
53 void *
jacinv,
int *nel,
int *lx);
61 void *
dx,
void *
dy,
void *
dz,
65 void *
jacinv,
int *nel,
int *lx) {
67 static int autotune[17] = { 0 };
69 const dim3 nthrds_1d(1024, 1, 1);
70 const dim3 nthrds_kstep((*lx), (*lx), 1);
71 const dim3 nblcks((*nel), 1, 1);
75 hipLaunchKernelGGL( HIP_KERNEL_NAME(lambda2_kernel_1d<real, LX, 1024> ), \
76 nblcks, nthrds_1d, 0, (hipStream_t) glb_cmd_queue, \
77 (real *) lambda2, (real *) u, (real *) v, (real *) w, \
78 (real *) dx, (real *) dy, (real *) dz, \
79 (real *) drdx, (real *) dsdx, (real *) dtdx, \
80 (real *) drdy, (real *) dsdy, (real *) dtdy, \
81 (real *) drdz, (real *) dsdz, (real *) dtdz, \
83 HIP_CHECK(hipGetLastError());
87 #define CASE_KSTEP(LX) \
88 hipLaunchKernelGGL( HIP_KERNEL_NAME(lambda2_kernel_kstep<real, LX> ), \
89 nblcks, nthrds_kstep, 0, (hipStream_t) glb_cmd_queue, \
90 (real *) lambda2, (real *) u, (real *) v, (real *) w, \
91 (real *) dx, (real *) dy, (real *) dz, \
92 (real *) drdx, (real *) dsdx, (real *) dtdx, \
93 (real *) drdy, (real *) dsdy, (real *) dtdy, \
94 (real *) drdz, (real *) dsdz, (real *) dtdz, \
96 HIP_CHECK(hipGetLastError());
100 if(autotune[LX] == 0 ) { \
101 autotune[LX]=tune_lambda2<LX>(lambda2, u, v, w, \
107 } else if (autotune[LX] == 1 ) { \
109 } else if (autotune[LX] == 2 ) { \
128 fprintf(stderr, __FILE__
": size not supported: %d\n", *lx);
135 template < const
int LX >
137 void *
dx,
void *
dy,
void *
dz,
141 void *
jacinv,
int *nel,
int *lx) {
142 hipEvent_t start,stop;
146 const dim3 nthrds_1d(1024, 1, 1);
147 const dim3 nthrds_kstep((*lx), (*lx), 1);
148 const dim3 nblcks((*nel), 1, 1);
151 char *env_value = NULL;
152 char neko_log_buf[80];
154 env_value=getenv(
"NEKO_AUTOTUNE");
156 sprintf(neko_log_buf,
"Autotune lambda2 (lx: %d)", *lx);
160 if( !strcmp(env_value,
"1D") ) {
162 sprintf(neko_log_buf,
"Set by env : 1 (1D)");
166 }
else if( !strcmp(env_value,
"KSTEP") ) {
168 sprintf(neko_log_buf,
"Set by env : 2 (KSTEP)");
173 sprintf(neko_log_buf,
"Invalid value set for NEKO_AUTOTUNE");
183 for(
int i = 0;
i < 100;
i++) {
189 HIP_CHECK(hipEventElapsedTime(&time1, start, stop));
193 for(
int i = 0;
i < 100;
i++) {
199 HIP_CHECK(hipEventElapsedTime(&time2, start, stop));
207 sprintf(neko_log_buf,
"Chose : %d (%s)", retval,
208 (retval > 1 ?
"KSTEP" :
"1D"));
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ drdy
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ drdz
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dsdz
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dsdy
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ w
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dtdy
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ u
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dx
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ drdx
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dtdz
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dsdx
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ v
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dtdx
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dz
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dy
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ jacinv
__global__ void T *__restrict__ uy
__global__ void T *__restrict__ T *__restrict__ uz
A simulation component that computes lambda2 The values are stored in the field registry under the na...
void log_error(char *msg)
void log_message(char *msg)
void log_section(char *msg)
void hip_lambda2(void *lambda2, void *u, void *v, void *w, void *dx, void *dy, void *dz, void *drdx, void *dsdx, void *dtdx, void *drdy, void *dsdy, void *dtdy, void *drdz, void *dsdz, void *dtdz, void *jacinv, int *nel, int *lx)
int tune_lambda2(void *ux, void *uy, void *uz, void *u, void *dx, void *dy, void *dz, void *drdx, void *dsdx, void *dtdx, void *drdy, void *dsdy, void *dtdy, void *drdz, void *dsdz, void *dtdz, void *jacinv, int *nel, int *lx)