48 void *
cx,
void *
cy,
void *
cz,
52 void *
w3,
int *nel,
int *lx);
60 void *
cx,
void *
cy,
void *
cz,
64 void *
w3,
int *nel,
int *lx) {
66 static int autotune[17] = { 0 };
68 const dim3 nthrds_1d(1024, 1, 1);
69 const dim3 nthrds_kstep((*lx), (*lx), 1);
70 const dim3 nblcks((*nel), 1, 1);
74 set_convect_rst_kernel_1d<real, LX, 1024> \
75 <<<nblcks, nthrds_1d, 0, stream>>> \
76 ((real *) cr, (real *) cs, (real *) ct, \
77 (real *) cx, (real *) cy, (real *) cz, \
78 (real *) drdx, (real *) dsdx, (real *) dtdx, \
79 (real *) drdy, (real *) dsdy, (real *) dtdy, \
80 (real *) drdz, (real *) dsdz, (real *) dtdz, \
82 CUDA_CHECK(cudaGetLastError());
85#define CASE_KSTEP(LX) \
86 set_convect_rst_kernel_kstep<real, LX> \
87 <<<nblcks, nthrds_kstep, 0, stream>>> \
88 ((real *) cr, (real *) cs, (real *) ct, \
89 (real *) cx, (real *) cy, (real *) cz, \
90 (real *) drdx, (real *) dsdx, (real *) dtdx, \
91 (real *) drdy, (real *) dsdy, (real *) dtdy, \
92 (real *) drdz, (real *) dsdz, (real *) dtdz, \
94 CUDA_CHECK(cudaGetLastError());
98 if(autotune[LX] == 0 ) { \
99 autotune[LX]=tune_set_convect_rst<LX>(cr, cs, ct, \
105 } else if (autotune[LX] == 1 ) { \
107 } else if (autotune[LX] == 2 ) { \
130 fprintf(stderr, __FILE__
": size not supported: %d\n", *lx);
137template < const
int LX >
139 void *
cx,
void *
cy,
void *
cz,
143 void *
w3,
int *nel,
int *lx) {
144 cudaEvent_t start,stop;
148 const dim3 nthrds_1d(1024, 1, 1);
149 const dim3 nthrds_kstep((*lx), (*lx), 1);
150 const dim3 nblcks((*nel), 1, 1);
153 char *env_value = NULL;
154 char neko_log_buf[80];
156 env_value=getenv(
"NEKO_AUTOTUNE");
158 sprintf(neko_log_buf,
"Autotune set_convect_rst (lx: %d)", *lx);
162 if( !strcmp(env_value,
"1D") ) {
164 sprintf(neko_log_buf,
"Set by env : 1 (1D)");
168 }
else if( !strcmp(env_value,
"KSTEP") ) {
170 sprintf(neko_log_buf,
"Set by env : 2 (KSTEP)");
175 sprintf(neko_log_buf,
"Invalid value set for NEKO_AUTOTUNE");
180 cudaEventCreate(&start);
181 cudaEventCreate(&stop);
183 cudaEventRecord(start,0);
185 for(
int i = 0;
i < 100;
i++) {
189 cudaEventRecord(stop,0);
190 cudaEventSynchronize(stop);
191 cudaEventElapsedTime(&time1, start, stop);
193 cudaEventRecord(start,0);
195 for(
int i = 0;
i < 100;
i++) {
199 cudaEventRecord(stop,0);
200 cudaEventSynchronize(stop);
201 cudaEventElapsedTime(&time2, start, stop);
209 sprintf(neko_log_buf,
"Chose : %d (%s)", retval,
210 (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__ 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__ 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__ 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__ 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__ 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__ 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__ dsdx
__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__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ drdy
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ w3
__global__ void const T *__restrict__ const T *__restrict__ cr
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ cs
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ ct
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ cz
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ cx
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ cy
void log_error(char *msg)
void log_message(char *msg)
void log_section(char *msg)
int tune_set_convect_rst(void *cr, void *cs, void *ct, void *cx, void *cy, void *cz, void *drdx, void *dsdx, void *dtdx, void *drdy, void *dsdy, void *dtdy, void *drdz, void *dsdz, void *dtdz, void *w3, int *nel, int *lx)
void cuda_set_convect_rst(void *cr, void *cs, void *ct, void *cx, void *cy, void *cz, void *drdx, void *dsdx, void *dtdx, void *drdy, void *dsdy, void *dtdy, void *drdz, void *dsdz, void *dtdz, void *w3, int *nel, int *lx)