diff options
author | Brad King <brad.king@kitware.com> | 2021-10-06 14:17:24 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-10-06 14:17:46 (GMT) |
commit | ca2bc33626897bdea801ba86d0beccbf75e3f27c (patch) | |
tree | cca43233f45289f25ef985805b11eeaacf4ed5ad /Modules | |
parent | 0c606d0c3d2068cbaef4a5e29c1bffdaa2e56139 (diff) | |
parent | 64038fd5bc901f90cf0ab5a76b562db455d66c22 (diff) | |
download | CMake-ca2bc33626897bdea801ba86d0beccbf75e3f27c.zip CMake-ca2bc33626897bdea801ba86d0beccbf75e3f27c.tar.gz CMake-ca2bc33626897bdea801ba86d0beccbf75e3f27c.tar.bz2 |
Merge topic 'find-blas-lapack-sizeof-integer'
64038fd5bc Help: Add release notes for Find{BLAS,LAPACK} BLA_SIZEOF_INTEGER option
972489ae4e Find{BLAS,LAPACK}: Provide testing of BLA_SIZEOF_INTEGER
95219365ff Find{BLAS,LAPACK}: Make possible testing of ILP64 model
2cd94f3e57 Find{BLAS,LAPACK}: Specify integer type in tests
9b69307b56 Find{BLAS,LAPACK}: De-duplicate and generalize test creation logic
91fd645d46 FindLAPACK: Stop processing if LAPACK library does not have 64-bit integer API
b8a3cea51f FindBLAS: Stop processing if BLAS library does not have 64-bit integer API
d2f5c7856f FindLAPACK: Search 32/64-bit integer API via BLA_SIZEOF_INTEGER if possible
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6407
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindBLAS.cmake | 315 | ||||
-rw-r--r-- | Modules/FindLAPACK.cmake | 263 |
2 files changed, 396 insertions, 182 deletions
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index a44af4d..f16d176 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -35,6 +35,19 @@ The following variables may be set to influence this module's behavior: if set ``pkg-config`` will be used to search for a BLAS library first and if one is found that is preferred +``BLA_SIZEOF_INTEGER`` + .. versionadded:: 3.22 + + Specify the BLAS/LAPACK library integer size: + + ``4`` + Search for a BLAS/LAPACK with 32-bit integer interfaces. + ``8`` + Search for a BLAS/LAPACK with 64-bit integer interfaces. + ``ANY`` + Search for any BLAS/LAPACK. + Most likely, a BLAS/LAPACK with 32-bit integer interfaces will be found. + Imported targets ^^^^^^^^^^^^^^^^ @@ -101,10 +114,10 @@ BLAS/LAPACK Vendors ``FlexiBLAS`` .. versionadded:: 3.19 -``Fujitsu_SSL2``, ``Fujitsu_SSL2BLAMP`` +``Fujitsu_SSL2``, ``Fujitsu_SSL2BLAMP``, ``Fujitsu_SSL2SVE``, ``Fujitsu_SSL2BLAMPSVE`` .. versionadded:: 3.20 - Fujitsu SSL2 serial and parallel blas/lapack + Fujitsu SSL2 serial and parallel blas/lapack with SVE instructions ``Goto`` GotoBLAS @@ -372,6 +385,17 @@ else() endif() endif() +if(NOT BLA_SIZEOF_INTEGER) + # in the reality we do not know which API of BLAS/LAPACK is masked in library + set(_blas_sizeof_integer "ANY") +elseif((BLA_SIZEOF_INTEGER STREQUAL "ANY") OR + (BLA_SIZEOF_INTEGER STREQUAL "4") OR + (BLA_SIZEOF_INTEGER STREQUAL "8")) + set(_blas_sizeof_integer ${BLA_SIZEOF_INTEGER}) +else() + message(FATAL_ERROR "BLA_SIZEOF_INTEGER can have only <no value>, ANY, 4, or 8 values") +endif() + # Implicitly linked BLAS libraries? if(BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) @@ -432,10 +456,16 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") find_package(Threads REQUIRED) endif() - if(BLA_VENDOR MATCHES "_64ilp") + if(_blas_sizeof_integer EQUAL 8) set(BLAS_mkl_ILP_MODE "ilp64") - else() + elseif(_blas_sizeof_integer EQUAL 4) set(BLAS_mkl_ILP_MODE "lp64") + else() + if(BLA_VENDOR MATCHES "_64ilp") + set(BLAS_mkl_ILP_MODE "ilp64") + else() + set(BLAS_mkl_ILP_MODE "lp64") + endif() endif() set(BLAS_SEARCH_LIBS "") @@ -675,29 +705,43 @@ endif() # FlexiBLAS? (http://www.mpi-magdeburg.mpg.de/mpcsc/software/FlexiBLAS/) if(BLA_VENDOR STREQUAL "FlexiBLAS" OR BLA_VENDOR STREQUAL "All") + set(_blas_flexiblas_lib "flexiblas") + + if(_blas_sizeof_integer EQUAL 8) + string(APPEND _blas_flexiblas_lib "64") + endif() + if(NOT BLAS_LIBRARIES) check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" - "flexiblas" + "${_blas_flexiblas_lib}" "" "" "" ) endif() + + unset(_blas_flexiblas_lib) endif() # OpenBLAS? (http://www.openblas.net) if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") + set(_blas_openblas_lib "openblas") + + if(_blas_sizeof_integer EQUAL 8) + string(APPEND _blas_openblas_lib "64") + endif() + if(NOT BLAS_LIBRARIES) check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" - "openblas" + "${_blas_openblas_lib}" "" "" "" @@ -724,24 +768,32 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") BLAS sgemm "" - "openblas" + "${_blas_openblas_lib}" "${_threadlibs}" "" "" ) unset(_threadlibs) endif() + + unset(_blas_openblas_lib) endif() # ArmPL blas library? (https://developer.arm.com/tools-and-software/server-and-hpc/compile/arm-compiler-for-linux/arm-performance-libraries) if(BLA_VENDOR MATCHES "Arm" OR BLA_VENDOR STREQUAL "All") # Check for 64bit Integer support - if(BLA_VENDOR MATCHES "_ilp64") - set(_blas_armpl_lib "armpl_ilp64") - else() - set(_blas_armpl_lib "armpl_lp64") - endif() + if(_blas_sizeof_integer EQUAL 8) + set(_blas_armpl_lib "armpl_ilp64") + elseif(_blas_sizeof_integer EQUAL 4) + set(_blas_armpl_lib "armpl_lp64") + else() + if(BLA_VENDOR MATCHES "_ilp64") + set(_blas_armpl_lib "armpl_ilp64") + else() + set(_blas_armpl_lib "armpl_lp64") + endif() + endif() # Check for OpenMP support, VIA BLA_VENDOR of Arm_mp or Arm_ipl64_mp if(BLA_VENDOR MATCHES "_mp") @@ -765,18 +817,26 @@ endif() # FLAME's blis library? (https://github.com/flame/blis) if(BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") + set(_blas_flame_lib "blis") + + if(_blas_sizeof_integer EQUAL 8) + string(APPEND _blas_flame_lib "64") + endif() + if(NOT BLAS_LIBRARIES) check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" - "blis" + "${_blas_flame_lib}" "" "" "" ) endif() + + unset(_blas_flame_lib) endif() # BLAS in the ATLAS library? (http://math-atlas.sourceforge.net/) @@ -813,33 +873,45 @@ endif() # BLAS in Alpha CXML library? if(BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_blas_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "cxml" - "" - "" - "" - ) + if(_blas_sizeof_integer EQUAL 8) + if(BLA_VENDOR STREQUAL "CXML") + message(FATAL_ERROR "CXML does not support Int64 type") + endif() + else() + if(NOT BLAS_LIBRARIES) + check_blas_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "cxml" + "" + "" + "" + ) + endif() endif() endif() # BLAS in Alpha DXML library? (now called CXML, see above) if(BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_blas_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "dxml" - "" - "" - "" - ) + if(_blas_sizeof_integer EQUAL 8) + if(BLA_VENDOR STREQUAL "DXML") + message(FATAL_ERROR "DXML does not support Int64 type") + endif() + else() + if(NOT BLAS_LIBRARIES) + check_blas_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "dxml" + "" + "" + "" + ) + endif() endif() endif() @@ -866,6 +938,9 @@ endif() if(BLA_VENDOR MATCHES "SCSL" OR BLA_VENDOR STREQUAL "All") set(_blas_scsl_lib "scs") + if(_blas_sizeof_integer EQUAL 8) + string(APPEND _blas_scsl_lib "_i8") + endif() if(BLA_VENDOR MATCHES "_mp") set(_blas_scsl_lib "${_blas_scsl_lib}_mp") endif() @@ -909,6 +984,10 @@ if(BLA_VENDOR MATCHES "IBMESSL" OR BLA_VENDOR STREQUAL "All") if(BLA_VENDOR MATCHES "_SMP") set(_blas_essl_lib "${_blas_essl_lib}smp") endif() + if(_blas_sizeof_integer EQUAL 8) + string(APPEND _blas_essl_lib "6464") + endif() + if(NOT BLAS_LIBRARIES) check_blas_libraries( BLAS_LIBRARIES @@ -946,7 +1025,7 @@ if(BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT) if(_ACML_ROOT) get_filename_component(_ACML_ROOT ${_ACML_ROOT} PATH) - if(SIZEOF_INTEGER EQUAL 8) + if(_blas_sizeof_integer EQUAL 8) set(_ACML_PATH_SUFFIX "_int64") else() set(_ACML_PATH_SUFFIX "") @@ -1073,33 +1152,45 @@ endif() # ACML # Apple BLAS library? if(BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_blas_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "Accelerate" - "" - "" - "" - ) + if(_blas_sizeof_integer EQUAL 8) + if(BLA_VENDOR STREQUAL "Apple") + message(FATAL_ERROR "Accelerate Framework does not support Int64 type") + endif() + else() + if(NOT BLAS_LIBRARIES) + check_blas_libraries( + BLAS_LIBRARIES + BLAS + dgemm + "" + "Accelerate" + "" + "" + "" + ) + endif() endif() endif() # Apple NAS (vecLib) library? if(BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_blas_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "vecLib" - "" - "" - "" - ) + if(_blas_sizeof_integer EQUAL 8) + if(BLA_VENDOR STREQUAL "NAS") + message(FATAL_ERROR "Accelerate Framework does not support Int64 type") + endif() + else() + if(NOT BLAS_LIBRARIES) + check_blas_libraries( + BLAS_LIBRARIES + BLAS + dgemm + "" + "vecLib" + "" + "" + "" + ) + endif() endif() endif() @@ -1108,6 +1199,9 @@ if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All") 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") @@ -1130,45 +1224,107 @@ endif() # Fujitsu SSL2 Library? if(NOT BLAS_LIBRARIES - AND (BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All")) - if(BLA_VENDOR STREQUAL "Fujitsu_SSL2BLAMP") - set(_ssl2_suffix BLAMP) - else() - set(_ssl2_suffix) + AND (BLA_VENDOR MATCHES "^Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All")) + set(_blas_fjlapack_lib "fjlapack") + set(_blas_fjlapack_flags "-Kopenmp") + + if(BLA_VENDOR MATCHES "BLAMP") + string(APPEND _blas_fjlapack_lib "ex") endif() - check_blas_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "-SSL2${_ssl2_suffix}" - "" - "" - "" - "" - ) - if(BLAS_LIBRARIES) - set(BLAS_LINKER_FLAGS "-SSL2${_ssl2_suffix}") - set(_blas_fphsa_req_var BLAS_LINKER_FLAGS) + if(BLA_VENDOR MATCHES "SVE") + string(APPEND _blas_fjlapack_lib "sve") + endif() + if(_blas_sizeof_integer EQUAL 8) + string(APPEND _blas_fjlapack_lib "_ilp64") endif() - unset(_ssl2_suffix) + + if(NOT BLAS_LIBRARIES) + check_blas_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "${_blas_fjlapack_flags}" + "${_blas_fjlapack_lib}" + "" + "" + "" + ) + if(BLAS_LIBRARIES) + set(BLAS_LINKER_FLAGS ${_blas_fjlapack_flags}) + endif() + endif() + + unset(_blas_fjlapack_flags) + unset(_blas_fjlapack_lib) +endif() + +# BLAS in nVidia HPC SDK? (https://developer.nvidia.com/hpc-sdk) +if(BLA_VENDOR STREQUAL "NVHPC" OR BLA_VENDOR STREQUAL "All") + set(_blas_nvhpc_lib "blas") + + if(_blas_sizeof_integer EQUAL 8) + string(APPEND _blas_nvhpc_lib "_ilp64") + elseif(_blas_sizeof_integer EQUAL 4) + string(APPEND _blas_nvhpc_lib "_lp64") + endif() + + if(NOT BLAS_LIBRARIES) + check_blas_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "${_blas_nvhpc_lib}" + "" + "" + "" + ) + endif() + + # an additional check for NVHPC 2020 + # which does not have differentiation + # between lp64 and ilp64 modes + if(NOT BLAS_LIBRARIES AND NOT _blas_sizeof_integer EQUAL 8) + set(_blas_nvhpc_lib "blas") + + check_blas_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "${_blas_nvhpc_lib}" + "" + "" + "" + ) + endif() + + unset(_blas_nvhpc_lib) endif() # Generic BLAS library? if(BLA_VENDOR STREQUAL "Generic" OR - BLA_VENDOR STREQUAL "NVHPC" OR BLA_VENDOR STREQUAL "All") + set(_blas_generic_lib "blas") + + if(_blas_sizeof_integer EQUAL 8) + string(APPEND _blas_generic_lib "64") + endif() + if(NOT BLAS_LIBRARIES) check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" - "blas" + "${_blas_generic_lib}" "" "" "" ) endif() + + unset(_blas_generic_lib) endif() # On compilers that implicitly link BLAS (i.e. CrayPrgEnv) we used a @@ -1183,4 +1339,5 @@ endif() _add_blas_target() unset(_blas_fphsa_req_var) +unset(_blas_sizeof_integer) unset(_BLAS_LIBRARIES) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index f36acfd..32d15db 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -35,6 +35,19 @@ The following variables may be set to influence this module's behavior: if set ``pkg-config`` will be used to search for a LAPACK library first and if one is found that is preferred +``BLA_SIZEOF_INTEGER`` + .. versionadded:: 3.22 + + Specify the BLAS/LAPACK library integer size: + + ``4`` + Search for a BLAS/LAPACK with 32-bit integer interfaces. + ``8`` + Search for a BLAS/LAPACK with 64-bit integer interfaces. + ``ANY`` + Search for any BLAS/LAPACK. + Most likely, a BLAS/LAPACK with 32-bit integer interfaces will be found. + Imported targets ^^^^^^^^^^^^^^^^ @@ -247,6 +260,17 @@ if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_CO "FindLAPACK requires Fortran, C, or C++ to be enabled.") endif() +if(NOT BLA_SIZEOF_INTEGER) + # in the reality we do not know which API of BLAS/LAPACK is masked in library + set(_lapack_sizeof_integer "ANY") +elseif((BLA_SIZEOF_INTEGER STREQUAL "ANY") OR + (BLA_SIZEOF_INTEGER STREQUAL "4") OR + (BLA_SIZEOF_INTEGER STREQUAL "8")) + set(_lapack_sizeof_integer ${BLA_SIZEOF_INTEGER}) +else() + message(FATAL_ERROR "BLA_SIZEOF_INTEGER can have only <no value>, ANY, 4, or 8 values") +endif() + # Load BLAS if(NOT LAPACK_NOT_FOUND_MESSAGE) _lapack_find_dependency(BLAS) @@ -288,10 +312,16 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) _lapack_find_dependency(Threads) - if(BLA_VENDOR MATCHES "_64ilp") + if(_lapack_sizeof_integer EQUAL 8) set(LAPACK_mkl_ILP_MODE "ilp64") - else() + elseif(_lapack_sizeof_integer EQUAL 4) set(LAPACK_mkl_ILP_MODE "lp64") + else() + if(BLA_VENDOR MATCHES "_64ilp") + set(LAPACK_mkl_ILP_MODE "ilp64") + else() + set(LAPACK_mkl_ILP_MODE "lp64") + endif() endif() set(LAPACK_SEARCH_LIBS "") @@ -418,43 +448,65 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) # FlexiBLAS? (http://www.mpi-magdeburg.mpg.de/mpcsc/software/FlexiBLAS/) if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "FlexiBLAS" OR BLA_VENDOR STREQUAL "All")) + set(_lapack_flexiblas_lib "flexiblas") + + if(_lapack_sizeof_integer EQUAL 8) + string(APPEND _lapack_flexiblas_lib "64") + endif() + check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" - "flexiblas" + "${_lapack_flexiblas_lib}" "" "" "" "${BLAS_LIBRARIES}" ) + + unset(_lapack_flexiblas_lib) endif() # OpenBLAS? (http://www.openblas.net) if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")) + set(_lapack_openblas_lib "openblas") + + if(_lapack_sizeof_integer EQUAL 8) + string(APPEND _lapack_openblas_lib "64") + endif() + check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" - "openblas" + "${_lapack_openblas_lib}" "" "" "" "${BLAS_LIBRARIES}" ) + + unset(_lapack_openblas_lib) endif() # ArmPL? (https://developer.arm.com/tools-and-software/server-and-hpc/compile/arm-compiler-for-linux/arm-performance-libraries) if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR MATCHES "Arm" OR BLA_VENDOR STREQUAL "All")) # Check for 64bit Integer support - if(BLA_VENDOR MATCHES "_ilp64") + if(_lapack_sizeof_integer EQUAL 8) set(LAPACK_armpl_LIB "armpl_ilp64") - else() + elseif(_lapack_sizeof_integer EQUAL 4) set(LAPACK_armpl_LIB "armpl_lp64") + else() + if(BLA_VENDOR MATCHES "_ilp64") + set(LAPACK_armpl_LIB "armpl_ilp64") + else() + set(LAPACK_armpl_LIB "armpl_lp64") + endif() endif() # Check for OpenMP support, VIA BLA_VENDOR of Arm_mp or Arm_ipl64_mp @@ -478,17 +530,23 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) # FLAME's blis library? (https://github.com/flame/blis) if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All")) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "flame" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) + if(_lapack_sizeof_integer EQUAL 8) + if(BLA_VENDOR STREQUAL "FLAME") + message(FATAL_ERROR "libFLAME does not support Int64 type") + endif() + else() + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "flame" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() endif() # LAPACK in SCSL library? (SGI/Cray Scientific Library) @@ -496,6 +554,9 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) AND (BLA_VENDOR MATCHES "SCSL" OR BLA_VENDOR STREQUAL "All")) set(_lapack_scsl_lib "scs") + if(_lapack_sizeof_integer EQUAL 8) + string(APPEND _lapack_scsl_lib "_i8") + endif() # Check for OpenMP support, VIA BLA_VENDOR of scs_mp if(BLA_VENDOR MATCHES "_mp") set(_lapack_scsl_lib "${_lapack_scsl_lib}_mp") @@ -525,129 +586,116 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) # Apple LAPACK library? if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "Accelerate" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) + if(_lapack_sizeof_integer EQUAL 8) + if(BLA_VENDOR STREQUAL "Apple") + message(FATAL_ERROR "Accelerate Framework does not support Int64 type") + endif() + else() + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "Accelerate" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() endif() # Apple NAS (vecLib) library? if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "vecLib" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) + if(_lapack_sizeof_integer EQUAL 8) + if(BLA_VENDOR STREQUAL "NAS") + message(FATAL_ERROR "Accelerate Framework does not support Int64 type") + endif() + else() + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "vecLib" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() endif() # Elbrus Math Library? if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")) - - set(LAPACK_EML_LIB "eml") - - # Check for OpenMP support, VIA BLA_VENDOR of eml_mt - if(BLA_VENDOR MATCHES "_mt") - set(LAPACK_EML_LIB "${LAPACK_EML_LIB}_mt") + if(BLAS_LIBRARIES MATCHES "eml.+") + set(LAPACK_LIBRARIES ${BLAS_LIBRARIES}) endif() - - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "${LAPACK_EML_LIB}" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) endif() # Fujitsu SSL2 Library? if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All")) - if(BLA_VENDOR STREQUAL "Fujitsu_SSL2BLAMP") - set(_ssl2_suffix BLAMP) - else() - set(_ssl2_suffix) - endif() - set(_ssl2_blas) - if(BLAS_LIBRARIES STREQUAL "") - set(_ssl2_blas "${BLAS_LINKER_FLAGS}") - else() - set(_ssl2_blas "${BLAS_LIBRARIES} ${BLAS_LINKER_FLAGS}") - endif() - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "-SSL2${_ssl2_suffix}" - "" - "" - "" - "" - "${_ssl2_blas}" - ) - if(LAPACK_LIBRARIES) - set(LAPACK_LINKER_FLAGS "-SSL2${_ssl2_suffix}") - set(_lapack_fphsa_req_var LAPACK_LINKER_FLAGS) + if(BLAS_LIBRARIES MATCHES "fjlapack.+") + set(LAPACK_LIBRARIES ${BLAS_LIBRARIES}) + set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) endif() - unset(_ssl2_suffix) endif() # LAPACK in IBM ESSL library? if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR MATCHES "IBMESSL" OR BLA_VENDOR STREQUAL "All")) - set(_lapack_essl_lib "essl") - - # Check for OpenMP support, VIA BLA_VENDOR of esslsmp - if(BLA_VENDOR MATCHES "_SMP") - set(_lapack_essl_lib "${_lapack_essl_lib}smp") + if(BLAS_LIBRARIES MATCHES "essl.+") + set(LAPACK_LIBRARIES ${BLAS_LIBRARIES}) endif() - - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "${_lapack_essl_lib}" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) - unset(_lapack_essl_lib) endif() # NVHPC Library? + if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR MATCHES "NVHPC" OR BLA_VENDOR STREQUAL "All")) + set(_lapack_nvhpc_lib "lapack") + + if(_lapack_sizeof_integer EQUAL 8) + string(APPEND _lapack_nvhpc_lib "_ilp64") + elseif(_lapack_sizeof_integer EQUAL 4) + string(APPEND _lapack_nvhpc_lib "_lp64") + endif() + check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" - "lapack" + "${_lapack_nvhpc_lib}" "-fortranlibs" "" "" "${BLAS_LIBRARIES}" ) + + # an additional check for NVHPC 2020 + # which does not have differentiation + # between lp64 and ilp64 modes + if(NOT LAPACK_LIBRARIES AND NOT _lapack_sizeof_integer EQUAL 8) + set(_lapack_nvhpc_lib "lapack") + + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "${_lapack_nvhpc_lib}" + "-fortranlibs" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() + + unset(_lapack_nvhpc_lib) endif() # Generic LAPACK library? @@ -655,6 +703,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) AND (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")) + set(_lapack_generic_lib "lapack") if(BLA_STATIC) # We do not know for sure how the LAPACK reference implementation # is built on this host. Guess typical dependencies. @@ -662,18 +711,25 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) else() set(_lapack_generic_deps "") endif() + + if(_lapack_sizeof_integer EQUAL 8) + string(APPEND _lapack_generic_lib "64") + endif() + check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" - "lapack" + "${_lapack_generic_lib}" "${_lapack_generic_deps}" "" "" "${BLAS_LIBRARIES}" ) + unset(_lapack_generic_deps) + unset(_lapack_generic_lib) endif() endif() @@ -701,4 +757,5 @@ endif() _add_lapack_target() unset(_lapack_fphsa_req_var) +unset(_lapack_sizeof_integer) unset(_LAPACK_LIBRARIES) |