Merge topic 'blas-windows'

192a918 FindLAPACK: MKL clean up and fix for windows
46c7bca FindBLAS: Fixes for Windows MKL support
This commit is contained in:
Brad King 2013-10-09 10:23:57 -04:00 committed by CMake Topic Stage
commit f33068f615
2 changed files with 138 additions and 60 deletions

View File

@ -469,8 +469,45 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
set(_LIBRARIES BLAS95_LIBRARIES)
if (WIN32)
if (BLA_STATIC)
set(BLAS_mkl_DLL_SUFFIX "")
else()
set(BLAS_mkl_DLL_SUFFIX "_dll")
endif()
# Find the main file (32-bit or 64-bit)
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
endif()
if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
endif ()
# Add threading/sequential libs
set(BLAS_SEARCH_LIBS_WIN_THREAD "")
if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
endif()
if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
# mkl >= 10.3
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
endif()
# Cartesian product of the above
foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95 mkl_intel_c mkl_intel_thread mkl_core libguide40")
"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
endforeach()
endforeach()
else ()
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
@ -490,17 +527,54 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
endif ()
endif ()
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95_lp64 mkl_intel_lp64 mkl_sequential mkl_core")
"mkl_intel_lp64 mkl_sequential mkl_core")
endif ()
endif ()
else ()
set(BLAS_mkl_SEARCH_SYMBOL sgemm)
set(_LIBRARIES BLAS_LIBRARIES)
if (WIN32)
if (BLA_STATIC)
set(BLAS_mkl_DLL_SUFFIX "")
else()
set(BLAS_mkl_DLL_SUFFIX "_dll")
endif()
# Find the main file (32-bit or 64-bit)
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
endif()
if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
endif ()
# Add threading/sequential libs
set(BLAS_SEARCH_LIBS_WIN_THREAD "")
if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
# mkl >= 10.3
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
endif()
if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
endif()
# Cartesian product of the above
foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
list(APPEND BLAS_SEARCH_LIBS
"mkl_c_dll mkl_intel_thread_dll mkl_core_dll libguide40")
"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
endforeach()
endforeach()
else ()
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
@ -521,6 +595,10 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
endif ()
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_sequential mkl_core")
endif ()
#older vesions of intel mkl libs
if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
@ -532,10 +610,6 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"mkl_em64t")
endif ()
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_sequential mkl_core")
endif ()
endif ()
foreach (IT ${BLAS_SEARCH_LIBS})

View File

@ -229,57 +229,61 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
else()
find_package(Threads REQUIRED)
endif()
set(LAPACK_SEARCH_LIBS "")
if (BLA_F95)
if(NOT LAPACK95_LIBRARIES)
set(LAPACK_mkl_SEARCH_SYMBOL "CHEEV")
set(_LIBRARIES LAPACK95_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
# old
check_lapack_libraries(
LAPACK95_LIBRARIES
LAPACK
cheev
""
"mkl_lapack95"
"${BLAS95_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
endif()
if(NOT LAPACK95_LIBRARIES)
list(APPEND LAPACK_SEARCH_LIBS
"mkl_lapack95")
# new >= 10.3
check_lapack_libraries(
LAPACK95_LIBRARIES
LAPACK
CHEEV
""
"mkl_intel_lp64"
"${BLAS95_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
endif()
list(APPEND LAPACK_SEARCH_LIBS
"mkl_intel_c")
list(APPEND LAPACK_SEARCH_LIBS
"mkl_intel_lp64")
else()
if(NOT LAPACK_LIBRARIES)
set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
set(_LIBRARIES LAPACK_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
# old
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
""
"mkl_lapack"
"${BLAS_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
endif()
if(NOT LAPACK_LIBRARIES)
list(APPEND LAPACK_SEARCH_LIBS
"mkl_lapack")
# new >= 10.3
list(APPEND LAPACK_SEARCH_LIBS
"mkl_gf_lp64")
endif()
# First try empty lapack libs
if (NOT ${_LIBRARIES})
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
${_LIBRARIES}
BLAS
${LAPACK_mkl_SEARCH_SYMBOL}
""
"mkl_gf_lp64"
"${BLAS_LIBRARIES}"
""
"${_BLAS_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
endif ()
# Then try the search libs
foreach (IT ${LAPACK_SEARCH_LIBS})
if (NOT ${_LIBRARIES})
check_lapack_libraries(
${_LIBRARIES}
BLAS
${LAPACK_mkl_SEARCH_SYMBOL}
""
"${IT}"
"${_BLAS_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
endif ()
endforeach ()
endif ()
endif()
else()