2013-02-11 141 views
2

我不希望整個VS安裝,特別是因爲它會佔用我大部分的C空間,所以我抓住了SDK。我也安裝了cuda SDK。我遇到一個相當荒謬的問題,但:從命令行編譯cuda - win32

d:\cuda\class>nvcc --cubin unit1-1.cu 
unit1-1.cu 
unit1-1.cu 
tmpxft_00001224_00000000-5_unit1-1.cudafe1.gpu 
tmpxft_00001224_00000000-11_unit1-1.cudafe2.gpu 
'nvopencc' is not recognized as an internal or external command, 
operable program or batch file. 

d:\cuda\class>nvopencc 
nvopencc: no input files 
For general help: nvopencc --help 
To search help: nvopencc -help:<string> 

它說nvopencc是不是一個有效的命令,但我可以運行它!任何人都有任何想法如何解決這個問題?我在某處發現了一個命令--cubin,並希望它能起作用......我不知道它是否應該在那裏。無論如何,無論有沒有我得到相同的錯誤。

+0

不是那麼荒謬......它只是表示nvcc.e xe在搜索編譯器二進制文件時未使用該路徑。 – 2013-02-11 01:37:36

回答

4

下面是對Visual Studio 2010生成的nvcc.exe的典型調用。看起來您需要指定編譯器二進制文件的位置。

nvcc.exe -gencode = ARCH = compute_30,代碼= \ 「sm_30,compute_30 \」 --use-局部ENV 2010 --cl版本-ccbin「C:\ Program Files文件(86) \ Microsoft Visual Studio 10.0 \ VC \ bin「 -I」\ C \ common \ inc「-I」C:\ Program Files \ NVIDIA GPU計算工具包\ CUDA \ v5.0 \ include「-I」C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v5.0 \ include「--keep --keep-dir」Release「-maxrregcount = 0 --machine 32 --compile -D_MBCS -Xcompiler」/ EHsc/W3/nologo/O2/Zi/MD「-o」Release \ kernel.cu.obj「」c:\ test_cuda \ test_cuda \ kernel.cu「

+0

--use-local-env是必需的組件。它需要--cl版本。其餘的似乎沒有必要。儘管我會接受這個答案。 – 2013-02-11 01:46:34

+1

對我來說它有效:'nvcc hello_world.cu --use-local-env --cl-version 2010' – 2014-07-15 08:14:41