I am trying to perform a 1D FFT of a 2D array in the row dimension using the cufft MakePlanMany() function. Unfortunately when I make the call to cufftMakePlanMany it is causing a segmentation fault. I am new to C programming and CUDA so I could be making a dumb mistake. I am trying to follow the code example in this StackOverflow answer. My data (phd) is stored in row-major contiguous memory. Below is my code:
void bpGPU (float *phd, float *complex_image, int Nfft, int NumSamples){
cufftHandle plan;
cufftComplex *d_in, *d_out;
int ds = sizeof(cufftComplex);
ds = Nfft * NumSamples;
cuMemAlloc((void**)&d_in, ds);
cuMemAlloc((void**)&d_out, ds);
int rank=1;
int n = { Nfft };
int inembed[] = {0};
int onembed[] = {0};
int istride = 1, ostride = 1;
int idist = NumSamples, odist = NumSamples;
int batch = Nfft * NumSamples;
cufftPlanMany(&plan, rank, n, inembed, istride, idist, onembed, ostride, odist, CUFFT_C2C, batch);
...
}
I placed print statements before and after the cufftPlanMany so I know that is where the segmentation fault is occurring. Any help will be appreciated.