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

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);


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.