CUFFT_INVALID_PLAN error Error on using CUFFT

I am executing the following program and the program compiles and links correctly. But on execution I get the following error. I believe I have used the signal size as the argument in cufftExecC2C and not the data size. Any help is much appreciated.

#include <stdio.h>

#include <assert.h>

#include <cuda.h>

#include <cufft.h>

#define NX 256

#define BATCH 10

int main(void)

{

cufftComplex *h_data, *data;

int i;

cufftHandle plan;

h_data=(cufftComplex ) malloc(NXBATCH*sizeof(cufftComplex));

cudaMalloc((void**)&data, sizeof(cufftComplex)NXBATCH);

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

//data=(cufftComplex *) data;

for(i=0;i<NX*BATCH;i++)

(h_data+i)->x=1.0f;

cudaMemcpy(data, h_data, NXBATCHsizeof(cufftComplex),cudaMemcpyHostToDevice);

cufftExecC2C(plan, data, data, CUFFT_FORWARD);

cudaMemcpy(h_data, data, NXBATCHsizeof(cufftComplex), cudaMemcpyDeviceToHost);

printf(“After Transform:\n”);

for (i=0;i<NX*BATCH;i+=NX)

printf("Real=%lf Complex=%lf\n", (h_data+i)->x, (h_data+i+1)->y);

cufftExecC2C(plan, data, data, CUFFT_INVERSE);

printf(“After Inverse Transform:\n”);

for (i=0;i<NX*BATCH;i+=NX)

printf("Real=%lf Complex=%lf\n", (h_data+i)->x, (h_data+i+1)->y);

}

I am sure I am missing out something but after trying for a very long time I am not able to spot my mistake.

Thanks,

Guru

Leaving away the printed input and output I get the following error:
cufft: ERROR: /root/cuda-stuff/sw/rel/gpgpu/toolkit/r2.2/cufft/src/cufft.cu, line 143
cufft: ERROR: CUFFT_INVALID_PLAN

P. S : I also dint do the last cudaMemcpy() before printing out the Inverse transformed data and I believe this is irrelevant to the error I get.

Eagerly awaiting some help!!

Thanks,
Guru

Your code compiles and runs without problems on my system.
Are you sure you’re using the right SDK version/driver version combo?

N.

Hi Nico,

      Thanks for your reply! It compiles and runs perfectly in the emulation mode, but only when i do it directly on the device I get the error.  I can get other programs run correctly on the device without any problems.  But I get the error if I run any program related to FFT.  The simpleCUFFT example given gives the following error.  

cufftSafeCall() CUFFT error in file <simpleCUFFT.cu>, line 124.

Thanks,

Guru

Hence my question: Are you sure you’re using the right SDK version/driver version combo? :)

N.

Nico,
I am using the CUDA 2.2 SDK toolkit and the 180.11 Nvidia Driver. I can get other examples working in the Release mode. Only the FFT examples are not working. I am using the GTX 275 card for which there is no supported driver for 64 bit linux by NVIDIA.

Thanks,
Guru

Huh? I’m using the 185.18.14 driver in 64-bit ubuntu. Which linux distribution do you have?

N.

I am using Ubuntu 8.10. I got the driver information from the nvidia-settings command. If I should be doing something else to get the driver version please let me know.

Thanks,

Guru

You can download the driver here.

N.

Thanks Nico. Will try changing my driver. Initially I had problems with the driver. But after some changes everything seemed to work correctly. Will check with this driver.

Thanks a lot for your help!
Guru