问题
I'm trying to use CUDA FFT aka cufft library
Problem occured when cufftPlan1d(..) throws an exception.
#define NX 256
#define BATCH 10
cufftHandle plan;
cufftComplex *data;
cudaMalloc((void**)&data, sizeof(cufftComplex)*NX*BATCH);
if (cudaGetLastError() != cudaSuccess){
fprintf(stderr, "Cuda error: Failed to allocate\n");
return;
}
if (cufftPlan1d(&plan, NX, CUFFT_C2C, BATCH) != CUFFT_SUCCESS){
fprintf(stderr, "CUFFT error: Plan creation failed");
return;
}
When the copiler hit the cufftPlan1d command, the output window on VS08 comes up with the following:
first chance expection at 0x75af9617 in CudaFFTProject.exe Microsoft C++ exception: cufftResult_t at memory locatoin 0x002df99c..
Help would be appreciated
Cheers
回答1:
The error comes from disorder in include files and linker input file (not sure which one of them)
My personal computer include cuda toolkit 4.2 and cuda toolkit 5 installation.
in VS08, Project properties,
Additional include use "$(CUDA_PATH_V4_2)\include" instead of $(CUDA_INC_PATH)
Linker --> additional library directory --> use "(CUDA_PATH_V4_2)\lib\win32" instead of $(CUDA_LIB_PATH)
Thanks for help ... :)
来源:https://stackoverflow.com/questions/15545442/cuda-fft-exception