Commit fe776ca3 authored by PRUVOST Florent's avatar PRUVOST Florent
Browse files

provide new variables BLAS/LAPACK_LIBRARIES_SEQ/PAR to replace FindBLASEXT and Find LAPACKEXT

parent b195f3b4
...@@ -22,8 +22,12 @@ ...@@ -22,8 +22,12 @@
# and -L). # and -L).
# BLAS_CFLAGS_OTHER - list of required compiler flags (excluding -I). # BLAS_CFLAGS_OTHER - list of required compiler flags (excluding -I).
# BLAS_INCLUDE_DIRS - include directories # BLAS_INCLUDE_DIRS - include directories
# BLAS_LIBRARIES - list of libraries (using full path name) to # BLAS_LIBRARIES - list of libraries (using full path name) to
# link against to use BLAS # link against to use BLAS, sequential or multithreaded version depending on BLA_VENDOR
# BLAS_LIBRARIES_SEQ - list of libraries (using full path name) to
# link against to use BLAS, sequential version (Intel MKL)
# BLAS_LIBRARIES_PAR - list of libraries (using full path name) to
# link against to use BLAS, multithreaded version (Intel MKL)
# BLAS95_LIBRARIES - list of libraries (using full path name) # BLAS95_LIBRARIES - list of libraries (using full path name)
# to link against to use BLAS95 interface # to link against to use BLAS95 interface
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface # BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
...@@ -365,14 +369,21 @@ if( PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER ) ...@@ -365,14 +369,21 @@ if( PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER )
endif() endif()
# try different blas # try different blas
if (BLA_VENDOR STREQUAL "Intel10_64lp") if (BLA_VENDOR STREQUAL "Intel10_64lp")
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL Sequential")
set (BLAS_LIBRARIES_SEQ "${BLAS_LIBRARIES}")
endif()
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-iomp) pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
if (BLAS_FOUND) if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL") set (BLAS_VENDOR_FOUND "Intel MKL Multithreaded")
set (BLAS_LIBRARIES_PAR "${BLAS_LIBRARIES}")
endif() endif()
elseif(BLA_VENDOR STREQUAL "Intel10_64lp_seq") elseif(BLA_VENDOR STREQUAL "Intel10_64lp_seq")
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq) pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
if (BLAS_FOUND) if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL") set (BLAS_VENDOR_FOUND "Intel MKL")
set (BLAS_LIBRARIES_SEQ "${BLAS_LIBRARIES}")
endif() endif()
elseif(BLA_VENDOR STREQUAL "Open") elseif(BLA_VENDOR STREQUAL "Open")
pkg_search_module(BLAS openblas) pkg_search_module(BLAS openblas)
...@@ -386,9 +397,15 @@ if( PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER ) ...@@ -386,9 +397,15 @@ if( PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER )
endif() endif()
else() else()
if (NOT BLAS_FOUND) if (NOT BLAS_FOUND)
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL Multithreaded")
set (BLAS_LIBRARIES_PAR "${BLAS_LIBRARIES}")
endif()
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq) pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
if (BLAS_FOUND) if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL") set (BLAS_VENDOR_FOUND "Intel MKL Sequential")
set (BLAS_LIBRARIES_SEQ "${BLAS_LIBRARIES}")
endif() endif()
endif() endif()
if (NOT BLAS_FOUND) if (NOT BLAS_FOUND)
...@@ -653,6 +670,10 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER ) ...@@ -653,6 +670,10 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
# mkl >= 10.3 # mkl >= 10.3
# sequential version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
# multithreaded version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
endif() endif()
...@@ -674,6 +695,10 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER ) ...@@ -674,6 +695,10 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
list(APPEND BLAS_SEARCH_LIBS list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide") "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
# mkl >= 10.3 # mkl >= 10.3
# sequential version
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_sequential mkl_core")
# multithreaded version
if (CMAKE_C_COMPILER_ID STREQUAL "Intel") if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
list(APPEND BLAS_SEARCH_LIBS list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core") "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core")
...@@ -721,6 +746,10 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER ) ...@@ -721,6 +746,10 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
# mkl >= 10.3 # mkl >= 10.3
# sequential version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
# multithreaded version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
endif() endif()
...@@ -746,6 +775,10 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER ) ...@@ -746,6 +775,10 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
list(APPEND BLAS_SEARCH_LIBS list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_intel_thread mkl_core guide") "mkl_intel_lp64 mkl_intel_thread mkl_core guide")
# mkl >= 10.3 # mkl >= 10.3
# sequential version
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_sequential mkl_core")
# multithreaded version
if (CMAKE_C_COMPILER_ID STREQUAL "Intel") if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
list(APPEND BLAS_SEARCH_LIBS list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_intel_thread mkl_core") "mkl_intel_lp64 mkl_intel_thread mkl_core")
...@@ -762,7 +795,7 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER ) ...@@ -762,7 +795,7 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
set(OMP_LIB "") set(OMP_LIB "")
endif() endif()
endif () endif ()
#older vesions of intel mkl libs #older versions of intel mkl libs
if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS list(APPEND BLAS_SEARCH_LIBS
"mkl") "mkl")
...@@ -777,8 +810,14 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER ) ...@@ -777,8 +810,14 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
foreach (IT ${BLAS_SEARCH_LIBS}) foreach (IT ${BLAS_SEARCH_LIBS})
string(REPLACE " " ";" SEARCH_LIBS ${IT}) string(REPLACE " " ";" SEARCH_LIBS ${IT})
if (${_LIBRARIES}) # determine if we look at a sequential or multithreaded version
else () set(MKL_MT OFF)
foreach(_lib ${SEARCH_LIBS})
if (${_lib} MATCHES "thread")
set (MKL_MT ON)
endif()
endforeach()
if (MKL_MT)
check_fortran_libraries( check_fortran_libraries(
${_LIBRARIES} ${_LIBRARIES}
BLAS BLAS
...@@ -787,8 +826,22 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER ) ...@@ -787,8 +826,22 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
"${SEARCH_LIBS}" "${SEARCH_LIBS}"
"${OMP_LIB};${CMAKE_THREAD_LIBS_INIT};${LM}" "${OMP_LIB};${CMAKE_THREAD_LIBS_INIT};${LM}"
) )
if(_LIBRARIES) else()
set(BLAS_LDFLAGS_OTHER "${additional_flags}") check_fortran_libraries(
${_LIBRARIES}
BLAS
${BLAS_mkl_SEARCH_SYMBOL}
"${additional_flags}"
"${SEARCH_LIBS}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
endif()
if(${_LIBRARIES})
set(BLAS_LDFLAGS_OTHER "${additional_flags}")
if (MKL_MT)
set (BLAS_LIBRARIES_PAR "${${_LIBRARIES}}")
else()
set (BLAS_LIBRARIES_SEQ "${${_LIBRARIES}}")
endif() endif()
endif() endif()
endforeach () endforeach ()
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
# LAPACK_INCLUDE_DIRS - lapack include directories # LAPACK_INCLUDE_DIRS - lapack include directories
# LAPACK_LIBRARY_DIRS - lapack link directories # LAPACK_LIBRARY_DIRS - lapack link directories
# LAPACK_LIBRARIES - lapack libraries to be linked (absolute path) # LAPACK_LIBRARIES - lapack libraries to be linked (absolute path)
# LAPACK_LIBRARIES_SEQ - lapack libraries to be linked (absolute path), sequential version (Intel MKL)
# LAPACK_LIBRARIES_PAR - lapack libraries to be linked (absolute path), multithreaded version (Intel MKL)
# LAPACK_CFLAGS_OTHER_DEP - lapack + dependencies compiler flags without headers paths # LAPACK_CFLAGS_OTHER_DEP - lapack + dependencies compiler flags without headers paths
# LAPACK_LDFLAGS_OTHER_DEP - lapack + dependencies linker flags without libraries # LAPACK_LDFLAGS_OTHER_DEP - lapack + dependencies linker flags without libraries
# LAPACK_INCLUDE_DIRS_DEP - lapack + dependencies include directories # LAPACK_INCLUDE_DIRS_DEP - lapack + dependencies include directories
...@@ -360,6 +362,12 @@ if(BLAS_FOUND) ...@@ -360,6 +362,12 @@ if(BLAS_FOUND)
"" ""
) )
if (LAPACK_LIBRARIES) if (LAPACK_LIBRARIES)
if (BLAS_LIBRARIES_SEQ)
set(LAPACK_LIBRARIES_SEQ "${BLAS_LIBRARIES_SEQ}")
endif()
if (BLAS_LIBRARIES_PAR)
set(LAPACK_LIBRARIES_PAR "${BLAS_LIBRARIES_PAR}")
endif()
if(NOT LAPACK_FIND_QUIETLY) if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES) if(LAPACK_LIBRARIES)
message(STATUS "Looking for LAPACK in BLAS: found") message(STATUS "Looking for LAPACK in BLAS: found")
...@@ -395,14 +403,21 @@ if(BLAS_FOUND) ...@@ -395,14 +403,21 @@ if(BLAS_FOUND)
endif() endif()
# try different blas # try different blas
if (BLA_VENDOR STREQUAL "Intel10_64lp") if (BLA_VENDOR STREQUAL "Intel10_64lp")
pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
if (LAPACK_FOUND)
set (LAPACK_VENDOR_FOUND "Intel MKL Sequential")
set (LAPACK_LIBRARIES_SEQ "${LAPACK_LIBRARIES}")
endif()
pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-iomp) pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
if (LAPACK_FOUND) if (LAPACK_FOUND)
set (LAPACK_VENDOR_FOUND "Intel MKL") set (LAPACK_VENDOR_FOUND "Intel MKL Multithreaded")
set (LAPACK_LIBRARIES_PAR "${LAPACK_LIBRARIES}")
endif() endif()
elseif(BLA_VENDOR STREQUAL "Intel10_64lp_seq") elseif(BLA_VENDOR STREQUAL "Intel10_64lp_seq")
pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-seq) pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
if (LAPACK_FOUND) if (LAPACK_FOUND)
set (LAPACK_VENDOR_FOUND "Intel MKL") set (LAPACK_VENDOR_FOUND "Intel MKL")
set (LAPACK_LIBRARIES_SEQ "${LAPACK_LIBRARIES}")
endif() endif()
elseif(BLA_VENDOR STREQUAL "Open") elseif(BLA_VENDOR STREQUAL "Open")
pkg_search_module(LAPACK openblas) pkg_search_module(LAPACK openblas)
...@@ -416,9 +431,15 @@ if(BLAS_FOUND) ...@@ -416,9 +431,15 @@ if(BLAS_FOUND)
endif() endif()
else() else()
if (NOT LAPACK_FOUND) if (NOT LAPACK_FOUND)
pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
if (LAPACK_FOUND)
set (LAPACK_VENDOR_FOUND "Intel MKL Multithreaded")
set (LAPACK_LIBRARIES_PAR "${LAPACK_LIBRARIES}")
endif()
pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-seq) pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
if (LAPACK_FOUND) if (LAPACK_FOUND)
set (LAPACK_VENDOR_FOUND "Intel MKL") set (LAPACK_VENDOR_FOUND "Intel MKL")
set (LAPACK_LIBRARIES_SEQ "${LAPACK_LIBRARIES}")
endif() endif()
endif() endif()
if (NOT LAPACK_FOUND) if (NOT LAPACK_FOUND)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment