# cufftPlanMany R2C advanced layout problem

Hi,
I’m trying to do a 1D batched FFT on real valued data, with the 4.1 SDK.
The data is in column major order: a0a1,…a511, b0,b1,b2,…b511,… and I want FFT to operate on the batches:
(a0,b0,c0,…), (a1,b1,c1,…), …
The length of each row is 512, and the FFT size is 64, so I want 512 batches of a 64 point FFT.

The FFT plan goes like this:
int n = {NUMBER_OF_CHANNELS};
cufftResult_t r = cufftPlanMany(&IFFT_plan, 1, n, NULL, //rank, SIZE , inmbed,
512, 1 , NULL, //istride, idist, ombed,
1, (64/2) + 1, //ostride, odist,
CUFFT_R2C, 512); //type, batch_size
I execute the FFT like this:
cufftExecR2C(IFFT_plan, RealInputData, ComplexOutputData);

But the output data doesn’t make sense.
Am I doing anything wrong??
Is cufftPlanMany supposed to work for R2C with the advanced layout format?
Thanks!!

Try some tests:

– make forward and then back to check that you get the same result

– make the forward fourier of a periodic function for which you know the results, cos or sin should give only 2 peaks

– try to make a discrete laplacian (f(i+1)+f(i-1)-2*f(i)/dx^2 , both real and k space and check the result is correct

One should never start using a new fft library without checking these.

Hi, thanks for the advice, but there still seems to be a problem.

For the input of an impulse function, where only a0=1 and all the rest are zero,

I get non zero values at more than the first 33 outputs, but since only one column had non zero data this doesn’t make sense.

Has anyone successfully used a 1d R2C cufftPlanMany?

Is this a mistake of mine, or is it a cuFFT bug?

I do not think there this kind of bug in the cufft. You need to check how the data is kept in the memory. It is an usual problem which appears on the forum. This why you need to do the first test which should give back the same data multiply by the system size. Check again the documentation of the cufft library and try to find some example which works and start from there.