Hi all,
suppose i have an image represented by a matrix and i want to calculate the 2d FFT is this code right?
cufftReal image[10][10]; //image already initialized
cufftReal *imagedev;
cufftComplex *transdev;
cufftComplex trans[10][10];
cudaMalloc((void**)&imagedev,100*sizeof(cufftReal));
cudaMalloc((void**)&transdev,100*sizeof(cufftComplex));
int i;
for (i = 0; i < 10; i++)
cudaMemcpy(imagedev + i*10, image[i],10*sizeof(cufftReal),cudaMemcpyHostToDevice);
cufftHandle plan;
cufftPlan2d(&plan, 10,10, CUFFT_R2C);
cufftExecR2C(plan, imagedev, transdev);
for(i = 0; i <10; i++)
cudaMemcpy(trans[i], transdev + i*10,10*sizeof(cufftComplex),cudaMemcpyDeviceToHost);