我正在使用 cufft cuda 库编写一个用于快速傅立叶变换的简单代码。我的源文件在 windows7 中的 Visual Studio 中运行良好,但在 ubuntu 14.04 中使用 eclipse nsight,无法正常工作!我已经安装了 nvidia 346.72 驱动程序和 cuda toolkit 7.0,我的视频硬件是 geforce 410M。当我构建我的源代码时,我收到以下消息:
16:56:24 **** Incremental Build of configuration Debug for project cufft_double ****
make all
Building target: cufft_double
Invoking: NVCC Linker
/usr/local/cuda-7.0/bin/nvcc --cudart static -L/usr/local/cuda-7.0/lib64 --relocatable-device-code=false -gencode arch=compute_20,code=compute_20 -gencode arch=compute_20,code=sm_20 -m64 -link -o "cufft_double" ./cufft_double.o
./cufft_double.o: In function `main':
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:79: undefined reference to `cufftPlan1d'
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:85: undefined reference to `cufftExecZ2Z'
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:108: undefined reference to `cufftDestroy'
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:111: undefined reference to `cufftPlan1d'
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:117: undefined reference to `cufftExecZ2Z'
/home/marco/cuda-workspace/cufft_double/Debug/../cufft_double.cu:136: undefined reference to `cufftDestroy'
collect2: error: ld returned 1 exit status
make: *** [cufft_double] Error 1
16:56:27 Build Finished (took 2s.792ms)
我试图设置库路径,但在首选项窗口中我读到“没有检测到与 CUDA 兼容的设备”请帮助我!最好的后卫马可
现在我可以构建源代码,但我的程序不起作用!
我读到这个错误:modprobe:错误:无法插入'nvidia_331_uvm':无效参数
如果在“cudaMalloc”之后出现“cudaGetLastError() != cudaSuccess”,我会收到一条由我编写的消息。
cudaMalloc((void**)&out_device, sizeof(cufftDoubleComplex)*NX*BATCH);
if (cudaGetLastError() != cudaSuccess){
printf("Cuda error: allocazione fallita\n");
return 0;
};