caffe2 icon indicating copy to clipboard operation
caffe2 copied to clipboard

Build errors error C2121 on Windows 10 with GPU support

Open frgfm opened this issue 7 years ago • 4 comments

Hey guys,

I've been trying to setup caffe2 on my Win10 x64 with gpu, I tried so many forums, I'm bit out of ideas. I followed the tutorial, had a first issue with the Protobuf compiler not being found. I used the fix on issue #1522 and then the build started. Bunch of warnings and some errors !

Any help would be great !! I really need to be able to use it on my laptop soon but the many issues I encountered are discouraging I must admit

System information

  • Operating system: Windows 10 x64
  • Compiler version: Visual Studio 2015
  • CMake version: 3.10.2
  • Relevant libraries/versions (e.g. CUDA): CUDA 8

Output after running build_windows.bat (only the last warnings and the errors)

"C:\Users\fgfer\caffe2\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\fgfer\caffe2\build\modules\module_test\caffe2_module_test_dynamic.vcxproj" (default target)
 (9) ->
  C:\Users\fgfer\caffe2\third_party\protobuf\src\google/protobuf/io/coded_stream.h(870): warning C480
0: 'google::protobuf::internal::AtomicWord': forcing value to bool 'true' or 'false' (performance war
ning) [C:\Users\fgfer\caffe2\build\modules\module_test\caffe2_module_test_dynamic.vcxproj]
  C:\Users\fgfer\caffe2\third_party\protobuf\src\google/protobuf/io/coded_stream.h(874): warning C480
0: 'google::protobuf::internal::Atomic64': forcing value to bool 'true' or 'false' (performance warni
ng) [C:\Users\fgfer\caffe2\build\modules\module_test\caffe2_module_test_dynamic.vcxproj]
  C:\Users\fgfer\caffe2\third_party\protobuf\src\google/protobuf/generated_message_util.h(160): warni
ng C4800: 'google::protobuf::uint32': forcing value to bool 'true' or 'false' (performance warning) [
C:\Users\fgfer\caffe2\build\modules\module_test\caffe2_module_test_dynamic.vcxproj]
  C:\Users\fgfer\caffe2\caffe2/core/operator_gradient.h(39): warning C4800: 'unsigned __int64': forci
ng value to bool 'true' or 'false' (performance warning) [C:\Users\fgfer\caffe2\build\modules\module_
test\caffe2_module_test_dynamic.vcxproj]


"C:\Users\fgfer\caffe2\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\fgfer\caffe2\build\modules\detectron\caffe2_detectron_ops_gpu.vcxproj" (default target) (7)
 ->
"C:\Users\fgfer\caffe2\build\caffe2\caffe2_gpu.vcxproj" (default target) (8) ->
(ClCompile target) ->
  C:\Users\fgfer\caffe2\caffe2\operators\conv_op_cudnn.cc(166): error C2121: '#': invalid character:
possibly the result of a macro expansion [C:\Users\fgfer\caffe2\build\caffe2\caffe2_gpu.vcxproj]
  C:\Users\fgfer\caffe2\caffe2\operators\conv_op_cudnn.cc(197): error C2121: '#': invalid character:
possibly the result of a macro expansion [C:\Users\fgfer\caffe2\build\caffe2\caffe2_gpu.vcxproj]
  C:\Users\fgfer\caffe2\caffe2\operators\conv_op_cudnn.cc(379): error C2121: '#': invalid character:
possibly the result of a macro expansion [C:\Users\fgfer\caffe2\build\caffe2\caffe2_gpu.vcxproj]
  C:\Users\fgfer\caffe2\caffe2\operators\conv_op_cudnn.cc(743): error C2121: '#': invalid character:
possibly the result of a macro expansion [C:\Users\fgfer\caffe2\build\caffe2\caffe2_gpu.vcxproj]
  C:\Users\fgfer\caffe2\caffe2\operators\recurrent_op_cudnn.cc(148): error C2121: '#': invalid charac
ter: possibly the result of a macro expansion [C:\Users\fgfer\caffe2\build\caffe2\caffe2_gpu.vcxproj]

    8904 Warning(s)
    5 Error(s)

Time Elapsed 01:27:00.74
"Caffe2 building failed"

frgfm avatar Jan 24 '18 16:01 frgfm

You can refer to #1469 for required changes when building for windows. (Or my version of changes: https://github.com/t-kuha/caffe2/commit/046b6431c751872e753a5015cb58a0b5f4e1eecd)

t-kuha avatar Jan 25 '18 04:01 t-kuha

Ongoing PR #1827 aims to address the issue for (a) no-cuda, shared or static, and (b) cuda, static cases.

CUDA + shared is currently not working very well, and the reason kindly pointed out by @willyd is DLL exported symbol limit. Still to be resolved.

Yangqing avatar Jan 28 '18 19:01 Yangqing

@t-kuha @Yangqing thanks guys, I'll wait for the fix then! In the mean time I'll try patching up some of your commits to tackle the issue with the exported symbol limit. Let me know if you need me to test a few things

Also @Yangqing, by shared you meant processor allocation between CPU & GPUs or ?

frgfm avatar Jan 28 '18 20:01 frgfm

@frgfm I beleive he means shared as in shared library or DLL.

willyd avatar Jan 29 '18 13:01 willyd