Merge topic 'find-blas-lapack-sizeof-integer'
64038fd5bc
Help: Add release notes for Find{BLAS,LAPACK} BLA_SIZEOF_INTEGER option972489ae4e
Find{BLAS,LAPACK}: Provide testing of BLA_SIZEOF_INTEGER95219365ff
Find{BLAS,LAPACK}: Make possible testing of ILP64 model2cd94f3e57
Find{BLAS,LAPACK}: Specify integer type in tests9b69307b56
Find{BLAS,LAPACK}: De-duplicate and generalize test creation logic91fd645d46
FindLAPACK: Stop processing if LAPACK library does not have 64-bit integer APIb8a3cea51f
FindBLAS: Stop processing if BLAS library does not have 64-bit integer APId2f5c7856f
FindLAPACK: Search 32/64-bit integer API via BLA_SIZEOF_INTEGER if possible ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6407
This commit is contained in:
commit
ca2bc33626
@ -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 "")
|
||||
|
@ -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 "")
|
||||
|
@ -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 "")
|
||||
|
@ -1,10 +1,13 @@
|
||||
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
|
||||
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 "")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
|
||||
|
6
Help/release/dev/find-blas-lapack-sizeof-integer.rst
Normal file
6
Help/release/dev/find-blas-lapack-sizeof-integer.rst
Normal file
@ -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.
|
@ -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()
|
||||
unset(_ssl2_suffix)
|
||||
if(_blas_sizeof_integer EQUAL 8)
|
||||
string(APPEND _blas_fjlapack_lib "_ilp64")
|
||||
endif()
|
||||
|
||||
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()
|
||||
|
||||
# Generic BLAS library?
|
||||
if(BLA_VENDOR STREQUAL "Generic" OR
|
||||
BLA_VENDOR STREQUAL "NVHPC" OR
|
||||
BLA_VENDOR STREQUAL "All")
|
||||
# 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"
|
||||
"${_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 "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_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)
|
||||
|
@ -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,99 +586,82 @@ 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)
|
||||
if(BLAS_LIBRARIES MATCHES "fjlapack.+")
|
||||
set(LAPACK_LIBRARIES ${BLAS_LIBRARIES})
|
||||
set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
|
||||
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)
|
||||
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")
|
||||
if(BLAS_LIBRARIES MATCHES "essl.+")
|
||||
set(LAPACK_LIBRARIES ${BLAS_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check for OpenMP support, VIA BLA_VENDOR of esslsmp
|
||||
if(BLA_VENDOR MATCHES "_SMP")
|
||||
set(_lapack_essl_lib "${_lapack_essl_lib}smp")
|
||||
# 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(
|
||||
@ -625,29 +669,33 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
|
||||
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"))
|
||||
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)
|
||||
|
@ -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 $<CONFIGURATION>
|
||||
--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 $<CONFIGURATION>
|
||||
)
|
||||
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 $<CONFIGURATION>
|
||||
--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 $<CONFIGURATION>
|
||||
)
|
||||
endforeach()
|
||||
include("${CMake_SOURCE_DIR}/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake")
|
||||
add_BLAS_LAPACK_tests(CMake_TEST_FindBLAS)
|
||||
|
@ -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
|
||||
@ -17,4 +23,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()
|
||||
|
@ -1,16 +1,25 @@
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#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_(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;
|
||||
}
|
||||
|
53
Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake
Normal file
53
Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake
Normal file
@ -0,0 +1,53 @@
|
||||
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(model "")
|
||||
set(static "")
|
||||
|
||||
set(sizeof_int_lp64 4)
|
||||
set(sizeof_int_ilp64 8)
|
||||
|
||||
foreach(variant IN LISTS ${var})
|
||||
if(variant MATCHES "^(all|compiler|model|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(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}")
|
||||
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 $<CONFIGURATION>
|
||||
--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 $<CONFIGURATION>
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
@ -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 $<CONFIGURATION>
|
||||
--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 $<CONFIGURATION>
|
||||
)
|
||||
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 $<CONFIGURATION>
|
||||
--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 $<CONFIGURATION>
|
||||
)
|
||||
endforeach()
|
||||
include("${CMake_SOURCE_DIR}/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake")
|
||||
add_BLAS_LAPACK_tests(CMake_TEST_FindLAPACK)
|
||||
|
@ -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
|
||||
@ -17,4 +23,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()
|
||||
|
@ -1,8 +1,18 @@
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#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_(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 +20,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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user