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(BLAS_mkl_SEARCH_SYMBOL SGEMM)
set(_LIBRARIES BLAS95_LIBRARIES) set(_LIBRARIES BLAS95_LIBRARIES)
if (WIN32) if (WIN32)
list(APPEND BLAS_SEARCH_LIBS if (BLA_STATIC)
"mkl_blas95 mkl_intel_c mkl_intel_thread mkl_core libguide40") 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
"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
endforeach()
endforeach()
else () else ()
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS 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") "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
endif () endif ()
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 "mkl_intel_lp64 mkl_sequential mkl_core")
"mkl_blas95_lp64 mkl_intel_lp64 mkl_sequential mkl_core") endif ()
endif () endif ()
else () else ()
set(BLAS_mkl_SEARCH_SYMBOL sgemm) set(BLAS_mkl_SEARCH_SYMBOL sgemm)
set(_LIBRARIES BLAS_LIBRARIES) set(_LIBRARIES BLAS_LIBRARIES)
if (WIN32) if (WIN32)
list(APPEND BLAS_SEARCH_LIBS if (BLA_STATIC)
"mkl_c_dll mkl_intel_thread_dll mkl_core_dll libguide40") 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
"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
endforeach()
endforeach()
else () else ()
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS 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") "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
endif () endif ()
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 #older vesions of intel mkl libs
if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") 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") "mkl_em64t")
endif () endif ()
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 () endif ()
foreach (IT ${BLAS_SEARCH_LIBS}) foreach (IT ${BLAS_SEARCH_LIBS})

View File

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