mirror of https://github.com/QMCPACK/qmcpack.git
Make MKL detection robust.
This commit is contained in:
parent
b1fada428b
commit
3184605c01
|
@ -15,11 +15,10 @@ IF(DEFINED MKL_ROOT)
|
|||
message(FATAL_ERROR "MKL_INCLUDE_DIRECTORIES not set. \"mkl.h\" not found in MKL_ROOT/(${SUFFIXES})")
|
||||
ENDIF ()
|
||||
ELSE(DEFINED MKL_ROOT)
|
||||
# Finding and setting the MKL_INCLUDE_DIRECTORIES based on MKLROOT, MKL_HOME, $ENV{MKLROOT}, $ENV{MKL_ROOT}, $ENV{MKL_HOME}
|
||||
# Finding and setting the MKL_INCLUDE_DIRECTORIES based on $ENV{MKLROOT}, $ENV{MKL_ROOT}, $ENV{MKL_HOME}
|
||||
# Extremely Basic Support of common mkl module environment variables
|
||||
# or -DMKLROOT/-DMKL_HOME instead of preferred -DMKL_ROOT
|
||||
FIND_PATH(MKL_INCLUDE_DIRECTORIES "mkl.h"
|
||||
HINTS ${MKLROOT} ${MKL_HOME} $ENV{MKLROOT} $ENV{MKL_ROOT} $ENV{MKL_HOME}
|
||||
HINTS $ENV{MKLROOT} $ENV{MKL_ROOT} $ENV{MKL_HOME}
|
||||
PATH_SUFFIXES include NO_CMAKE_SYSTEM_PATH)
|
||||
IF(MKL_INCLUDE_DIRECTORIES)
|
||||
STRING(REPLACE "/include" "" MKL_ROOT ${MKL_INCLUDE_DIRECTORIES})
|
||||
|
@ -30,7 +29,7 @@ ELSE(DEFINED MKL_ROOT)
|
|||
ENDIF(DEFINED MKL_ROOT)
|
||||
|
||||
IF(MKL_INCLUDE_DIRECTORIES)
|
||||
MESSAGE("MKL_INCLUDE_DIRECTORIES: ${MKL_INCLUDE_DIRECTORIES}")
|
||||
MESSAGE(STATUS "MKL_INCLUDE_DIRECTORIES: ${MKL_INCLUDE_DIRECTORIES}")
|
||||
ELSE(MKL_INCLUDE_DIRECTORIES)
|
||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
MESSAGE(FATAL_ERROR "Intel's standard compilervar.sh sets the env variable MKLROOT.\n"
|
||||
|
|
|
@ -426,11 +426,6 @@ IF (ENABLE_GCOV)
|
|||
ENDIF()
|
||||
ENDIF(ENABLE_GCOV)
|
||||
|
||||
# AFQMC requires MKL sparse for good performance (roughly a factor of 2x)
|
||||
IF (BUILD_AFQMC AND NOT MKL_FOUND)
|
||||
MESSAGE(WARNING "AFQMC - MKL not found, using simple sparse matrix routines. Link with MKL sparse libraries for better performance.")
|
||||
ENDIF()
|
||||
|
||||
IF (BUILD_AFQMC AND NOT APPLE)
|
||||
LINK_LIBRARIES("rt")
|
||||
ENDIF()
|
||||
|
@ -519,14 +514,43 @@ ENDIF(QMC_MPI)
|
|||
#-------------------------------------------------------------------
|
||||
# Add Math::BLAS_LAPACK target
|
||||
ADD_LIBRARY(Math::BLAS_LAPACK INTERFACE IMPORTED)
|
||||
find_package(LAPACK REQUIRED)
|
||||
|
||||
FOREACH(MKL_LIB_PATH IN ITEMS ${MKL_ROOT} $ENV{MKL_ROOT} $ENV{MKLROOT} $ENV{MKL_HOME})
|
||||
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${MKL_LIB_PATH}/lib/intel64)
|
||||
ENDFOREACH()
|
||||
IF(NOT BLA_VENDOR)
|
||||
MESSAGE(STATUS "Trying to find the LAPACK from Intel MKL ...")
|
||||
IF(QMC_OMP)
|
||||
SET(BLA_VENDOR Intel10_64lp)
|
||||
ELSE()
|
||||
SET(BLA_VENDOR Intel10_64lp_seq)
|
||||
ENDIF()
|
||||
find_package(LAPACK QUIET)
|
||||
IF(NOT LAPACK_FOUND)
|
||||
MESSAGE(STATUS "MKL not found.")
|
||||
MESSAGE(STATUS "Trying to find alternative LAPACK libraries")
|
||||
SET(BLA_VENDOR All)
|
||||
find_package(LAPACK REQUIRED)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Trying to find LAPACK library as requested BLA_VENDOR=${BLA_VENDOR}")
|
||||
find_package(LAPACK REQUIRED)
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "LAPACK linker flags: ${LAPACK_LINKER_FLAGS}")
|
||||
MESSAGE(STATUS "LAPACK libraries: ${LAPACK_LIBRARIES}")
|
||||
SET_TARGET_PROPERTIES(Math::BLAS_LAPACK PROPERTIES INTERFACE_LINK_LIBRARIES "${LAPACK_LINKER_FLAGS};${LAPACK_LIBRARIES}")
|
||||
|
||||
# Detects MKL header files and other components.
|
||||
IF(LAPACK_LIBRARIES MATCHES "mkl_core")
|
||||
INCLUDE(CMake/FindMKL.cmake)
|
||||
ENDIF()
|
||||
|
||||
# AFQMC requires MKL sparse for good performance (roughly a factor of 2x)
|
||||
IF (BUILD_AFQMC AND NOT MKL_FOUND)
|
||||
MESSAGE(WARNING "AFQMC - MKL not found, using simple sparse matrix routines. Link with MKL sparse libraries for better performance.")
|
||||
ENDIF()
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# set up scalar/vector math libraries
|
||||
#-------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue