In default, use third party eigen. Added new flag USE_SYSTEM_EIGEN_INSTALL to control. (#11020)

Summary:
TSIA. apaszke pointed out that it might be better to use third party folder in default, since system Eigen may often be out of date and does not have the version we need to compile successfully.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11020

Differential Revision: D9562548

Pulled By: Yangqing

fbshipit-source-id: d8ab8a6ebe1f3d9eec638ef726cf5dc4dcf777b5
This commit is contained in:
Yangqing Jia
2018-09-04 10:44:24 -07:00
committed by Facebook Github Bot
parent 539579aa9a
commit 684b55d762
2 changed files with 12 additions and 4 deletions

View File

@ -108,6 +108,8 @@ option(USE_PROF "Use profiling" OFF)
option(USE_REDIS "Use Redis" OFF)
option(USE_ROCKSDB "Use RocksDB" OFF)
option(USE_SNPE "Use Qualcomm's SNPE library" OFF)
option(USE_SYSTEM_EIGEN_INSTALL
"Use system Eigen instead of the one under third_party" OFF)
option(USE_TENSORRT "Using Nvidia TensorRT library" OFF)
option(USE_ZMQ "Use ZMQ" OFF)
option(USE_ZSTD "Use ZSTD" OFF)

View File

@ -323,11 +323,17 @@ endif()
# ---[ EIGEN
# Due to license considerations, we will only use the MPL2 parts of Eigen.
set(EIGEN_MPL2_ONLY 1)
find_package(Eigen3)
if(EIGEN3_FOUND)
message(STATUS "Found system Eigen at " ${EIGEN3_INCLUDE_DIR})
if (USE_SYSTEM_EIGEN_INSTALL)
find_package(Eigen3)
if(EIGEN3_FOUND)
message(STATUS "Found system Eigen at " ${EIGEN3_INCLUDE_DIR})
else()
message(STATUS "Did not find system Eigen. Using third party subdirectory.")
set(EIGEN3_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../third_party/eigen)
caffe2_update_option(USE_SYSTEM_EIGEN_INSTALL OFF)
endif()
else()
message(STATUS "Did not find system Eigen. Using third party subdirectory.")
message(STATUS "Using third party subdirectory Eigen.")
set(EIGEN3_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../third_party/eigen)
endif()
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})