Clear Filters
Clear Filters

How can I use the BLAS and LAPACK implementations included in AMD Optimizing CPU Libraries (AOCL) with MATLAB R2022a?

218 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Mar 2022
Edited: MathWorks Support Team on 16 Mar 2022
The BLAS and LAPACK implementation used by default in MATLAB on x86_64 processors is part of the Intel Math Kernel Library, or Intel MKL. MATLAB is only qualified using the version of Intel MKL that is included with MATLAB.
If you are using an AMD processor, you may prefer to use the BLAS and LAPACK implementation which is included in AMD Optimizing CPU Libraries, or AOCL. These libraries are optimized for use on AMD's Zen architecture processors. Starting with MATLAB R2022a, these libraries have completed preliminary qualificiation for use with MATLAB and are shipping alongside MKL on Windows and Linux.
AOCL provides its BLAS implementation as AOCL_LibBlis and its LAPACK implementation as AOCL_LibFLAME, respectively.

Setting MATLAB to use AOCL

In order to use AOCL libraries with MATLAB, open a command prompt and define the environment variables BLAS_VERSION and LAPACK_VERSION by running the following commands:
> set BLAS_VERSION=AOCL-LibBlis-Win-MT-dll.dll
$ export
$ export
Notice that depending on the used Linux shell, the command to define ENVs might differ.
Once the ENVs have been set, start MATLAB from within the same command prompt to use the AOCL libraries:
> matlab

Revert settings

To revert the BLAS and LAPACK libraries MATLAB uses to the default Intel libraries, close MATLAB and clear the environment variables:

Verifying the Installation

To verify that MATLAB is using the desired BLAS and/or LAPACK library, type the following at the MATLAB prompt:
>> version -blas, version -lapack
In MATLAB R2022a this should return:
ans =
'AOCL BLIS 3.1.0'
ans =
'AOCL libFLAME 3.1.1, supports LAPACK 3.10.0'

Switch to use AOCL permanently

The procedure explained above is only active within the used command window. In order to always start MATLAB using AOCL, permanently set these environment variables.
  1. Click Win-Key
  2. Click on Settings Symbol
  3. Search for Edit environment variables for your account.
  4. Click on New...
  5. Insert name and value as described above for BLAS_VERSION and LAPACK_VERSION.
Add the ENVs BLAS_VERSION and LAPACK_VERSION with the values described above to your ~/.bashrc.mine, ~/.profile, or similar.

More Answers (0)


No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!