Output are ZEROs after cufftExecC2C

Hi all,

I am using cufftExecC2C for a FFT. The input is a cufftComplex array with random generated x and y elements. However, the outputs are all ZEROs except the 0th element. Could someone help?

threadsPerBlock.x = 512;
numBlocks.x = 4;
numBlocks.y = 256;

const int rank = 1;
int n[rank] = { res_axis };
cufftPlanMany(&cufftPlan, rank, n,
NULL, 1, 2048,
NULL, 1, 2048,
CUFFT_C2C, 256);

cufftExecC2C(cufftPlan, tempComplex, tempComplex, CUFFT_FORWARD);
// Where tempComplex is a 1D random cufftComplex array with length of 2048 * 256
cudaDeviceSynchronize();

printf("%e\n", tempComplex[0].x);
printf("%e\n", tempComplex[0].y);
printf("%e\n", tempComplex[1].x);
printf("%e\n", tempComplex[1].y);
printf("%e\n", tempComplex[22110].x);
printf("%e\n", tempComplex[22110].y);

Results:
4.166942e+05
4.525892e+05
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00

It’s very hard to help without actual code, but I think your plan creation is incorrect.
I think you need
cufftPlanMany(&cufftPlan, rank, {2048}, {0}, 1, 2048, {0}, 1, 2048, CUFFT_C2C, 256);

Also, it’s not clear what res_axis equals.

Example here cufft_examples/cufftMalloc.h at master · mnicely/cufft_examples · GitHub

Hi mnicely,

Thanks for your reply. I think I might have something wrong on initializing the input at host and GPU. I am checking this and will post the codes here.

Thanks a lot.