1

我正在尝试在调试模式、VS2013 社区、x64 中构建使用 caffe 的 C++ 应用程序。为了能够构建不需要 cuda 运行的版本,我添加到包装的每个 .cu 文件中,如下所示:

#ifndef CPU_ONLY
// .cu file contents
#endif

该项目在 CPU_ONLY 模式下构建并运行良好。取消定义 CPU_ONLY 标志,项目在发布模式下构建并运行正常,但在调试中,尝试编译 *.cu 文件时出现以下错误:

Compiling CUDA source file ..\..\src\caffe\layers\base_data_layer.cu...
>  
>  >COMMAND
>  nvcc fatal   : Stray '"' character in command line
COMMAND  exited with code 1.

其中 COMMAND 是下面的 nvcc 编译器调用命令,为便于阅读而换行。

"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\bin\nvcc.exe"         
-gencode=arch=compute_30,code=\" sm_30,compute_30\" 
--use-local-env 
--cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64"  
-I"C:\Users\username\Downloads\liblinear-1.8\liblinear-1.8" 
-I"C:\Users\username\Downloads\poco-1.6.0\Foundation\include" 
-I"C:\Users\username\Downloads\poco-1.6.0\Net\include" 
-IC:\opencv_gpu\include -I"C:\Users\username\Downloads\caffe-master\src" 
-I"C:\Users\username\Downloads\caffe-master\include" 
-IC:\local\boost_1_56_0 -I"C:\Users\username\Downloads\caffe-master\3rdparty\include\openblas" 
-I"C:\Users\username\Downloads\caffe-master\3rdparty\include\lmdb" 
-I"C:\Users\username\Downloads\caffe-master\3rdparty\include\leveldb" 
-I"C:\Users\username\Downloads\caffe-master\3rdparty\include\hdf5" 
-I"C:\Users\username\Downloads\caffe-master\3rdparty\include\google" 
-I"C:\Users\username\Downloads\caffe-master\3rdparty\include\glog" 
-I"C:\Users\username\Downloads\caffe-master\3rdparty\include\gflags" 
-I"C:\Users\username\Downloads\caffe-master\3rdparty\include" 
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include" 
-I"C:\Users\username\Downloads\cudnn-6.5-win-R1" 
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include"  
-G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile 
-cudart static  -g   -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DWIN32 -D_DEBUG -D_CONSOLE -D_LIB -D_UNICODE -DUNICODE 
-Xcompiler "/EHsc /W0 /nologo /Od /Zi /RTC1 /MDd  " 
-o x64\Debug\base_data_layer.cu.obj "C:\Users\username\Downloads\caffe-master\src\caffe\layers\base_data_layer.cu"

在添加 CPU_ONLY 标志之前,该项目能够在调试模式下成功构建。有任何想法吗?

4

1 回答 1

2

原来这是一个错字。在项目属性->调试->CUDA C/C++->设备中,而不是 compute_30,sm_30

我有

`compute_30, sm_30`

也就是说,带有空格分隔符。

于 2015-05-12T09:33:06.513 回答