FindBLAS¶
Finds the installed Basic Linear Algebra Subprograms (BLAS) Fortran library, which implements the BLAS linear-algebra interface:
find_package(BLAS [...])
At least one of the C, CXX, or Fortran languages must be enabled.
Imported Targets¶
This module provides the following Imported Targets:
BLAS::BLASAdded in version 3.18.
Target encapsulating the libraries and usage requirements to use BLAS, available only if BLAS is found.
Result Variables¶
This module defines the following variables:
BLAS_FOUNDBoolean indicating whether the library implementing the BLAS interface was found.
BLAS_LINKER_FLAGSUncached list of required linker flags (excluding
-land-L).BLAS_LIBRARIESUncached list of libraries (using full path name) to link against to use BLAS (may be empty if compiler implicitly links BLAS).
BLAS95_LIBRARIESUncached list of libraries (using full path name) to link against to use BLAS95 interface.
BLAS95_FOUNDBoolean indicating whether the library implementing the BLAS95 interface was found.
Input Variables¶
The following variables may be set to influence this module's behavior:
BLA_STATICIf
ON, the static linkage will be used.BLA_VENDORSet to one of the BLAS/LAPACK Vendors to search for BLAS only from the specified vendor. If not set, all vendors are considered.
BLA_F95If
ON, the module tries to find the BLAS95 interfaces.BLA_PREFER_PKGCONFIGAdded in version 3.11.
If set,
pkg-configwill be used to search for a BLAS library first and if one is found that is preferredBLA_PKGCONFIG_BLASAdded in version 3.25.
If set, the
pkg-configmethod will look for this module name instead of justblas.BLA_SIZEOF_INTEGERAdded in version 3.22.
Specify the BLAS/LAPACK library integer size:
4Search for a BLAS/LAPACK with 32-bit integer interfaces.
8Search for a BLAS/LAPACK with 64-bit integer interfaces.
ANYSearch for any BLAS/LAPACK. Most likely, a BLAS/LAPACK with 32-bit integer interfaces will be found.
BLA_THREADAdded in version 4.1.
Specify the BLAS/LAPACK threading model:
SEQSequential model
OMPOpenMP model
ANYSearch for any BLAS/LAPACK, if both are available most likely
OMPwill be found.
This is currently only supported by NVIDIA NVPL.
BLAS/LAPACK Vendors¶
GenericGeneric reference implementation.
ACML,ACML_MP,ACML_GPUAMD Core Math Library
AOCL,AOCL_mtAdded in version 3.27.
AMD Optimizing CPU Libraries.
Apple,NASApple BLAS (Accelerate), and Apple NAS (vecLib).
Arm,Arm_mp,Arm_ilp64,Arm_ilp64_mpAdded in version 3.18.
Arm Performance Libraries.
ATLASAutomatically Tuned Linear Algebra Software.
CXML,DXMLCompaq/Digital Extended Math Library.
EML,EML_mtAdded in version 3.20.
Elbrus Math Library.
FLAMEAdded in version 3.11.
BLIS Framework.
FlexiBLASAdded in version 3.19.
Fujitsu_SSL2,Fujitsu_SSL2BLAMP,Fujitsu_SSL2SVE,Fujitsu_SSL2BLAMPSVEAdded in version 3.20.
Fujitsu SSL2 serial and parallel blas/lapack with SVE instructions.
GotoGotoBLAS.
IBMESSL, IBMESSL_SMP
IBM Engineering and Scientific Subroutine Library.
IntelIntel MKL 32 bit and 64 bit obsolete versions.
Intel10_32Intel MKL v10 32 bit, threaded code.
Intel10_64lpIntel MKL v10+ 64 bit, threaded code, lp64 model.
Intel10_64lp_seqIntel MKL v10+ 64 bit, sequential code, lp64 model.
Intel10_64ilpAdded in version 3.13.
Intel MKL v10+ 64 bit, threaded code, ilp64 model.
Intel10_64ilp_seqAdded in version 3.13.
Intel MKL v10+ 64 bit, sequential code, ilp64 model.
Intel10_64_dynAdded in version 3.17.
Intel MKL v10+ 64 bit, single dynamic library.
libblastrampolineAdded in version 3.30.
A BLAS/LAPACK demuxing library using PLT trampolines.
NVPLAdded in version 4.1.
NVIDIA Performance Libraries.
NVHPCAdded in version 3.21.
NVIDIA HPC SDK.
OpenBLASAdded in version 3.6.
PhiPACKPortable High Performance ANSI C (PHiPAC).
SCSL,SCSL_mpScientific Computing Software Library.
SGIMATHSGI Scientific Mathematical Library.
SunPerfSun Performance Library.
Intel MKL¶
To use the Intel MKL implementation of BLAS, a project must enable at least
one of the C or CXX languages. Set BLA_VENDOR to an Intel MKL
variant either on the command-line as -DBLA_VENDOR=Intel10_64lp or in
project code:
set(BLA_VENDOR Intel10_64lp)
find_package(BLAS)
In order to build a project using Intel MKL, and end user must first establish an Intel MKL environment:
- Intel oneAPI
Source the full Intel environment script:
. /opt/intel/oneapi/setvars.shOr, source the MKL component environment script:
. /opt/intel/oneapi/mkl/latest/env/vars.sh- Intel Classic
Source the full Intel environment script:
. /opt/intel/bin/compilervars.sh intel64
Or, source the MKL component environment script:
. /opt/intel/mkl/bin/mklvars.sh intel64
The above environment scripts set the MKLROOT environment variable
to the top of the MKL installation. They also add the location of the
runtime libraries to the dynamic library loader environment variable for
your platform (e.g. LD_LIBRARY_PATH). This is necessary for programs
linked against MKL to run.
Note
As of Intel oneAPI 2021.2, loading only the MKL component does not
make all of its dependencies available. In particular, the iomp5
library must be available separately, or provided by also loading
the compiler component environment:
. /opt/intel/oneapi/compiler/latest/env/vars.sh
Examples¶
Finding BLAS and linking it to a project target:
find_package(BLAS)
target_link_libraries(example PRIVATE BLAS::BLAS)