Inverse FFT returns wrong value?

Hello eveyone,

Im messing with cufft, but i have a problem


global void FillArray(cufftComplex *C_d)


int idx = blockIdx.x+threadIdx.x;



extern “C” void IFFTtest()


#define NX 256

int mem_size = sizeof(Complex) * NX;

cufftHandle plan;

cufftComplex *d_F;

cufftComplex *d_odata;

Complex* h_odata = (Complex*)malloc(sizeof(Complex) * NX);

cudaMalloc((void**)&d_F, sizeof(cufftComplex)*NX);

/* Create a 1D FFT plan. */

cufftPlan1d(&plan, NX, CUFFT_C2C, 1);

FillArray <<< 1, 256 >>> (d_F);

cufftExecC2C(plan, d_F, d_F, CUFFT_INVERSE);

cutilSafeCall(cudaMemcpy(h_odata, d_F, mem_size, cudaMemcpyDeviceToHost));


cout<<“Starting output data:”<<endl;

int x;

for (unsigned int i = 0; i < NX; ++i) {




/* Destroy the CUFFT plan. */



As the output i get all Zeros except the first one which is 256

according other ifft functions i have tried it should be all zeros and the first one should be 1…

am I missing something here?

You need to normalize the results.

With cufft: ifft(fft(A))=len(A)A