0

我正在使用这里的源代码。它是关于使用 CUDA 和 OpenCV 在 GPU 上进行背景减法的扩展 GMM。我对 CUDA 完全陌生,但在 MVS 10 中出现错误

1>d:/MVS10 Projects/CudaTest/CudaTest/CvFastBgGMM_ver5.cu(227): error : identifier "CUDA_SAFE_CALL" is undefined

1>
1> 5 errors detected in the compilation of

"C:/Users/DELL/AppData/Local/Temp/tmpxft_00000e34_00000000-5_CvFastBgGMM_ver5.cpp1.ii".
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 5.0.targets(592,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2010 -ccbin "D:\IDE\Microsoft Visual Studio 10.0\VC\bin\x86_amd64"  -I"D:\SDK\OpenCV\opencv\build\include" -I"D:\SDK\OpenCV\opencv\build\include\opencv" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include"  -G   --keep-dir "x64\Debug" -maxrregcount=0  --machine 64 --compile  -g   -DWIN32 -D_DEBUG -D_CONSOLE -D_UNICODE -DUNICODE -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd  " -o "x64\Debug\CvFastBgGMM_ver5.cu.obj" "d:\MVS10 Projects\CudaTest\CudaTest\CvFastBgGMM_ver5.cu"" exited with code 2.

我安装了 CUDA 5.0 版。我错过了什么?请帮我。谢谢!

4

1 回答 1

9

CUDA_SAFE_CALL was part of the old cutils library. The cutil library was solely for simplifying the SDK samples, and wasn't supposed to be used by the user. In CUDA 5.0 it was removed, which is why you can't find it.

Take a look at What is the canonical way to check for errors using the CUDA runtime API? to see how you should go about replacing CUDA_SAFE_CALL.

于 2013-03-31T08:52:09.050 回答