FindBLAS — CMake 4.0.1-dirty Documentation

# FindBLAS

Find Basic Linear Algebra Subprograms (BLAS) library

This module finds an installed Fortran library that implements the BLAS linear-algebra interface.

At least one of the `C`, `CXX`, or `Fortran` languages must be enabled.

## Input Variables

The following variables may be set to influence this module's behavior:

`BLA_STATIC`

  if `ON` use static linkage

`BLA_VENDOR`

  Set to one of the BLAS/LAPACK Vendors to search for BLAS only from the specified vendor. If not set, all vendors are considered.

`BLA_F95`

  if `ON` tries to find the BLAS95 interfaces

`BLA_PREFER_PKGCONFIG`

  Added in version 3.11.

  if set `pkg-config` will be used to search for a BLAS library first and if one is found that is preferred

`BLA_PKGCONFIG_BLAS`

  Added in version 3.25.

  If set, the `pkg-config` method will look for this module name instead of just `blas`.

`BLA_SIZEOF_INTEGER`

  Added in version 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

This module defines the following `IMPORTED` targets:

`BLAS::BLAS`

  Added in version 3.18.

  The libraries to use for BLAS, if found.

## Result Variables

This module defines the following variables:

`BLAS_FOUND`

  library implementing the BLAS interface is found

`BLAS_LINKER_FLAGS`

  uncached list of required linker flags (excluding `-l` and `-L`).

`BLAS_LIBRARIES`

  uncached list of libraries (using full path name) to link against to use BLAS (may be empty if compiler implicitly links BLAS)

`BLAS95_LIBRARIES`

  uncached list of libraries (using full path name) to link against to use BLAS95 interface

`BLAS95_FOUND`

  library implementing the BLAS95 interface is found

## BLAS/LAPACK Vendors

`Generic`

  Generic reference implementation

`ACML`, `ACML_MP`, `ACML_GPU`

  AMD Core Math Library

`AOCL`, `AOCL_mt`

  Added in version 3.27.

  AMD Optimizing CPU Libraries

`Apple`, `NAS`

  Apple BLAS (Accelerate), and Apple NAS (vecLib)

`Arm`, `Arm_mp`, `Arm_ilp64`, `Arm_ilp64_mp`

  Added in version 3.18.

  Arm Performance Libraries

`ATLAS`

  Automatically Tuned Linear Algebra Software

`CXML`, `DXML`

  Compaq/Digital Extended Math Library

`EML`, `EML_mt`

  Added in version 3.20.

  Elbrus Math Library

`FLAME`

  Added in version 3.11.

  BLIS Framework

`FlexiBLAS`

  Added in version 3.19.

`Fujitsu_SSL2`, `Fujitsu_SSL2BLAMP`, `Fujitsu_SSL2SVE`, `Fujitsu_SSL2BLAMPSVE`

  Added in version 3.20.

  Fujitsu SSL2 serial and parallel blas/lapack with SVE instructions

`Goto`

  GotoBLAS

`IBMESSL`, `IBMESSL_SMP`

> IBM Engineering and Scientific Subroutine Library

`Intel`

  Intel MKL 32 bit and 64 bit obsolete versions

`Intel10_32`

  Intel MKL v10 32 bit, threaded code

`Intel10_64lp`

  Intel MKL v10+ 64 bit, threaded code, lp64 model

`Intel10_64lp_seq`

  Intel MKL v10+ 64 bit, sequential code, lp64 model

`Intel10_64ilp`

  Added in version 3.13.

  Intel MKL v10+ 64 bit, threaded code, ilp64 model

`Intel10_64ilp_seq`

  Added in version 3.13.

  Intel MKL v10+ 64 bit, sequential code, ilp64 model

`Intel10_64_dyn`

  Added in version 3.17.

  Intel MKL v10+ 64 bit, single dynamic library

`libblastrampoline`

  Added in version 3.30.

  A BLAS/LAPACK demuxing library using PLT trampolines

`NVHPC`

  Added in version 3.21.

  NVIDIA HPC SDK

`OpenBLAS`

  Added in version 3.6.

`PhiPACK`

  Portable High Performance ANSI C (PHiPAC)

`SCSL`, `SCSL_mp`

  Scientific Computing Software Library

`SGIMATH`

  SGI Scientific Mathematical Library

`SunPerf`

  Sun 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.sh

  Or, 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