0
我跟隨這名:Dynamically allocating memory inside __device/global__ CUDA kernel編譯對於計算能力2.x的在CUDA C爲VS2010
但它仍然不能編譯。
error : calling a host function("_malloc_dbg") from a __device__/__global__
function("kernel") is not allowed
error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA
\v4.1\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\"
--use-local-env --cl-version 2010 -ccbin "c:\Program Files (x86)\Microsoft Visual
Studio 10.0\VC\bin\x86_amd64" -I"..\..\..\Source\Include" -G0 --keep-dir
"x64\Debug" -maxrregcount=0 --machine 64 --compile -g -Xcompiler "/EHsc /nologo
/Od /Zi /MDd " -o "x64\Debug\move.cu.obj" "C:\Source\scene\move.cu"" exited with
code 2. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA
4.1.targets 361 10
如上所述,我加了#if __CUDA_ARCH__ >= 200
,它返回false。
還有什麼可以解決的問題?我正在使用GTX480。
編輯:我有這樣的警告,以及:#warning C4005: '_malloca' : macro redefinition
嘗試編譯而不調試設置,看看它是否有任何區別。 – talonmies 2012-01-29 20:09:11
@talonmies,我仍然有錯誤。警告(請參閱編輯)可能是一個值得關注的問題嗎? – user1007692 2012-01-29 20:30:06
在該錯誤消息中存在可疑的v4.0和v4.1混合。你確定你沒有安裝更多版本的CUDA工具包嗎? (對不起,我不使用VS,所以我不能真正幫助它的內部)。 – talonmies 2012-01-29 20:38:56