Skip to content

Commit

Permalink
Always use Stan's eigen fix #4288
Browse files Browse the repository at this point in the history
remove optional system dependency to eigen as we anyways have eigen internally
available due to Stan dependency
  • Loading branch information
vigsterkr committed May 18, 2018
1 parent 6591be2 commit eca71c6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 102 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ endif()
set(HAVE_CXX11 ON)

############# minimum library versions ###################
SET(EIGEN_VERSION_MINIMUM 3.1.2)
SET(VIENNACL_VERSION_MINIMUM 1.5.0)

# Store system's or distribution's C[XX]FLAGS.
Expand Down
51 changes: 0 additions & 51 deletions cmake/FindEigen3.cmake

This file was deleted.

5 changes: 2 additions & 3 deletions cmake/ShogunFindLAPACK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ IF (LAPACK_FOUND)
ENDIF()
ENDIF()
ENDIF()
# if LaPack is detected and Eigen is 3.3 or later
# use the lapack/blas backend in Eigen
IF(${EIGEN_VERSION} VERSION_GREATER 3.3.0 AND ENABLE_EIGEN_LAPACK AND HAVE_LAPACK)
# if LaPack is detected use the lapack/blas backend in Eigen
IF(ENABLE_EIGEN_LAPACK AND HAVE_LAPACK)
SET(EIGEN_USE_BLAS 1)
MESSAGE(STATUS "Enabling detected BLAS library as backend for Eigen")

Expand Down
22 changes: 0 additions & 22 deletions cmake/external/Eigen3.cmake

This file was deleted.

6 changes: 2 additions & 4 deletions cmake/external/StanMath.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set(STAN_STABLE_RELEASE 4b1a10bc877d941bbe0a12c198526807be27167a)
set(STAN_INCLUDE_DIR_STAN_MATH ${CMAKE_BINARY_DIR}/StanMath/src/StanMath)
set(STAN_INCLUDE_DIR_BOOST ${CMAKE_BINARY_DIR}/StanMath/src/StanMath/lib/boost_1.64.0)
set(STAN_INCLUDE_DIR_CVODES ${CMAKE_BINARY_DIR}/StanMath/src/StanMath/lib/cvodes_2.9.0/include)
set(STAN_INCLUDE_DIR_EIGEN ${CMAKE_BINARY_DIR}/StanMath/src/StanMath/lib/eigen_3.3.3)

include(ExternalProject)
ExternalProject_Add(
Expand All @@ -13,10 +14,7 @@ ExternalProject_Add(
GIT_TAG ${STAN_STABLE_RELEASE}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} -E copy_if_different ${STAN_INCLUDE_DIR_STAN_MATH} include/shogun/third_party/Stan
&& ${CMAKE_COMMAND} -E copy_if_different ${STAN_INCLUDE_DIR_BOOST} include/shogun/third_party/Stan_Boost
&& ${CMAKE_COMMAND} -E copy_if_different ${STAN_INCLUDE_DIR_CVODES} include/shogun/third_party/Stan_Cvodes
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
)
add_dependencies(libshogun StanMath)
27 changes: 6 additions & 21 deletions src/shogun/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,35 +280,20 @@ endif()
#Stan math
include(external/StanMath)

SHOGUN_INCLUDE_DIRS(SCOPE PUBLIC SYSTEM
SHOGUN_INCLUDE_DIRS(SCOPE PRIVATE SYSTEM
$<BUILD_INTERFACE:${STAN_INCLUDE_DIR_STAN_MATH}>
$<INSTALL_INTERFACE:include/shogun/third_party/Stan>
)
SHOGUN_INCLUDE_DIRS(SCOPE PUBLIC SYSTEM
SHOGUN_INCLUDE_DIRS(SCOPE PRIVATE SYSTEM
$<BUILD_INTERFACE:${STAN_INCLUDE_DIR_BOOST}>
$<INSTALL_INTERFACE:include/shogun/third_party/Stan_Boost>
)
SHOGUN_INCLUDE_DIRS(SCOPE PUBLIC SYSTEM
SHOGUN_INCLUDE_DIRS(SCOPE PRIVATE SYSTEM
$<BUILD_INTERFACE:${STAN_INCLUDE_DIR_CVODES}>
$<INSTALL_INTERFACE:include/shogun/third_party/Stan_Cvodes>
)
SHOGUN_INCLUDE_DIRS(SCOPE PRIVATE SYSTEM
$<BUILD_INTERFACE:${STAN_INCLUDE_DIR_EIGEN}>
)

####### LINALG
FIND_PACKAGE(Eigen3 ${EIGEN_VERSION_MINIMUM})
IF(NOT EIGEN3_FOUND)
include(external/Eigen3)
SHOGUN_INCLUDE_DIRS(SCOPE PUBLIC SYSTEM
$<BUILD_INTERFACE:${EIGEN_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include/shogun/third_party/eigen>
)
ELSE()
# eigen3 bug related to aliasing operators and self-storing.
IF(${EIGEN_VERSION} VERSION_GREATER 3.2.90 AND ${EIGEN_VERSION} VERSION_LESS 3.3.0)
MESSAGE(WARNING "The system Eigen3 version ${EIGEN_VERSION} contains a lot of bugs, which could cause some models failing!")
ENDIF()
SHOGUN_INCLUDE_DIRS(SCOPE PUBLIC SYSTEM ${EIGEN_INCLUDE_DIR})
ENDIF()

# ViennaCL detection
SHOGUN_DEPENDENCIES(
LIBRARY ViennaCL
Expand Down

0 comments on commit eca71c6

Please sign in to comment.