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

247 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2022-3-16
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:
Windows
> set BLAS_VERSION=AOCL-LibBlis-Win-MT-dll.dll
> set LAPACK_VERSION=AOCL-LibFLAME-Win-MT-dll.dll
Linux
$ export BLAS_VERSION=libblis-mt.so
$ export LAPACK_VERSION=libflame.so
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:
Windows
> set BLAS_VERSION=
> set LAPACK_VERSION=
Linux
$ unset BLAS_VERSION
$ unset LAPACK_VERSION

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.
Windows
  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.
LINUX
Add the ENVs BLAS_VERSION and LAPACK_VERSION with the values described above to your ~/.bashrc.mine, ~/.profile, or similar.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 GPU Computing 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by