facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.94k forks source link

Compile error with the benchmark source code on power/powerpc architecture #399

Open watts1t opened 7 years ago

watts1t commented 7 years ago

When building the Caffe2 framework from source on a Power (IBM Power8 processor) system everything compiles fine except for the benchmark source code supplied when cloning the Caffe2 source code.

The specific file affected is: ./caffe2/third_party/benchmark/src/cycleclock.h The specific line of code with the bug is: (line 83) tbl &= -static_cast<int64>(tbu0 == tbu1);

Note that the integer cast is specificed as int64 which is a Microsoft compiler specific alias and fails on other compilers.

The fix is to set the integer to the generic alias of _int64t as shown in the corrected code: tbl &= -static_cast<int64_t>(tbu0 == tbu1);

Once the file is modified then all errors are resolved and everything compiles correctly and tests afterwards run cleanly.

I do not know where it is best to post this issue so I am starting here first so apologies if this is the wrong place. Any helpful tips are greatly appreciated.

Yangqing commented 7 years ago

Thanks so much! This seems to be a benchmark issue. Could you do cd third_party/benchmark; git pull origin master and see if this addresses the problem? If the problem persists, it might be nice to send a diff to the benchmark repository at https://github.com/google/benchmark .

watts1t commented 7 years ago

Hi, my pleasure, I have just done as you requested and done the git pull and the cycleclock.h file is now showing as correct and does compile again. Thanks for the information and help.

iteal commented 7 years ago

same problem for me with latest clean copy of caffe2, the solution from @Yangqing worked

iteal commented 7 years ago

still happening with latest version, same fix is still working

iteal commented 7 years ago

We cannot use NNPACK anymore on PowerPC architecture: https://github.com/Maratyszcza/NNPACK/issues/115 I need to set USE_NNPACK to OFF in CMakeLists.txt