summaryrefslogtreecommitdiffstats
path: root/Modules/FindLAPACK.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/FindLAPACK.cmake')
-rw-r--r--Modules/FindLAPACK.cmake263
1 files changed, 160 insertions, 103 deletions
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)