-
-
Save mdouze/46daf5fb494be70c7dd8ab19698021d0 to your computer and use it in GitHub Desktop.
[matthijs@matthijs-mbp ~/Desktop/test_cmake/faiss/build]cmake -DCMAKE_CXX_COMPILER=/opt/local/bin/g++-mp-6 .. | |
-- The C compiler identification is AppleClang 8.0.0.8000042 | |
-- The CXX compiler identification is GNU 6.3.0 | |
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc | |
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works | |
-- Detecting C compiler ABI info | |
-- Detecting C compiler ABI info - done | |
-- Detecting C compile features | |
-- Detecting C compile features - done | |
-- Checking whether CXX compiler has -isysroot | |
-- Checking whether CXX compiler has -isysroot - yes | |
-- Checking whether CXX compiler supports OSX deployment target flag | |
-- Checking whether CXX compiler supports OSX deployment target flag - yes | |
-- Check for working CXX compiler: /opt/local/bin/g++-mp-6 | |
-- Check for working CXX compiler: /opt/local/bin/g++-mp-6 -- works | |
-- Detecting CXX compiler ABI info | |
-- Detecting CXX compiler ABI info - done | |
-- Detecting CXX compile features | |
-- Detecting CXX compile features - done | |
-- Try OpenMP C flag = [-fopenmp=libomp] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Failed | |
-- Try OpenMP C flag = [ ] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Failed | |
-- Try OpenMP C flag = [-fopenmp] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Failed | |
-- Try OpenMP C flag = [/openmp] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Failed | |
-- Try OpenMP C flag = [-Qopenmp] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Failed | |
-- Try OpenMP C flag = [-openmp] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Failed | |
-- Try OpenMP C flag = [-xopenmp] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Failed | |
-- Try OpenMP C flag = [+Oopenmp] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Failed | |
-- Try OpenMP C flag = [-qsmp] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Failed | |
-- Try OpenMP C flag = [-mp] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Failed | |
-- Try OpenMP CXX flag = [-fopenmp] | |
-- Performing Test OpenMP_FLAG_DETECTED | |
-- Performing Test OpenMP_FLAG_DETECTED - Success | |
CMake Error at /opt/local/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message): | |
Could NOT find OpenMP (missing: OpenMP_C_FLAGS) | |
Call Stack (most recent call first): | |
/opt/local/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) | |
/opt/local/share/cmake-3.7/Modules/FindOpenMP.cmake:316 (find_package_handle_standard_args) | |
CMakeLists.txt:13 (find_package) | |
-- Configuring incomplete, errors occurred! | |
See also "/Users/matthijs/Desktop/test_cmake/faiss/build/CMakeFiles/CMakeOutput.log". | |
See also "/Users/matthijs/Desktop/test_cmake/faiss/build/CMakeFiles/CMakeError.log". |
I checked the makefile.inc.Mac.brew. It installed a different version of clang using homebrew. So to build faiss on mac, we need to install this new clang too and specified it in the cmake script.
It seems to me that changing the compiler is not done in the cmake script. We should set the CC/CXX variable, pointing it to the new compiler, before running cmake commands.
The compiler /opt/local/bin/g++-mp-6
supports OpenMP, so I don't understand why cmake is complaining. The -DCMAKE_CXX_COMPILER=/opt/local/bin/g++-mp-6
option sets the compiler, right?
What about also setting CMAKE_C_COMPILER to /opt/local/bin/g++-mp-6?
Thanks for the suggestion, this advanced a bit, by setting
OpenBLAS_HOME=/opt/local cmake -DCMAKE_CXX_COMPILER=/opt/local/bin/g++-mp-6 -DCMAKE_C_COMPILER=/opt/local/bin/gcc-mp-6 ..
It now passes the openmp test fine. However, the openblas test fails. with error
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
CMake Error at cmake/Modules/FindOpenBLAS.cmake:55 (MESSAGE):
Could not find OpenBLAS
Call Stack (most recent call first):
CMakeLists.txt:16 (find_package)
-- Configuring incomplete, errors occurred!
See also "/Users/matthijs/Desktop/github_faiss/test_cmake/faiss/build/CMakeFiles/CMakeOutput.log".
I set OpenBLAS_HOME
to /opt/local because this is where macports installed openblas, see
[matthijs@matthijs-mbp ~/Desktop/github_faiss/faiss]port contents openblas
Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
Port OpenBLAS contains:
/opt/local/include/cblas_openblas.h
/opt/local/include/f77blas.h
/opt/local/include/lapacke.h
/opt/local/include/lapacke_config.h
/opt/local/include/lapacke_mangling.h
/opt/local/include/lapacke_utils.h
/opt/local/include/openblas_config.h
/opt/local/lib/libopenblas-r1.a
/opt/local/lib/libopenblas-r1.dylib
/opt/local/lib/libopenblas.a
/opt/local/lib/libopenblas.dylib
Any idea why it does not pick up the include path?
Thanks for the report of macports. I use homebrew personally so I didn't encounter this issue. I've update the pull request and INSTALL. This issue is solved by adding the macport search path (/opt/local/include and /opt/local/lib) to FindOpenBlas.cmake.
The fix does not work. It seems to be because cmake requires cblas.h (that Faiss does not use).
Istalling the dev package of openblas to see if it works better...
Could you remove the requirement for CBLAS includes? Faiss does not use them, and the macports openblas does not provide cblas.h, only the devel packags has a /opt/local/include/cblas_openblas.h.
This is because the original clang doesn't support openmp. Does the makefile support Mac?