BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
34.13k stars 18.68k forks source link

Compilation errors in OpenCL Branch #6482

Open skn123 opened 6 years ago

skn123 commented 6 years ago

Issue summary

Compilation fails with clang

Steps to reproduce

Cloned a fresh checkout from the OpenCL branch of Caffe. Used default CMake settings and set build to Release

Tried solutions

??

System configuration

Issue checklist

Summary of build log naths@naths-HP-Laptop-15-bs1xx:~/build/caffe$ make [ 0%] Running C++/Python protocol buffer compiler on /home/naths/srcs/caffe/src/caffe/proto/caffe.proto Scanning dependencies of target caffeproto [ 1%] Building CXX object src/caffe/CMakeFiles/caffeproto.dir///include/caffe/proto/caffe.pb.cc.o [ 1%] Linking CXX static library ../../lib/libcaffeproto.a [ 1%] Built target caffeproto [ 1%] Generating test macros source (python -> C++). [ 1%] Generating macros source (python -> C++). [ 2%] Generating layer creator source (python -> C++). [ 2%] Generating blob creator source (python -> C++). [ 2%] Generating quantizer creator source (python -> C++). Scanning dependencies of target pre_build [ 4%] Linking CXX static library ../../lib/libpre_build.a [ 4%] Built target pre_build Scanning dependencies of target caffe [ 4%] Building CXX object src/caffe/CMakeFiles/caffe.dir/backend/backend.cpp.o In file included from /home/naths/srcs/caffe/src/caffe/backend/backend.cpp:1: In file included from /home/naths/srcs/caffe/include/caffe/backend/backend.hpp:7: In file included from /home/naths/srcs/caffe/include/caffe/common.hpp:14: In file included from /home/naths/srcs/caffe/include/caffe/definitions.hpp:25: In file included from /home/naths/srcs/caffe/include/caffe/trait_helper.hpp:6: In file included from /home/naths/srcs/caffe/include/caffe/util/half_fp.hpp:5: /home/naths/srcs/caffe/include/3rdparty/half/half.hpp:1080:12: warning: class 'numeric_limits' was previously declared as a struct [-Wmismatched-tags] friend class std::numeric_limits; ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/6.4.0/../../../../include/c++/6.4.0/limits:315:12: note: previous use is here struct numeric_limits : public numeric_limits_base ^ 1 warning generated. [ 4%] Building CXX object src/caffe/CMakeFiles/caffe.dir/backend/cuda/caffe_cuda.cpp.o [ 4%] Building CXX object src/caffe/CMakeFiles/caffe.dir/backend/cuda/cuda_dev_ptr.cpp.o In file included from /home/naths/srcs/caffe/src/caffe/backend/cuda/cuda_dev_ptr.cpp:1: In file included from /home/naths/srcs/caffe/include/caffe/common.hpp:14: In file included from /home/naths/srcs/caffe/include/caffe/definitions.hpp:25: In file included from /home/naths/srcs/caffe/include/caffe/trait_helper.hpp:6: In file included from /home/naths/srcs/caffe/include/caffe/util/half_fp.hpp:5: /home/naths/srcs/caffe/include/3rdparty/half/half.hpp:1080:12: warning: class 'numeric_limits' was previously declared as a struct [-Wmismatched-tags] friend class std::numeric_limits; ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/6.4.0/../../../../include/c++/6.4.0/limits:315:12: note: previous use is here struct numeric_limits : public numeric_limits_base ^ 1 warning generated. [ 5%] Building CXX object src/caffe/CMakeFiles/caffe.dir/backend/cuda/cuda_device.cpp.o [ 5%] Building CXX object src/caffe/CMakeFiles/caffe.dir/backend/cuda/cuda_device_kernel.cpp.o In file included from /home/naths/srcs/caffe/src/caffe/backend/cuda/cuda_device_kernel.cpp:3: In file included from /home/naths/srcs/caffe/include/caffe/backend/cuda/cuda_device_kernel.hpp:4: In file included from /home/naths/srcs/caffe/include/caffe/backend/device_kernel.hpp:4: In file included from /home/naths/srcs/caffe/include/caffe/common.hpp:14: In file included from /home/naths/srcs/caffe/include/caffe/definitions.hpp:25: In file included from /home/naths/srcs/caffe/include/caffe/trait_helper.hpp:6: In file included from /home/naths/srcs/caffe/include/caffe/util/half_fp.hpp:5: /home/naths/srcs/caffe/include/3rdparty/half/half.hpp:1080:12: warning: class 'numeric_limits' was previously declared as a struct [-Wmismatched-tags] friend class std::numeric_limits; ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/6.4.0/../../../../include/c++/6.4.0/limits:315:12: note: previous use is here struct numeric_limits : public __numeric_limits_base ^ 1 warning generated. [ 5%] Building CXX object src/caffe/CMakeFiles/caffe.dir/backend/cuda/cuda_device_program.cpp.o [ 5%] Building CXX object src/caffe/CMakeFiles/caffe.dir/backend/device.cpp.o In file included from /home/naths/srcs/caffe/src/caffe/backend/device.cpp:6: In file included from /home/naths/srcs/caffe/include/caffe/backend/device.hpp:12: In file included from /home/naths/srcs/caffe/include/caffe/blob.hpp:8: In file included from /home/naths/srcs/caffe/include/caffe/common.hpp:14: In file included from /home/naths/srcs/caffe/include/caffe/definitions.hpp:25: In file included from /home/naths/srcs/caffe/include/caffe/trait_helper.hpp:6: In file included from /home/naths/srcs/caffe/include/caffe/util/half_fp.hpp:5: /home/naths/srcs/caffe/include/3rdparty/half/half.hpp:1080:12: warning: class 'numeric_limits' was previously declared as a struct [-Wmismatched-tags] friend class std::numeric_limits; ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/6.4.0/../../../../include/c++/6.4.0/limits:315:12: note: previous use is here struct numeric_limits : public __numeric_limits_base ^ /home/naths/srcs/caffe/src/caffe/backend/device.cpp:280:50: error: ordered comparison between pointer and zero ('int32_t ' (aka 'int ') and 'int') if (*lock_id < bufferflags.size() && lock_id > 0) {


1 warning and 1 error generated.
src/caffe/CMakeFiles/caffe.dir/build.make:140: recipe for target 'src/caffe/CMakeFiles/caffe.dir/backend/device.cpp.o' failed
make[2]: *** [src/caffe/CMakeFiles/caffe.dir/backend/device.cpp.o] Error 1
CMakeFiles/Makefile2:348: recipe for target 'src/caffe/CMakeFiles/caffe.dir/all' failed
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
skn123 commented 6 years ago

Fabian, any update on this?

naibaf7 commented 6 years ago

Yes, working on it. Not fixed yet.

skn123 commented 6 years ago

CLFFT is disabled/not working on this. Do you intend on keeping it that way?

naibaf7 commented 6 years ago

Yes, the Intel Spatial and CLFFT layers are dead and not coming back, since their contributors are no longer working at Intel (abandoned), and will be removed subsequently. However, clang, OS X and windows compile issues are parts I am actively working on since the beginning of August. There are currently some issues with the FP16 3rd party inclusion with both windows and clang, for some reason, as well as some compile-time macros not functioning on anything else than gcc right now.

skn123 commented 6 years ago

What exactly do you need in CLFFT? I can help in that if I know what is the API to be worked on. Looking at other code, I did get a lot of errors when I tried building the code. I hacked my way all the way through and even got it to build. Essentially it required some explicit templates to be instantiated. However, when I ran the code, I was getting crashes. I had posted the error logs in a thread that you had closed earlier. Is there a way I can send you the code? I had stopped working on that since June and reverted back to an older working version of the code.

naibaf7 commented 6 years ago

@skn123 You can submit a pull request if you want. I'm still unsure about why it fails to build for some people. At least with GCC 7 and 8, building of the new branch was never a problem. But I was kind of expecting regression problems with GCC 6, CLANG and MSVC. If you have some concrete hints how to fix these, please do a pull request.

The issue is mainly the backend changes and ton of features that have been added since the old version, namely quantized integer inference, floating point 16 and complete device abstraction.

skn123 commented 6 years ago

I am generating a new PR with my changes but on the mainline version of Caffe.

Jeffwhen commented 6 years ago

I run into this custom literal error in 3rdparty/half/half.hpp using GCC 4.

And wrong number of template arguments error using GCC 7.

What did you do to compile the latest code? @skn123

Or can anyone tell which commit point is compilable?

I am not a expert about this, but maybe a stable release from time to time is helpful.

skn123 commented 6 years ago

@naibaf7 take a look at this. The code is just compiling for ever! Maybe restructuring needed? screenshot from 2018-08-29 12-57-38

skn123 commented 6 years ago

I could build the code and as usual anything related with double gave me error. Double needs to be fixed as there are some API differences. dump.txt

skn123 commented 6 years ago

@naibaf7 Here is the PR https://github.com/BVLC/caffe/pull/6517

skn123 commented 6 years ago

@naibaf7 any update?

naibaf7 commented 6 years ago

@skn123 Currently in the process of defending my Master Thesis. There will be a large update mid-September :)

skn123 commented 6 years ago

@naibaf7 once more...anything?