Browse Source

Merge topic 'findblaslapack-cray'

76487b04b1 Find{BLAS,LAPACK}: clean variables
fc54e68c05 Find{BLAS,LAPACK}: improve found message on Cray

Acked-by: Kitware Robot <[email protected]>
Merge-request: !6348
Brad King 4 years ago
parent
commit
23e87ae163
2 changed files with 39 additions and 26 deletions
  1. 21 16
      Modules/FindBLAS.cmake
  2. 18 10
      Modules/FindLAPACK.cmake

+ 21 - 16
Modules/FindBLAS.cmake

@@ -386,6 +386,8 @@ if(BLA_VENDOR STREQUAL "All")
       )
       )
   endif()
   endif()
   if(BLAS_WORKS)
   if(BLAS_WORKS)
+    # Give a more helpful "found" message
+    set(BLAS_WORKS "implicitly linked")
     set(_blas_fphsa_req_var BLAS_WORKS)
     set(_blas_fphsa_req_var BLAS_WORKS)
   endif()
   endif()
 endif()
 endif()
@@ -439,7 +441,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
 
 
       if(BLA_F95)
       if(BLA_F95)
         set(BLAS_mkl_SEARCH_SYMBOL "sgemm_f95")
         set(BLAS_mkl_SEARCH_SYMBOL "sgemm_f95")
-        set(_LIBRARIES BLAS95_LIBRARIES)
+        set(_BLAS_LIBRARIES BLAS95_LIBRARIES)
         if(WIN32)
         if(WIN32)
           # Find the main file (32-bit or 64-bit)
           # Find the main file (32-bit or 64-bit)
           set(BLAS_SEARCH_LIBS_WIN_MAIN "")
           set(BLAS_SEARCH_LIBS_WIN_MAIN "")
@@ -501,7 +503,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
         endif()
         endif()
       else()
       else()
         set(BLAS_mkl_SEARCH_SYMBOL sgemm)
         set(BLAS_mkl_SEARCH_SYMBOL sgemm)
-        set(_LIBRARIES BLAS_LIBRARIES)
+        set(_BLAS_LIBRARIES BLAS_LIBRARIES)
         if(WIN32)
         if(WIN32)
           # Find the main file (32-bit or 64-bit)
           # Find the main file (32-bit or 64-bit)
           set(BLAS_SEARCH_LIBS_WIN_MAIN "")
           set(BLAS_SEARCH_LIBS_WIN_MAIN "")
@@ -613,15 +615,15 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
           "lib/${BLAS_mkl_ARCH_NAME}"
           "lib/${BLAS_mkl_ARCH_NAME}"
           )
           )
 
 
-      foreach(IT ${BLAS_SEARCH_LIBS})
-        string(REPLACE " " ";" SEARCH_LIBS ${IT})
-        if(NOT ${_LIBRARIES})
+      foreach(_search ${BLAS_SEARCH_LIBS})
+        string(REPLACE " " ";" _search ${_search})
+        if(NOT ${_BLAS_LIBRARIES})
           check_blas_libraries(
           check_blas_libraries(
-            ${_LIBRARIES}
+            ${_BLAS_LIBRARIES}
             BLAS
             BLAS
             ${BLAS_mkl_SEARCH_SYMBOL}
             ${BLAS_mkl_SEARCH_SYMBOL}
             ""
             ""
-            "${SEARCH_LIBS}"
+            "${_search}"
             "${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}"
             "${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}"
             "${BLAS_mkl_MKLROOT}"
             "${BLAS_mkl_MKLROOT}"
             "${BLAS_mkl_LIB_PATH_SUFFIXES}"
             "${BLAS_mkl_LIB_PATH_SUFFIXES}"
@@ -629,6 +631,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
         endif()
         endif()
       endforeach()
       endforeach()
 
 
+      unset(_search)
       unset(BLAS_mkl_ILP_MODE)
       unset(BLAS_mkl_ILP_MODE)
       unset(BLAS_mkl_INTFACE)
       unset(BLAS_mkl_INTFACE)
       unset(BLAS_mkl_THREADING)
       unset(BLAS_mkl_THREADING)
@@ -734,14 +737,14 @@ if(BLA_VENDOR MATCHES "Arm" OR BLA_VENDOR STREQUAL "All")
 
 
    # Check for 64bit Integer support
    # Check for 64bit Integer support
    if(BLA_VENDOR MATCHES "_ilp64")
    if(BLA_VENDOR MATCHES "_ilp64")
-     set(BLAS_armpl_LIB "armpl_ilp64")
+     set(_blas_armpl_lib "armpl_ilp64")
    else()
    else()
-     set(BLAS_armpl_LIB "armpl_lp64")
+     set(_blas_armpl_lib "armpl_lp64")
    endif()
    endif()
 
 
    # Check for OpenMP support, VIA BLA_VENDOR of Arm_mp or Arm_ipl64_mp
    # Check for OpenMP support, VIA BLA_VENDOR of Arm_mp or Arm_ipl64_mp
    if(BLA_VENDOR MATCHES "_mp")
    if(BLA_VENDOR MATCHES "_mp")
-     set(BLAS_armpl_LIB "${BLAS_armpl_LIB}_mp")
+     set(_blas_armpl_lib "${_blas_armpl_lib}_mp")
    endif()
    endif()
 
 
    if(NOT BLAS_LIBRARIES)
    if(NOT BLAS_LIBRARIES)
@@ -750,13 +753,13 @@ if(BLA_VENDOR MATCHES "Arm" OR BLA_VENDOR STREQUAL "All")
       BLAS
       BLAS
       sgemm
       sgemm
       ""
       ""
-      "${BLAS_armpl_LIB}"
+      "${_blas_armpl_lib}"
       ""
       ""
       ""
       ""
       ""
       ""
       )
       )
   endif()
   endif()
-
+  set(_blas_armpl_lib)
 endif()
 endif()
 
 
 # FLAME's blis library? (https://github.com/flame/blis)
 # FLAME's blis library? (https://github.com/flame/blis)
@@ -1087,11 +1090,11 @@ endif()
 # Elbrus Math Library?
 # Elbrus Math Library?
 if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")
 if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")
 
 
-   set(BLAS_EML_LIB "eml")
+   set(_blas_eml_lib "eml")
 
 
    # Check for OpenMP support, VIA BLA_VENDOR of eml_mt
    # Check for OpenMP support, VIA BLA_VENDOR of eml_mt
    if(BLA_VENDOR MATCHES "_mt")
    if(BLA_VENDOR MATCHES "_mt")
-     set(BLAS_EML_LIB "${BLAS_EML_LIB}_mt")
+     set(_blas_eml_lib "${BLAS_EML_LIB}_mt")
    endif()
    endif()
 
 
    if(NOT BLAS_LIBRARIES)
    if(NOT BLAS_LIBRARIES)
@@ -1100,13 +1103,13 @@ if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")
       BLAS
       BLAS
       sgemm
       sgemm
       ""
       ""
-      "${BLAS_EML_LIB}"
+      "${_blas_eml_lib}"
       ""
       ""
       ""
       ""
       ""
       ""
       )
       )
   endif()
   endif()
-
+  set(_blas_eml_lib)
 endif()
 endif()
 
 
 # Fujitsu SSL2 Library?
 # Fujitsu SSL2 Library?
@@ -1163,3 +1166,5 @@ if(NOT BLA_F95)
 endif()
 endif()
 
 
 _add_blas_target()
 _add_blas_target()
+unset(_blas_fphsa_req_var)
+unset(_BLAS_LIBRARIES)

+ 18 - 10
Modules/FindLAPACK.cmake

@@ -298,7 +298,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
 
 
     if(BLA_F95)
     if(BLA_F95)
       set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95")
       set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95")
-      set(_LIBRARIES LAPACK95_LIBRARIES)
+      set(_LAPACK_LIBRARIES LAPACK95_LIBRARIES)
       set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
       set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
 
 
       # old
       # old
@@ -311,7 +311,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
         "mkl_lapack95_${LAPACK_mkl_ILP_MODE}")
         "mkl_lapack95_${LAPACK_mkl_ILP_MODE}")
     else()
     else()
       set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
       set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
-      set(_LIBRARIES LAPACK_LIBRARIES)
+      set(_LAPACK_LIBRARIES LAPACK_LIBRARIES)
       set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
       set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
 
 
       # old and new >= 10.3
       # old and new >= 10.3
@@ -350,10 +350,10 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
         "lib/${LAPACK_mkl_ARCH_NAME}"
         "lib/${LAPACK_mkl_ARCH_NAME}"
         )
         )
 
 
-    # First try empty lapack libs
-    if(NOT ${_LIBRARIES})
+    # First try empty lapack libs (implicitly linked or automatic from BLAS)
+    if(NOT ${_LAPACK_LIBRARIES})
       check_lapack_libraries(
       check_lapack_libraries(
-        ${_LIBRARIES}
+        ${_LAPACK_LIBRARIES}
         LAPACK
         LAPACK
         ${LAPACK_mkl_SEARCH_SYMBOL}
         ${LAPACK_mkl_SEARCH_SYMBOL}
         ""
         ""
@@ -363,18 +363,23 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
         "${LAPACK_mkl_LIB_PATH_SUFFIXES}"
         "${LAPACK_mkl_LIB_PATH_SUFFIXES}"
         "${_BLAS_LIBRARIES}"
         "${_BLAS_LIBRARIES}"
       )
       )
+      if(LAPACK_WORKS AND NOT _BLAS_LIBRARIES)
+        # Give a more helpful "found" message
+        set(LAPACK_WORKS "implicitly linked")
+        set(_lapack_fphsa_req_var LAPACK_WORKS)
+      endif()
     endif()
     endif()
 
 
     # Then try the search libs
     # Then try the search libs
-    foreach(IT ${LAPACK_SEARCH_LIBS})
-      string(REPLACE " " ";" SEARCH_LIBS ${IT})
-      if(NOT ${_LIBRARIES})
+    foreach(_search ${LAPACK_SEARCH_LIBS})
+      string(REPLACE " " ";" _search ${_search})
+      if(NOT ${_LAPACK_LIBRARIES})
         check_lapack_libraries(
         check_lapack_libraries(
-          ${_LIBRARIES}
+          ${_LAPACK_LIBRARIES}
           LAPACK
           LAPACK
           ${LAPACK_mkl_SEARCH_SYMBOL}
           ${LAPACK_mkl_SEARCH_SYMBOL}
           ""
           ""
-          "${SEARCH_LIBS}"
+          "${_search}"
           "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}"
           "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}"
           "${LAPACK_mkl_MKLROOT}"
           "${LAPACK_mkl_MKLROOT}"
           "${LAPACK_mkl_LIB_PATH_SUFFIXES}"
           "${LAPACK_mkl_LIB_PATH_SUFFIXES}"
@@ -383,6 +388,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
       endif()
       endif()
     endforeach()
     endforeach()
 
 
+    unset(_search)
     unset(LAPACK_mkl_ILP_MODE)
     unset(LAPACK_mkl_ILP_MODE)
     unset(LAPACK_mkl_SEARCH_SYMBOL)
     unset(LAPACK_mkl_SEARCH_SYMBOL)
     unset(LAPACK_mkl_LM)
     unset(LAPACK_mkl_LM)
@@ -646,3 +652,5 @@ if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
 endif()
 endif()
 
 
 _add_lapack_target()
 _add_lapack_target()
+unset(_lapack_fphsa_req_var)
+unset(_LAPACK_LIBRARIES)