2012-08-10 23 views
0

我嘗試在Visual Stuio C#中使用CUDA.NET開發表單應用程序。但我需要創建cubin文件,這裏是我的問題:CUDA.NET中的GASS.CUDA.CUResult.ErrorInvalidImage錯誤

我試圖使用Visual Studio創建cubin文件。我將項目Properties->Configuration Properties->Cuda Runtime API->GPU->NVCC Compilation Type中的設置更改爲"Generate 64 bit .cubin file (-m64 -cubin)" from "Generate hybrid object file (--compile/-c)".

但是我得到了這個錯誤"fatal error LNK1181: cannot open input file '.\Debug\histogram256.cu.obj'"。它無法找到我的一些.cu文件的對象。

因此,我只更改了那些.cu文件的'"NVCC Compilation Type"設置爲(-m64 -cubin)並通過右鍵單擊這些文件進行編譯。但它沒有創建任何.obj或.cubin文件。

然後我試着從命令行編譯它。我複製在.CU文件的Property Page->Cuda Runtime API->Command Line這是

" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --machine 32 -ccbin "c:\Program Files\Microsoft Visual Studio 9.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" -maxrregcount=0 --compile -o "Debug/device.cubin" "device.cu""

device.cu是我的CUDA文件就行了。

它創造了.cubin file,但我從CUDA.NET這個錯誤:"GASS.CUDA.CUResult.ErrorInvalidImage."

你有什麼建議嗎?

回答

2

1:確保您的viedecard支持您指定的gencode-arch和代碼。

2:你編譯的32位,確保你編譯和引用cuda.net爲32位也.net。

3:使用managedcuda(codeplex)的樣本和文檔都要好得多。