Search code examples
compilationcudanvcccaffe

caffe Debug build: stray '"' character in nvcc command


I am trying to build my C++ application that uses caffe, in Debug Mode, VS2013 community, x64. To be able to build version that do not need cuda to run, I added to wrapped each .cu file as indicated below:

#ifndef CPU_ONLY
// .cu file contents
#endif

The project was built and ran fine in CPU_ONLY mode. Undefininig the CPU_ONLY flag, the project builds and runs OK in Release mode, but in Debug, I am getting the following error when trying to compile the *.cu files:

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

Where COMMAND is the nvcc compiler call command below, newlined for readability.

"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"

The project was able to build successfully in debug mode before adding the CPU_ONLY flags. Any ideas?


Solution

  • Turns out it was a typo. In project properties->Debug->CUDA C/C++->Device, instead of compute_30,sm_30

    I had

    `compute_30, sm_30`
    

    that is, with a space separator.