Skip to content

Commit 7b75ef0

Browse files
committed
fixing smallscale runtime issue that generated unnecessary FFT plans with dimensions under 3
1 parent 8ca46e8 commit 7b75ef0

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/ds.cu

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ void generate_plan_other3d(cufftHandle *plan_fft1d, Grid &par, int axis){
9191

9292
if(result != CUFFT_SUCCESS){
9393
printf("Result:=%d\n",result);
94-
printf("Error: Could not execute cufftPlan3d(%s ,%d ,%d ).\n",
95-
"plan_1d", (unsigned int)xDim, (unsigned int)yDim);
94+
printf("Error: Could not execute cufftPlan3d(%s, %d, %d, %d).\n",
95+
"plan_3d", (unsigned int)xDim, (unsigned int)yDim,
96+
(unsigned int)zDim);
9697
exit(1);
9798
}
9899

src/init.cu

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,15 @@ int init(Grid &par){
309309
(unsigned int)xDim, (unsigned int)yDim);
310310
exit(1);
311311
}
312-
generate_plan_other2d(&plan_other2d, par);
313312

314313
generate_plan_other3d(&plan_1d, par, 0);
315-
generate_plan_other3d(&plan_dim2, par, 1);
316-
generate_plan_other3d(&plan_dim3, par, 2);
314+
if (dimnum == 2){
315+
generate_plan_other3d(&plan_dim2, par, 1);
316+
}
317+
if (dimnum == 3){
318+
generate_plan_other3d(&plan_dim3, par, 2);
319+
generate_plan_other2d(&plan_other2d, par);
320+
}
317321
result = cufftPlan3d(&plan_3d, xDim, yDim, zDim, CUFFT_Z2Z);
318322
if(result != CUFFT_SUCCESS){
319323
printf("Result:=%d\n",result);
@@ -526,7 +530,6 @@ void set_variables(Grid &par, bool ev_type){
526530

527531
// Special variables / instructions for 2/3d case
528532
if (dimnum > 1 && !par.bval("Ay_time")){
529-
pAy_gpu = par.cufftDoubleComplexval("pAy_gpu");
530533
EpAy = par.cufftDoubleComplexval("EpAy");
531534
err=cudaMemcpy(pAy_gpu, EpAy, sizeof(cufftDoubleComplex)*gsize,
532535
cudaMemcpyHostToDevice);
@@ -538,7 +541,6 @@ void set_variables(Grid &par, bool ev_type){
538541
}
539542

540543
if (dimnum > 2 && !par.bval("Az_time")){
541-
pAz_gpu = par.cufftDoubleComplexval("pAz_gpu");
542544
EpAz = par.cufftDoubleComplexval("EpAz");
543545
err=cudaMemcpy(pAz_gpu, EpAz, sizeof(cufftDoubleComplex)*gsize,
544546
cudaMemcpyHostToDevice);

0 commit comments

Comments
 (0)