From 8a859fd6aef8f6c829eaf2a9b0628f1e049951c0 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 10:59:29 +0300 Subject: FindLAPACK: Fujitsu_SSL2: LAPACK is in BLAS --- Modules/FindLAPACK.cmake | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index f36acfd..7b5e01d 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -581,33 +581,10 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) # 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? -- cgit v0.12 From f17f20f6cd8a96a57965f08f8f8fecaedeb277af Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:00:27 +0300 Subject: FindLAPACK: IBMESSL: LAPACK is in BLAS --- Modules/FindLAPACK.cmake | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 7b5e01d..aee0dc2 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -590,25 +590,9 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) # 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? -- cgit v0.12 From 7cb89314dd6f2b7d919133b83c1114a55ac7a209 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:00:57 +0300 Subject: FindLAPACK: EML: LAPACK is in BLAS --- Modules/FindLAPACK.cmake | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index aee0dc2..3f9635e 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -557,25 +557,9 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) # 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? -- cgit v0.12 From 9f525327574e3381d425bee02173ff03aeb1351c Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:02:47 +0300 Subject: FindLAPACK: Update NVHPC --- Modules/FindLAPACK.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 3f9635e..ca62b84 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -580,19 +580,24 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) endif() # NVHPC Library? + if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR MATCHES "NVHPC" OR BLA_VENDOR STREQUAL "All")) + set(_lapack_nvhpc_lib "lapack") + check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" - "lapack" + "${_lapack_nvhpc_lib}" "-fortranlibs" "" "" "${BLAS_LIBRARIES}" ) + + unset(_lapack_nvhpc_lib) endif() # Generic LAPACK library? -- cgit v0.12 From 285c518937b6a3d7cfd9866d5e91910a587523d5 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:04:22 +0300 Subject: FindLAPACK: Update OpenBLAS --- Modules/FindLAPACK.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index ca62b84..7bef443 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -434,17 +434,21 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) # OpenBLAS? (http://www.openblas.net) if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")) + set(_lapack_openblas_lib "openblas") + 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) -- cgit v0.12 From 8fdbd272b580344da2fbca33dd960dc2b29a43d1 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:05:12 +0300 Subject: FindLAPACK: Update FlexiBLAS --- Modules/FindLAPACK.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 7bef443..b82a464 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -418,17 +418,21 @@ 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") + check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" - "flexiblas" + "${_lapack_flexiblas_lib}" "" "" "" "${BLAS_LIBRARIES}" ) + + unset(_lapack_flexiblas_lib) endif() # OpenBLAS? (http://www.openblas.net) -- cgit v0.12 From 2531e464dfefaacdd06c6b28e7f59897510a52c1 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:30:46 +0300 Subject: FindLAPACK: Update Generic LAPACK --- Modules/FindLAPACK.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index b82a464..824cfd2 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -613,6 +613,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. @@ -625,13 +626,15 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) LAPACK cheev "" - "lapack" + "${_lapack_generic_lib}" "${_lapack_generic_deps}" "" "" "${BLAS_LIBRARIES}" ) + unset(_lapack_generic_deps) + unset(_lapack_generic_lib) endif() endif() -- cgit v0.12 From c4d4f0708b9c8aa0cba6d8d031aee7d30798dba6 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:13:33 +0300 Subject: FindBLAS: Move NVHPC from Generic BLAS --- Modules/FindBLAS.cmake | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index a44af4d..5743f9d 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -1153,9 +1153,28 @@ if(NOT BLAS_LIBRARIES unset(_ssl2_suffix) 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(NOT BLAS_LIBRARIES) + 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") if(NOT BLAS_LIBRARIES) check_blas_libraries( -- cgit v0.12 From bf048d2ddd3472c52cadd9c1562717ef29d6323a Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:29:18 +0300 Subject: FindBLAS: Update Generic BLAS --- Modules/FindBLAS.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 5743f9d..575d223 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -1176,18 +1176,22 @@ endif() # Generic BLAS library? if(BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") + set(_blas_generic_lib "blas") + 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 -- cgit v0.12 From 84b7e2e15d6ed70474c345484c2961725f066142 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:19:54 +0300 Subject: FindBLAS: Update FLAME --- Modules/FindBLAS.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 575d223..ca3afc4 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -765,18 +765,22 @@ 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(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/) -- cgit v0.12 From 21250d4dd2e0e6cdb3da089b6f9e0d8e30614f40 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:20:15 +0300 Subject: FindBLAS: Update OpenBLAS --- Modules/FindBLAS.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index ca3afc4..5ce726c 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -691,13 +691,15 @@ endif() # OpenBLAS? (http://www.openblas.net) if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") + set(_blas_openblas_lib "openblas") + if(NOT BLAS_LIBRARIES) check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" - "openblas" + "${_blas_openblas_lib}" "" "" "" @@ -724,13 +726,15 @@ 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) -- cgit v0.12 From 88969b51679784ce2f64da4d8ceefbf802cfcdff Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:21:16 +0300 Subject: FindBLAS: Update FlexiBLAS --- Modules/FindBLAS.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 5ce726c..e22fae3 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -675,18 +675,22 @@ 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(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) -- cgit v0.12 From f8079ec8d0c82d1010bbc889e3faaef50898060b Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:25:54 +0300 Subject: FindBLAS: Update Fujitsu_SSL2 --- Modules/FindBLAS.cmake | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index e22fae3..6d6e84d 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -101,10 +101,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 @@ -1142,27 +1142,35 @@ 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() - 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) -- cgit v0.12 From 50696efc64b3f992df96a260886fe7c6befa9013 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:47:15 +0300 Subject: FindBLAS: Search 32/64-bit integer API via BLA_SIZEOF_INTEGER if possible --- Modules/FindBLAS.cmake | 106 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 98 insertions(+), 8 deletions(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 6d6e84d..043d9c1 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 ^^^^^^^^^^^^^^^^ @@ -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 , 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 "") @@ -677,6 +707,10 @@ endif() 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 @@ -697,6 +731,10 @@ endif() 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 @@ -745,11 +783,17 @@ endif() 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") @@ -775,6 +819,10 @@ endif() 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 @@ -878,6 +926,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() @@ -921,6 +972,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 @@ -958,7 +1013,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 "") @@ -1120,6 +1175,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") @@ -1152,6 +1210,9 @@ if(NOT BLAS_LIBRARIES 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() if(NOT BLAS_LIBRARIES) check_blas_libraries( @@ -1177,6 +1238,12 @@ endif() 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 @@ -1190,6 +1257,24 @@ if(BLA_VENDOR STREQUAL "NVHPC" OR BLA_VENDOR STREQUAL "All") ) 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() @@ -1198,6 +1283,10 @@ if(BLA_VENDOR STREQUAL "Generic" 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 @@ -1226,4 +1315,5 @@ endif() _add_blas_target() unset(_blas_fphsa_req_var) +unset(_blas_sizeof_integer) unset(_BLAS_LIBRARIES) -- cgit v0.12 From d2f5c7856f60c3487581ba3b279a4e252d855fa6 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 11:58:01 +0300 Subject: FindLAPACK: Search 32/64-bit integer API via BLA_SIZEOF_INTEGER if possible --- Modules/FindLAPACK.cmake | 86 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 82 insertions(+), 4 deletions(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 824cfd2..dd45273 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 , 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 "") @@ -420,6 +450,10 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) 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 @@ -440,6 +474,10 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) 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 @@ -459,10 +497,16 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) 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 @@ -504,6 +548,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") @@ -593,6 +640,12 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) 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 @@ -605,6 +658,25 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) "${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() @@ -621,6 +693,11 @@ 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 @@ -662,4 +739,5 @@ endif() _add_lapack_target() unset(_lapack_fphsa_req_var) +unset(_lapack_sizeof_integer) unset(_LAPACK_LIBRARIES) -- cgit v0.12 From b8a3cea51fc2853200801d599d873472b80b6619 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 12:01:21 +0300 Subject: FindBLAS: Stop processing if BLAS library does not have 64-bit integer API --- Modules/FindBLAS.cmake | 112 ++++++++++++++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 44 deletions(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 043d9c1..f16d176 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -873,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() @@ -1140,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() -- cgit v0.12 From 91fd645d46adeaa22221b0c08307d2dc35b81ade Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 7 Aug 2021 12:02:42 +0300 Subject: FindLAPACK: Stop processing if LAPACK library does not have 64-bit integer API --- Modules/FindLAPACK.cmake | 84 +++++++++++++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index dd45273..32d15db 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -530,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) @@ -580,33 +586,45 @@ 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? -- cgit v0.12 From 9b69307b56376e2bd0a82539562f9e59a808194b Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Sep 2021 14:55:42 -0400 Subject: Find{BLAS,LAPACK}: De-duplicate and generalize test creation logic Interpret `CMake_TEST_FindBLAS` and `CMake_TEST_FindLAPACK` as a sequence of option assignments intermixed with vendor names. --- .gitlab/ci/configure_debian10_aarch64_ninja.cmake | 6 +-- .gitlab/ci/configure_debian10_ninja.cmake | 6 +-- .gitlab/ci/configure_fedora34_makefiles.cmake | 6 +-- .gitlab/ci/configure_intelcompiler_common.cmake | 15 ++++--- Tests/FindBLAS/CMakeLists.txt | 51 +---------------------- Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake | 43 +++++++++++++++++++ Tests/FindLAPACK/CMakeLists.txt | 51 +---------------------- 7 files changed, 60 insertions(+), 118 deletions(-) create mode 100644 Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake index a6b7cb5..8e03eef 100644 --- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake +++ b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake @@ -1,6 +1,5 @@ set(CMake_TEST_FindALSA "ON" CACHE BOOL "") -set(CMake_TEST_FindBLAS "All" CACHE STRING "") -set(CMake_TEST_FindBLAS_STATIC "Generic" CACHE STRING "") +set(CMake_TEST_FindBLAS "All;static=1;Generic" CACHE STRING "") set(CMake_TEST_FindBoost "ON" CACHE BOOL "") set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "") set(CMake_TEST_FindBZip2 "ON" CACHE BOOL "") @@ -25,8 +24,7 @@ set(CMake_TEST_FindIconv "ON" CACHE BOOL "") set(CMake_TEST_FindIntl "ON" CACHE BOOL "") set(CMake_TEST_FindJPEG "ON" CACHE BOOL "") set(CMake_TEST_FindJsonCpp "ON" CACHE BOOL "") -set(CMake_TEST_FindLAPACK "All" CACHE STRING "") -set(CMake_TEST_FindLAPACK_STATIC "Generic" CACHE STRING "") +set(CMake_TEST_FindLAPACK "All;static=1;Generic" CACHE STRING "") set(CMake_TEST_FindLibArchive "ON" CACHE BOOL "") set(CMake_TEST_FindLibinput "ON" CACHE BOOL "") set(CMake_TEST_FindLibLZMA "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake index 10d0997..d50ab1f 100644 --- a/.gitlab/ci/configure_debian10_ninja.cmake +++ b/.gitlab/ci/configure_debian10_ninja.cmake @@ -1,6 +1,5 @@ set(CMake_TEST_FindALSA "ON" CACHE BOOL "") -set(CMake_TEST_FindBLAS "All" CACHE STRING "") -set(CMake_TEST_FindBLAS_STATIC "Generic" CACHE STRING "") +set(CMake_TEST_FindBLAS "All;static=1;Generic" CACHE STRING "") set(CMake_TEST_FindBoost "ON" CACHE BOOL "") set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "") set(CMake_TEST_FindBZip2 "ON" CACHE BOOL "") @@ -25,8 +24,7 @@ set(CMake_TEST_FindIconv "ON" CACHE BOOL "") set(CMake_TEST_FindIntl "ON" CACHE BOOL "") set(CMake_TEST_FindJPEG "ON" CACHE BOOL "") set(CMake_TEST_FindJsonCpp "ON" CACHE BOOL "") -set(CMake_TEST_FindLAPACK "All" CACHE STRING "") -set(CMake_TEST_FindLAPACK_STATIC "Generic" CACHE STRING "") +set(CMake_TEST_FindLAPACK "All;static=1;Generic" CACHE STRING "") set(CMake_TEST_FindLibArchive "ON" CACHE BOOL "") set(CMake_TEST_FindLibinput "ON" CACHE BOOL "") set(CMake_TEST_FindLibLZMA "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_fedora34_makefiles.cmake b/.gitlab/ci/configure_fedora34_makefiles.cmake index d4bdb6a..a482378 100644 --- a/.gitlab/ci/configure_fedora34_makefiles.cmake +++ b/.gitlab/ci/configure_fedora34_makefiles.cmake @@ -1,6 +1,5 @@ set(CMake_TEST_FindALSA "ON" CACHE BOOL "") -set(CMake_TEST_FindBLAS "All" CACHE STRING "") -set(CMake_TEST_FindBLAS_STATIC "Generic" CACHE STRING "") +set(CMake_TEST_FindBLAS "All;static=1;Generic" CACHE STRING "") set(CMake_TEST_FindBoost "ON" CACHE BOOL "") set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "") set(CMake_TEST_FindBZip2 "ON" CACHE BOOL "") @@ -25,8 +24,7 @@ set(CMake_TEST_FindIconv "ON" CACHE BOOL "") set(CMake_TEST_FindIntl "ON" CACHE BOOL "") set(CMake_TEST_FindJPEG "ON" CACHE BOOL "") set(CMake_TEST_FindJsonCpp "ON" CACHE BOOL "") -set(CMake_TEST_FindLAPACK "All" CACHE STRING "") -set(CMake_TEST_FindLAPACK_STATIC "Generic" CACHE STRING "") +set(CMake_TEST_FindLAPACK "All;static=1;Generic" CACHE STRING "") set(CMake_TEST_FindLibArchive "ON" CACHE BOOL "") set(CMake_TEST_FindLibinput "ON" CACHE BOOL "") set(CMake_TEST_FindLibLZMA "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_intelcompiler_common.cmake b/.gitlab/ci/configure_intelcompiler_common.cmake index be175e4..2698f88 100644 --- a/.gitlab/ci/configure_intelcompiler_common.cmake +++ b/.gitlab/ci/configure_intelcompiler_common.cmake @@ -1,10 +1,9 @@ -set(CMake_TEST_FindBLAS "All;Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "") -set(CMake_TEST_FindBLAS_All "Intel10_64lp" CACHE STRING "") -set(CMake_TEST_FindBLAS_STATIC "All;Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "") -set(CMake_TEST_FindBLAS_STATIC_All "Intel10_64lp" CACHE STRING "") -set(CMake_TEST_FindLAPACK "All;Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "") -set(CMake_TEST_FindLAPACK_All "Intel10_64lp" CACHE STRING "") -set(CMake_TEST_FindLAPACK_STATIC "All;Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "") -set(CMake_TEST_FindLAPACK_STATIC_All "Intel10_64lp" CACHE STRING "") +set(blas_lapack_cases + all=Intel10_64lp + static=0 All Intel10_64lp compiler=gcc Intel10_64lp compiler= + static=1 All Intel10_64lp compiler=gcc Intel10_64lp compiler= + ) +set(CMake_TEST_FindBLAS "${blas_lapack_cases}" CACHE STRING "") +set(CMake_TEST_FindLAPACK "${blas_lapack_cases}" CACHE STRING "") include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/Tests/FindBLAS/CMakeLists.txt b/Tests/FindBLAS/CMakeLists.txt index 482cee8..00b254d 100644 --- a/Tests/FindBLAS/CMakeLists.txt +++ b/Tests/FindBLAS/CMakeLists.txt @@ -1,49 +1,2 @@ -foreach(variant IN LISTS CMake_TEST_FindBLAS) - if(variant MATCHES "^([^.]+)\\.(.*)$") - set(vendor "${CMAKE_MATCH_1}") - set(alt_compiler "-DCMAKE_C_COMPILER=${CMAKE_MATCH_2}") - else() - set(vendor "${variant}") - set(alt_compiler "") - endif() - if(vendor STREQUAL "All" AND CMake_TEST_FindBLAS_All) - set(EXPECT_All "-DEXPECT_All=${CMake_TEST_FindBLAS_All}") - else() - set(EXPECT_All "") - endif() - add_test(NAME FindBLAS.Test_${variant} COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindBLAS/Test" - "${CMake_BINARY_DIR}/Tests/FindBLAS/Test_${variant}" - ${build_generator_args} - --build-project TestFindBLAS - --build-options ${build_options} ${alt_compiler} ${EXPECT_All} -DBLA_VENDOR=${vendor} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) -endforeach() - -foreach(variant IN LISTS CMake_TEST_FindBLAS_STATIC) - if(variant MATCHES "^([^.]+)\\.(.*)$") - set(vendor "${CMAKE_MATCH_1}") - set(alt_compiler "-DCMAKE_C_COMPILER=${CMAKE_MATCH_2}") - else() - set(vendor "${variant}") - set(alt_compiler "") - endif() - if(vendor STREQUAL "All" AND CMake_TEST_FindBLAS_STATIC_All) - set(EXPECT_All "-DEXPECT_All=${CMake_TEST_FindBLAS_STATIC_All}") - else() - set(EXPECT_All "") - endif() - add_test(NAME FindBLAS.Test_${variant}_Static COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindBLAS/Test" - "${CMake_BINARY_DIR}/Tests/FindBLAS/Test_${variant}_Static" - ${build_generator_args} - --build-project TestFindBLAS - --build-options ${build_options} ${alt_compiler} ${EXPECT_All} -DBLA_VENDOR=${vendor} -DBLA_STATIC=ON - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) -endforeach() +include("${CMake_SOURCE_DIR}/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake") +add_BLAS_LAPACK_tests(CMake_TEST_FindBLAS) diff --git a/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake b/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake new file mode 100644 index 0000000..db33404 --- /dev/null +++ b/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake @@ -0,0 +1,43 @@ +function(add_BLAS_LAPACK_tests var) + if(var MATCHES "^CMake_TEST_Find(BLAS|LAPACK)$") + set(package "${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "Test list variable '${var}' not supported.") + endif() + + set(all "") + set(compiler "") + set(static "") + + foreach(variant IN LISTS ${var}) + if(variant MATCHES "^(all|compiler|static)=(.*)$") + set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") + continue() + elseif(variant MATCHES "^([^=]+)=(.*)$") + message(FATAL_ERROR "Unknown variable '${variant}'") + endif() + set(variant_name "${variant}") + set(variant_options "-DBLA_VENDOR=${variant}") + if(variant STREQUAL "All" AND all) + list(APPEND variant_options "-DEXPECT_All=${all}") + endif() + if(compiler) + string(APPEND variant_name "_${compiler}") + list(APPEND variant_options "-DCMAKE_C_COMPILER=${compiler}") + endif() + if(static) + string(APPEND variant_name "_Static") + list(APPEND variant_options "-DBLA_STATIC=ON") + endif() + add_test(NAME Find${package}.Test_${variant_name} COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Find${package}/Test" + "${CMake_BINARY_DIR}/Tests/Find${package}/Test_${variant_name}" + ${build_generator_args} + --build-project TestFind${package} + --build-options ${build_options} ${variant_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + endforeach() +endfunction() diff --git a/Tests/FindLAPACK/CMakeLists.txt b/Tests/FindLAPACK/CMakeLists.txt index 535c7b6..a2470ef 100644 --- a/Tests/FindLAPACK/CMakeLists.txt +++ b/Tests/FindLAPACK/CMakeLists.txt @@ -1,49 +1,2 @@ -foreach(variant IN LISTS CMake_TEST_FindLAPACK) - if(variant MATCHES "^([^.]+)\\.(.*)$") - set(vendor "${CMAKE_MATCH_1}") - set(alt_compiler "-DCMAKE_C_COMPILER=${CMAKE_MATCH_2}") - else() - set(vendor "${variant}") - set(alt_compiler "") - endif() - if(vendor STREQUAL "All" AND CMake_TEST_FindLAPACK_All) - set(EXPECT_All "-DEXPECT_All=${CMake_TEST_FindLAPACK_All}") - else() - set(EXPECT_All "") - endif() - add_test(NAME FindLAPACK.Test_${variant} COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindLAPACK/Test" - "${CMake_BINARY_DIR}/Tests/FindLAPACK/Test_${variant}" - ${build_generator_args} - --build-project TestFindLAPACK - --build-options ${build_options} ${alt_compiler} ${EXPECT_All} -DBLA_VENDOR=${vendor} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) -endforeach() - -foreach(variant IN LISTS CMake_TEST_FindLAPACK_STATIC) - if(variant MATCHES "^([^.]+)\\.(.*)$") - set(vendor "${CMAKE_MATCH_1}") - set(alt_compiler "-DCMAKE_C_COMPILER=${CMAKE_MATCH_2}") - else() - set(vendor "${variant}") - set(alt_compiler "") - endif() - if(vendor STREQUAL "All" AND CMake_TEST_FindLAPACK_STATIC_All) - set(EXPECT_All "-DEXPECT_All=${CMake_TEST_FindLAPACK_STATIC_All}") - else() - set(EXPECT_All "") - endif() - add_test(NAME FindLAPACK.Test_${variant}_Static COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindLAPACK/Test" - "${CMake_BINARY_DIR}/Tests/FindLAPACK/Test_${variant}_Static" - ${build_generator_args} - --build-project TestFindLAPACK - --build-options ${build_options} ${alt_compiler} ${EXPECT_All} -DBLA_VENDOR=${vendor} -DBLA_STATIC=ON - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) -endforeach() +include("${CMake_SOURCE_DIR}/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake") +add_BLAS_LAPACK_tests(CMake_TEST_FindLAPACK) -- cgit v0.12 From 2cd94f3e57e843fa392f3c50d2c141c938b48112 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 4 Sep 2021 11:43:08 +0900 Subject: Find{BLAS,LAPACK}: Specify integer type in tests --- Tests/FindBLAS/Test/main.c | 10 ++++++---- Tests/FindLAPACK/Test/main.c | 13 ++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Tests/FindBLAS/Test/main.c b/Tests/FindBLAS/Test/main.c index e61b02c..8e58559 100644 --- a/Tests/FindBLAS/Test/main.c +++ b/Tests/FindBLAS/Test/main.c @@ -1,16 +1,18 @@ #include #include +typedef int blas_int; + // declare what parts of the blas C-API we need -void dswap_(int* N, double* X, int* incX, double* Y, int* incY); +void dswap_(blas_int* N, double* X, blas_int* incX, double* Y, blas_int* incY); int main() { double x[4] = { 1, 2, 3, 4 }; double y[4] = { 8, 7, 7, 6 }; - int N = 4; - int incX = 1; - int incY = 1; + blas_int N = 4; + blas_int incX = 1; + blas_int incY = 1; dswap_(&N, x, &incX, y, &incY); return 0; } diff --git a/Tests/FindLAPACK/Test/main.c b/Tests/FindLAPACK/Test/main.c index 5873e7b..04eedea 100644 --- a/Tests/FindLAPACK/Test/main.c +++ b/Tests/FindLAPACK/Test/main.c @@ -1,8 +1,11 @@ #include #include +typedef int blas_int; + // declare what parts of the lapack C-API we need -void dgesv_(int*, int*, double*, int*, int*, double*, int*, int*); +void dgesv_(blas_int*, blas_int*, double*, blas_int*, blas_int*, double*, + blas_int*, blas_int*); int main() { @@ -10,11 +13,11 @@ int main() 0, 1, 2, 3, 4, 5, 6, 7, }; double B[2] = { 0, 5 }; - int ipiv[2] = { 0, 0 }; - int info = 0; + blas_int ipiv[2] = { 0, 0 }; + blas_int info = 0; - int dim = 2; - int numCols = 1; + blas_int dim = 2; + blas_int numCols = 1; dgesv_(&dim, &numCols, A, &dim, ipiv, B, &dim, &info); return 0; } -- cgit v0.12 From 95219365ff76d9f28eb0c09cf2ad73312a2da11f Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 4 Sep 2021 11:35:22 +0900 Subject: Find{BLAS,LAPACK}: Make possible testing of ILP64 model --- Tests/FindBLAS/Test/CMakeLists.txt | 5 +++++ Tests/FindLAPACK/Test/CMakeLists.txt | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Tests/FindBLAS/Test/CMakeLists.txt b/Tests/FindBLAS/Test/CMakeLists.txt index 7379749..bbe2ddc 100644 --- a/Tests/FindBLAS/Test/CMakeLists.txt +++ b/Tests/FindBLAS/Test/CMakeLists.txt @@ -17,4 +17,9 @@ if((BLA_VENDOR STREQUAL "Intel10_64lp") OR if(NOT BLAS_LIBRARIES MATCHES "^(-Wl,--start-group;)?[^;]*mkl_intel_lp64") message(FATAL_ERROR "BLAS_LIBRARIES does not start in mkl_intel_lp64:\n ${BLAS_LIBRARIES}") endif() +elseif((BLA_VENDOR STREQUAL "Intel10_64ilp") OR + (BLA_VENDOR STREQUAL "All" AND EXPECT_All STREQUAL "Intel10_64ilp")) + if(NOT BLAS_LIBRARIES MATCHES "^(-Wl,--start-group;)?[^;]*mkl_intel_ilp64") + message(FATAL_ERROR "BLAS_LIBRARIES does not start in mkl_intel_ilp64:\n ${BLAS_LIBRARIES}") + endif() endif() diff --git a/Tests/FindLAPACK/Test/CMakeLists.txt b/Tests/FindLAPACK/Test/CMakeLists.txt index 23a43ac..21b1303 100644 --- a/Tests/FindLAPACK/Test/CMakeLists.txt +++ b/Tests/FindLAPACK/Test/CMakeLists.txt @@ -17,4 +17,9 @@ if((BLA_VENDOR STREQUAL "Intel10_64lp") OR if(NOT LAPACK_LIBRARIES MATCHES "^(-Wl,--start-group;)?[^;]*mkl_intel_lp64") message(FATAL_ERROR "LAPACK_LIBRARIES does not start in mkl_intel_lp64:\n ${LAPACK_LIBRARIES}") endif() +elseif((BLA_VENDOR STREQUAL "Intel10_64ilp") OR + (BLA_VENDOR STREQUAL "All" AND EXPECT_All STREQUAL "Intel10_64ilp")) + if(NOT LAPACK_LIBRARIES MATCHES "^(-Wl,--start-group;)?[^;]*mkl_intel_ilp64") + message(FATAL_ERROR "LAPACK_LIBRARIES does not start in mkl_intel_ilp64:\n ${LAPACK_LIBRARIES}") + endif() endif() -- cgit v0.12 From 972489ae4e22179028b5e3ed8f908100665a368d Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Sat, 4 Sep 2021 11:35:22 +0900 Subject: Find{BLAS,LAPACK}: Provide testing of BLA_SIZEOF_INTEGER --- .gitlab/ci/configure_intelcompiler_common.cmake | 6 +++++- Tests/FindBLAS/Test/CMakeLists.txt | 6 ++++++ Tests/FindBLAS/Test/main.c | 9 ++++++++- Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake | 12 +++++++++++- Tests/FindLAPACK/Test/CMakeLists.txt | 6 ++++++ Tests/FindLAPACK/Test/main.c | 9 ++++++++- 6 files changed, 44 insertions(+), 4 deletions(-) diff --git a/.gitlab/ci/configure_intelcompiler_common.cmake b/.gitlab/ci/configure_intelcompiler_common.cmake index 2698f88..bd34740 100644 --- a/.gitlab/ci/configure_intelcompiler_common.cmake +++ b/.gitlab/ci/configure_intelcompiler_common.cmake @@ -1,7 +1,11 @@ set(blas_lapack_cases - all=Intel10_64lp + model=lp64 all=Intel10_64lp static=0 All Intel10_64lp compiler=gcc Intel10_64lp compiler= static=1 All Intel10_64lp compiler=gcc Intel10_64lp compiler= + + model=ilp64 all=Intel10_64ilp + static=0 All Intel10_64ilp compiler=gcc Intel10_64ilp compiler= + static=1 All Intel10_64ilp compiler=gcc Intel10_64ilp compiler= ) set(CMake_TEST_FindBLAS "${blas_lapack_cases}" CACHE STRING "") set(CMake_TEST_FindLAPACK "${blas_lapack_cases}" CACHE STRING "") diff --git a/Tests/FindBLAS/Test/CMakeLists.txt b/Tests/FindBLAS/Test/CMakeLists.txt index bbe2ddc..14bf19f 100644 --- a/Tests/FindBLAS/Test/CMakeLists.txt +++ b/Tests/FindBLAS/Test/CMakeLists.txt @@ -4,12 +4,18 @@ include(CTest) find_package(BLAS REQUIRED) +if(NOT BLA_SIZEOF_INTEGER) + set(BLA_SIZEOF_INTEGER 4) +endif() + add_executable(test_tgt main.c) target_link_libraries(test_tgt BLAS::BLAS) +target_compile_definitions(test_tgt PUBLIC BLA_SIZEOF_INTEGER=${BLA_SIZEOF_INTEGER}) add_test(NAME test_tgt COMMAND test_tgt) add_executable(test_var main.c) target_link_libraries(test_var PRIVATE ${BLAS_LIBRARIES}) +target_compile_definitions(test_var PUBLIC BLA_SIZEOF_INTEGER=${BLA_SIZEOF_INTEGER}) add_test(NAME test_var COMMAND test_var) if((BLA_VENDOR STREQUAL "Intel10_64lp") OR diff --git a/Tests/FindBLAS/Test/main.c b/Tests/FindBLAS/Test/main.c index 8e58559..4fc9fe4 100644 --- a/Tests/FindBLAS/Test/main.c +++ b/Tests/FindBLAS/Test/main.c @@ -1,7 +1,14 @@ #include +#include #include -typedef int blas_int; +#if BLA_SIZEOF_INTEGER == 4 +typedef int32_t blas_int; +#elif BLA_SIZEOF_INTEGER == 8 +typedef int64_t blas_int; +#else +# error BLA_SIZEOF_INTEGER is not declared! +#endif // declare what parts of the blas C-API we need void dswap_(blas_int* N, double* X, blas_int* incX, double* Y, blas_int* incY); diff --git a/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake b/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake index db33404..42fe386 100644 --- a/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake +++ b/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake @@ -7,10 +7,14 @@ function(add_BLAS_LAPACK_tests var) set(all "") set(compiler "") + set(model "") set(static "") + set(sizeof_int_lp64 4) + set(sizeof_int_ilp64 8) + foreach(variant IN LISTS ${var}) - if(variant MATCHES "^(all|compiler|static)=(.*)$") + if(variant MATCHES "^(all|compiler|model|static)=(.*)$") set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") continue() elseif(variant MATCHES "^([^=]+)=(.*)$") @@ -21,6 +25,12 @@ function(add_BLAS_LAPACK_tests var) if(variant STREQUAL "All" AND all) list(APPEND variant_options "-DEXPECT_All=${all}") endif() + if(model) + if(NOT variant_name MATCHES "Intel10_64") + string(APPEND variant_name "_${model}") + endif() + list(APPEND variant_options "-DBLA_SIZEOF_INTEGER=${sizeof_int_${model}}") + endif() if(compiler) string(APPEND variant_name "_${compiler}") list(APPEND variant_options "-DCMAKE_C_COMPILER=${compiler}") diff --git a/Tests/FindLAPACK/Test/CMakeLists.txt b/Tests/FindLAPACK/Test/CMakeLists.txt index 21b1303..f5d5a73 100644 --- a/Tests/FindLAPACK/Test/CMakeLists.txt +++ b/Tests/FindLAPACK/Test/CMakeLists.txt @@ -4,12 +4,18 @@ include(CTest) find_package(LAPACK REQUIRED) +if(NOT BLA_SIZEOF_INTEGER) + set(BLA_SIZEOF_INTEGER 4) +endif() + add_executable(test_tgt main.c) target_link_libraries(test_tgt LAPACK::LAPACK) +target_compile_definitions(test_tgt PUBLIC BLA_SIZEOF_INTEGER=${BLA_SIZEOF_INTEGER}) add_test(NAME test_tgt COMMAND test_tgt) add_executable(test_var main.c) target_link_libraries(test_var PRIVATE ${LAPACK_LIBRARIES}) +target_compile_definitions(test_var PUBLIC BLA_SIZEOF_INTEGER=${BLA_SIZEOF_INTEGER}) add_test(NAME test_var COMMAND test_var) if((BLA_VENDOR STREQUAL "Intel10_64lp") OR diff --git a/Tests/FindLAPACK/Test/main.c b/Tests/FindLAPACK/Test/main.c index 04eedea..dd33fb3 100644 --- a/Tests/FindLAPACK/Test/main.c +++ b/Tests/FindLAPACK/Test/main.c @@ -1,7 +1,14 @@ #include +#include #include -typedef int blas_int; +#if BLA_SIZEOF_INTEGER == 4 +typedef int32_t blas_int; +#elif BLA_SIZEOF_INTEGER == 8 +typedef int64_t blas_int; +#else +# error BLA_SIZEOF_INTEGER is not declared! +#endif // declare what parts of the lapack C-API we need void dgesv_(blas_int*, blas_int*, double*, blas_int*, blas_int*, double*, -- cgit v0.12 From 64038fd5bc901f90cf0ab5a76b562db455d66c22 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Sep 2021 10:32:27 -0400 Subject: Help: Add release notes for Find{BLAS,LAPACK} BLA_SIZEOF_INTEGER option --- Help/release/dev/find-blas-lapack-sizeof-integer.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/find-blas-lapack-sizeof-integer.rst diff --git a/Help/release/dev/find-blas-lapack-sizeof-integer.rst b/Help/release/dev/find-blas-lapack-sizeof-integer.rst new file mode 100644 index 0000000..bb20654 --- /dev/null +++ b/Help/release/dev/find-blas-lapack-sizeof-integer.rst @@ -0,0 +1,6 @@ +find-blas-lapack-sizeof-integer +------------------------------- + +* The :module:`FindBLAS` and :module:`FindLAPACK` modules gained + a ``BLA_SIZEOF_INTEGER`` option to find a BLAS/LAPACK whose ABI + uses a specific integer size. -- cgit v0.12