Mentions légales du service

Skip to content
Snippets Groups Projects
Commit d01cef39 authored by PRUVOST Florent's avatar PRUVOST Florent
Browse files

improve Find BLAS for gnu compilo and threaded mkl

parent 576a4dfe
No related branches found
No related tags found
No related merge requests found
...@@ -301,6 +301,10 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) ...@@ -301,6 +301,10 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
unset(${_prefix}${_combined_name}_WORKS CACHE) unset(${_prefix}${_combined_name}_WORKS CACHE)
endif() endif()
if (_CHECK_FORTRAN) if (_CHECK_FORTRAN)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
string(REPLACE "mkl_intel_lp64" "mkl_gf_lp64" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
string(REPLACE "mkl_intel_ilp64" "mkl_gf_ilp64" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
endif()
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
else() else()
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
...@@ -415,8 +419,6 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") ...@@ -415,8 +419,6 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
endif() endif()
endif() endif()
# libiomp5
# --------
if (WIN32) if (WIN32)
string(REPLACE ":" ";" _libdir "$ENV{LIB}") string(REPLACE ":" ";" _libdir "$ENV{LIB}")
elseif (APPLE) elseif (APPLE)
...@@ -426,6 +428,8 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") ...@@ -426,6 +428,8 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
endif () endif ()
list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
# libiomp5
# --------
set(OMP_iomp5_LIBRARY "OMP_iomp5_LIBRARY-NOTFOUND") set(OMP_iomp5_LIBRARY "OMP_iomp5_LIBRARY-NOTFOUND")
find_library(OMP_iomp5_LIBRARY find_library(OMP_iomp5_LIBRARY
NAMES iomp5 NAMES iomp5
...@@ -433,15 +437,35 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") ...@@ -433,15 +437,35 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
) )
mark_as_advanced(OMP_iomp5_LIBRARY) mark_as_advanced(OMP_iomp5_LIBRARY)
set(OMP_LIB "") set(OMP_LIB "")
if (OMP_iomp5_LIBRARY) # libgomp
set(OMP_LIB "${OMP_iomp5_LIBRARY}") # -------
set(OMP_gomp_LIBRARY "OMP_gomp_LIBRARY-NOTFOUND")
find_library(OMP_gomp_LIBRARY
NAMES gomp
HINTS ${_libdir}
)
mark_as_advanced(OMP_gomp_LIBRARY)
# choose one or another depending on the compilo
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
if (OMP_gomp_LIBRARY)
set(OMP_LIB "${OMP_gomp_LIBRARY}")
endif()
else(CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (OMP_iomp5_LIBRARY)
set(OMP_LIB "${OMP_iomp5_LIBRARY}")
endif()
endif() endif()
if (UNIX AND NOT WIN32) if (UNIX AND NOT WIN32)
set(LM "-lm") set(LM "-lm")
set(BLAS_COMPILER_FLAGS "") set(BLAS_COMPILER_FLAGS "")
if (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq") if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")
list(APPEND BLAS_COMPILER_FLAGS "-openmp") if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
list(APPEND BLAS_COMPILER_FLAGS "-openmp")
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
list(APPEND BLAS_COMPILER_FLAGS "-fopenmp")
endif()
endif() endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU") if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
if (BLA_VENDOR STREQUAL "Intel10_32") if (BLA_VENDOR STREQUAL "Intel10_32")
...@@ -523,8 +547,14 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") ...@@ -523,8 +547,14 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
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
list(APPEND BLAS_SEARCH_LIBS if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
"mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core") list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core")
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core")
endif()
endif () endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS list(APPEND BLAS_SEARCH_LIBS
...@@ -589,8 +619,14 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") ...@@ -589,8 +619,14 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
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
list(APPEND BLAS_SEARCH_LIBS if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
"mkl_intel_lp64 mkl_intel_thread mkl_core") list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_intel_thread mkl_core")
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_gnu_thread mkl_core")
endif()
endif () endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS list(APPEND BLAS_SEARCH_LIBS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment