naibaf7 / caffe

Caffe: a fast open framework for deep learning. With OpenCL and CUDA support.
http://caffe.berkeleyvision.org/
Other
85 stars 20 forks source link

cmake/Cuda.cmake: properly spell '-std c++11' nvcc flag and do not repeat it twice in overlapping conditionals #42

Closed intelfx closed 7 years ago

intelfx commented 7 years ago

I can't test this locally because the build still fails in obscure toolchain internals (CUDA 7.5 / gcc 5.4), but at least nvcc does not complain about repeated -std flag.

Note that changing form of -std=c++11 to -std c++11 is crucial because FindCUDA.cmake machinery fails to check for the -std=c++11 form in user-passed flags and hence appends its own flag, which chokes nvcc. (Who on Earth did decide to consider repeated flags as fatal errors?...)

naibaf7 commented 7 years ago

@intelfx Hm interesting, I never ran into a problem with this. Is it also a problem on the main branch of Caffe?

intelfx commented 7 years ago

No, it isn't because they don't use c++11.

naibaf7 commented 7 years ago

Ok, but if the user-passed flag is not set to -std=c++11 then will -std c++11 (alternative form) also work? Never actually seen this being used before, I'll need to do some testing then.

What are the specifications of your system (other than CUDA 7.5 and GCC 5.4)?

intelfx commented 7 years ago

FindCUDA.cmake does the following check: if host C++ flags have -std=c++11 but user-passed nvcc flags do not have -std c++11, then -std c++11 is appended to nvcc flags.

This is CMake 3.6.1, gcc 5.4.0 (normally I have gcc 6.1.1, but CUDA does not like it), CUDA 7.5.18... what else? I'm using fully updated Arch, so for other versions just head to https://packages.archlinux.org.

naibaf7 commented 7 years ago

Ok thanks.