I am fairly new to the CUDA programming environment and need some help with a current issue i couldn’t resolve. This is a extract from a larger program to duplicate the issue, it gives a segfault error and I have no idea where.
#include <cstdlib>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <iostream>
#include <exception>
#include <cufft.h>
using namespace std;
int main(int argc, char** argv){
//prepare the fft
int N = 4096;
cufftHandle plan;
cufftComplex *output;
cufftHandle plan2;
cufftComplex *output2;
float * ppf_out1_d;
cudaMalloc((void **) &ppf_out1_d,N*sizeof(float));
cudaDeviceSynchronize();
float * ppf_out2_d;
cudaMalloc((void **) &ppf_out2_d,N*sizeof(float));
cudaDeviceSynchronize();
cudaMalloc((void **) &output, ((N/2)+1)*sizeof(cufftComplex));
cudaDeviceSynchronize();
cudaMalloc((void **) &output2, ((N/2)+1)*sizeof(cufftComplex));
cudaDeviceSynchronize();
cout << "FFT1";
cufftPlan1d(&plan, N, CUFFT_R2C, 1);
cout << "FFT2";
cudaDeviceSynchronize();
cufftPlan1d(&plan2, N, CUFFT_R2C, 1);
cufftExecR2C(plan,(cufftReal *) ppf_out1_d,(cufftComplex *) output);
//synchronize
cudaDeviceSynchronize();
cufftExecR2C(plan2,(cufftReal *) ppf_out2_d,(cufftComplex *) output);
cudaDeviceSynchronize();
cufftDestroy(plan);
cufftDestroy(plan2);
}
~
If the plan2 part is deleted the program runs.
I am running the newest driver and compiler.
Any help will be greatly appreciated.