diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index f16d176ce2e26eaed50debfabb075bc741b03c3e..70a572726cb3885c6aad61108d801aaddd83abe0 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -75,6 +75,9 @@ This module defines the following variables: to use BLAS95 interface ``BLAS95_FOUND`` library implementing the BLAS95 interface is found +``BLAS_VENDOR_NAME`` + .. versionadded:: 3.22 + vendor's name of found library implementing the BLAS interface .. _`BLAS/LAPACK Vendors`: @@ -326,9 +329,9 @@ function(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlib list(APPEND _libraries "${_library}") else() string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}") - set(_combined_name ${_combined_name}_${_lib_var}) + string(APPEND _combined_name "_${_lib_var}") if(NOT "${_deps}" STREQUAL "") - set(_combined_name ${_combined_name}_deps) + string(APPEND _combined_name "_deps") endif() if(_libraries_work) find_library(${_prefix}_${_lib_var}_LIBRARY @@ -346,7 +349,7 @@ function(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlib foreach(_flag ${_flags}) string(REGEX REPLACE "[^A-Za-z0-9]" "_" _flag_var "${_flag}") - set(_combined_name ${_combined_name}_${_flag_var}) + string(APPEND _combined_name "_${_flag_var}") endforeach() if(_libraries_work) # Test this combination of libraries. @@ -396,9 +399,12 @@ else() message(FATAL_ERROR "BLA_SIZEOF_INTEGER can have only , ANY, 4, or 8 values") endif() +set(_blas_vendor_name "") + # Implicitly linked BLAS libraries? if(BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "Implicit") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -420,6 +426,7 @@ endif() # BLAS in the Intel MKL 10+ library? if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "Intel") if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) # System-specific settings if(WIN32) @@ -690,6 +697,7 @@ endif() # gotoblas? (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) if(BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "Goto") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -712,6 +720,7 @@ if(BLA_VENDOR STREQUAL "FlexiBLAS" OR BLA_VENDOR STREQUAL "All") endif() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "FlexiBLAS") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -736,6 +745,7 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") endif() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "OpenBLAS") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -797,20 +807,21 @@ if(BLA_VENDOR MATCHES "Arm" OR BLA_VENDOR STREQUAL "All") # Check for OpenMP support, VIA BLA_VENDOR of Arm_mp or Arm_ipl64_mp if(BLA_VENDOR MATCHES "_mp") - set(_blas_armpl_lib "${_blas_armpl_lib}_mp") + string(APPEND _blas_armpl_lib "_mp") endif() if(NOT BLAS_LIBRARIES) - check_blas_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "${_blas_armpl_lib}" - "" - "" - "" - ) + set(_blas_vendor_name "Arm") + check_blas_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "${_blas_armpl_lib}" + "" + "" + "" + ) endif() unset(_blas_armpl_lib) endif() @@ -824,6 +835,7 @@ if(BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") endif() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "FLAME") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -842,6 +854,7 @@ endif() # BLAS in the ATLAS library? (http://math-atlas.sourceforge.net/) if(BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "ATLAS") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -879,6 +892,7 @@ if(BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") endif() else() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "CXML") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -901,6 +915,7 @@ if(BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") endif() else() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "DXML") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -918,6 +933,7 @@ endif() # BLAS in Sun Performance library? if(BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "SunPerf") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -942,10 +958,11 @@ if(BLA_VENDOR MATCHES "SCSL" OR BLA_VENDOR STREQUAL "All") string(APPEND _blas_scsl_lib "_i8") endif() if(BLA_VENDOR MATCHES "_mp") - set(_blas_scsl_lib "${_blas_scsl_lib}_mp") + string(APPEND _blas_scsl_lib "_mp") endif() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "SCSL") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -964,6 +981,7 @@ endif() # BLAS in SGIMATH library? if(BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "SGIMATH") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -982,13 +1000,14 @@ if(BLA_VENDOR MATCHES "IBMESSL" OR BLA_VENDOR STREQUAL "All") set(_blas_essl_lib "essl") if(BLA_VENDOR MATCHES "_SMP") - set(_blas_essl_lib "${_blas_essl_lib}smp") + string(APPEND _blas_essl_lib "smp") endif() if(_blas_sizeof_integer EQUAL 8) string(APPEND _blas_essl_lib "6464") endif() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "IBMESSL") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -1010,6 +1029,9 @@ if(BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS)) ) + if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "ACML") + endif() # try to find acml in "standard" paths if(WIN32) file(GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt") @@ -1158,6 +1180,7 @@ if(BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") endif() else() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "Apple") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -1180,6 +1203,7 @@ if(BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") endif() else() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "NAS") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -1197,17 +1221,18 @@ endif() # Elbrus Math Library? if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All") - set(_blas_eml_lib "eml") + set(_blas_eml_lib "eml") - if(_blas_sizeof_integer EQUAL 8) - string(APPEND _blas_eml_lib "_ilp64") - endif() - # Check for OpenMP support, VIA BLA_VENDOR of eml_mt - if(BLA_VENDOR MATCHES "_mt") - set(_blas_eml_lib "${_blas_eml_lib}_mt") - endif() + if(_blas_sizeof_integer EQUAL 8) + string(APPEND _blas_eml_lib "_ilp64") + endif() + # Check for OpenMP support, VIA BLA_VENDOR of eml_mt + if(BLA_VENDOR MATCHES "_mt") + string(APPEND _blas_eml_lib "_mt") + endif() - if(NOT BLAS_LIBRARIES) + if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "EML") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -1239,6 +1264,7 @@ if(NOT BLAS_LIBRARIES endif() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "Fujitsu_SSL2") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -1269,6 +1295,7 @@ if(BLA_VENDOR STREQUAL "NVHPC" OR BLA_VENDOR STREQUAL "All") endif() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "NVHPC") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -1312,6 +1339,7 @@ if(BLA_VENDOR STREQUAL "Generic" OR endif() if(NOT BLAS_LIBRARIES) + set(_blas_vendor_name "Generic") check_blas_libraries( BLAS_LIBRARIES BLAS @@ -1337,7 +1365,12 @@ if(NOT BLA_F95) find_package_handle_standard_args(BLAS REQUIRED_VARS ${_blas_fphsa_req_var}) endif() +if(BLAS_FOUND) + set(BLAS_VENDOR_NAME ${_blas_vendor_name}) +endif() + _add_blas_target() unset(_blas_fphsa_req_var) unset(_blas_sizeof_integer) unset(_BLAS_LIBRARIES) +unset(_blas_vendor_name) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 32d15db2a7fb53f5541f0423414d5a5bbd479aa8..86005569d8ad24199086b26e645357db5e42e432 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -75,6 +75,9 @@ This module defines the following variables: to use LAPACK95 ``LAPACK95_FOUND`` library implementing the LAPACK95 interface is found +``LAPACK_VENDOR_NAME`` + .. versionadded:: 3.22 + vendor's name of found library implementing the LAPACK interface Intel MKL ^^^^^^^^^ @@ -181,9 +184,9 @@ function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addl list(APPEND _libraries "${_library}") else() string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}") - set(_combined_name ${_combined_name}_${_lib_var}) + string(APPEND _combined_name "_${_lib_var}") if(NOT "${_deps}" STREQUAL "") - set(_combined_name ${_combined_name}_deps) + string(APPEND _combined_name "_deps") endif() if(_libraries_work) find_library(${_prefix}_${_lib_var}_LIBRARY @@ -201,7 +204,7 @@ function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addl foreach(_flag ${_flags}) string(REGEX REPLACE "[^A-Za-z0-9]" "_" _flag_var "${_flag}") - set(_combined_name ${_combined_name}_${_flag_var}) + string(APPEND _combined_name "_${_flag_var}") endforeach() if(_libraries_work) # Test this combination of libraries. @@ -271,6 +274,8 @@ else() message(FATAL_ERROR "BLA_SIZEOF_INTEGER can have only , ANY, 4, or 8 values") endif() +set(_lapack_vendor_name "") + # Load BLAS if(NOT LAPACK_NOT_FOUND_MESSAGE) _lapack_find_dependency(BLAS) @@ -305,6 +310,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) AND (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") AND (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)) # System-specific settings + set(_lapack_vendor_name "Intel") if(NOT WIN32) set(LAPACK_mkl_LM "-lm") set(LAPACK_mkl_LDL "-ldl") @@ -432,6 +438,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) # gotoblas? (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")) + set(_lapack_vendor_name "Goto") check_lapack_libraries( LAPACK_LIBRARIES LAPACK @@ -454,6 +461,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) string(APPEND _lapack_flexiblas_lib "64") endif() + set(_lapack_vendor_name "FlexiBLAS") check_lapack_libraries( LAPACK_LIBRARIES LAPACK @@ -478,6 +486,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) string(APPEND _lapack_openblas_lib "64") endif() + set(_lapack_vendor_name "OpenBLAS") check_lapack_libraries( LAPACK_LIBRARIES LAPACK @@ -511,9 +520,10 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) # Check for OpenMP support, VIA BLA_VENDOR of Arm_mp or Arm_ipl64_mp if(BLA_VENDOR MATCHES "_mp") - set(LAPACK_armpl_LIB "${LAPACK_armpl_LIB}_mp") + string(APPEND LAPACK_armpl_LIB "_mp") endif() + set(_lapack_vendor_name "Arm") check_lapack_libraries( LAPACK_LIBRARIES LAPACK @@ -535,6 +545,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) message(FATAL_ERROR "libFLAME does not support Int64 type") endif() else() + set(_lapack_vendor_name "FLAME") check_lapack_libraries( LAPACK_LIBRARIES LAPACK @@ -559,9 +570,10 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) endif() # Check for OpenMP support, VIA BLA_VENDOR of scs_mp if(BLA_VENDOR MATCHES "_mp") - set(_lapack_scsl_lib "${_lapack_scsl_lib}_mp") + string(APPEND _lapack_scsl_lib "_mp") endif() + set(_lapack_vendor_name "SCSL") check_lapack_libraries( LAPACK_LIBRARIES LAPACK @@ -579,6 +591,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) # BLAS in acml library? if(BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") if(BLAS_LIBRARIES MATCHES ".+acml.+") + set(_lapack_vendor_name "ACML") set(LAPACK_LIBRARIES ${BLAS_LIBRARIES}) endif() endif() @@ -591,6 +604,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) message(FATAL_ERROR "Accelerate Framework does not support Int64 type") endif() else() + set(_lapack_vendor_name "Apple") check_lapack_libraries( LAPACK_LIBRARIES LAPACK @@ -613,6 +627,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) message(FATAL_ERROR "Accelerate Framework does not support Int64 type") endif() else() + set(_lapack_vendor_name "NAS") check_lapack_libraries( LAPACK_LIBRARIES LAPACK @@ -631,6 +646,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")) if(BLAS_LIBRARIES MATCHES "eml.+") + set(_lapack_vendor_name "EML") set(LAPACK_LIBRARIES ${BLAS_LIBRARIES}) endif() endif() @@ -639,6 +655,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All")) if(BLAS_LIBRARIES MATCHES "fjlapack.+") + set(_lapack_vendor_name "Fujitsu_SSL2") set(LAPACK_LIBRARIES ${BLAS_LIBRARIES}) set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) endif() @@ -648,6 +665,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR MATCHES "IBMESSL" OR BLA_VENDOR STREQUAL "All")) if(BLAS_LIBRARIES MATCHES "essl.+") + set(_lapack_vendor_name "IBMESSL") set(LAPACK_LIBRARIES ${BLAS_LIBRARIES}) endif() endif() @@ -664,6 +682,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) string(APPEND _lapack_nvhpc_lib "_lp64") endif() + set(_lapack_vendor_name "NVHPC") check_lapack_libraries( LAPACK_LIBRARIES LAPACK @@ -716,6 +735,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) string(APPEND _lapack_generic_lib "64") endif() + set(_lapack_vendor_name "Generic") check_lapack_libraries( LAPACK_LIBRARIES LAPACK @@ -749,6 +769,10 @@ if(BLA_F95) set(LAPACK95_FOUND ${LAPACK_FOUND}) endif() +if(LAPACK_FOUND) + set(LAPACK_VENDOR_NAME ${_lapack_vendor_name}) +endif() + # On compilers that implicitly link LAPACK (such as ftn, cc, and CC on Cray HPC machines) # we used a placeholder for empty LAPACK_LIBRARIES to get through our logic above. if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") @@ -759,3 +783,4 @@ _add_lapack_target() unset(_lapack_fphsa_req_var) unset(_lapack_sizeof_integer) unset(_LAPACK_LIBRARIES) +unset(_lapack_vendor_name)