How can I use the BLAS implementations included in Apple Accelerate Framework with MATLAB R2023b Update 4?

311 Ansichten (letzte 30 Tage)
How can I use the BLAS implementations included in Apple Accelerate Framework with MATLAB R2023b Update 4?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 1 Dez. 2023
Bearbeitet: MathWorks Support Team am 1 Dez. 2023
The BLAS implementation currently used by default in MATLAB on Apple Silicon processors is OpenBLAS. MATLAB is only qualified using the OpenBLAS version that is included with MATLAB.
After working closely with Apple, MacOS 13.3 brought ILP64 compatible BLAS APIs to Apple Accelerate Framework's BLAS.
If you are using an Apple Silicon processor and run on MacOS 13.3 or newer, you may prefer to use the BLAS implementation which is included with MacOS's Apple Accelerate Framework. Starting with MATLAB R2023b Update 4, this library has completed preliminary qualificiation for use with MATLAB and can be selected following the below instructions.

Setting MATLAB to use Apple Accelerate Framework's BLAS

In order to use Apple Accelerate Framework's BLAS (AF_BLAS) with MATLAB, open a command prompt and define the environment variable BLAS_VERSION by running the following command:
$ export BLAS_VERSION=libmwAF_BLAS_ilp64.dylib
Notice that depending on the used MacOS shell, the command to define ENVs might differ.
Once the ENV has been set, start MATLAB from within the same command prompt to use AF_BLAS:
> matlab

Revert settings

To revert the BLAS library MATLAB uses to the default library, close MATLAB and clear the environment variable:
$ unset BLAS_VERSION

Verifying the Installation

To verify that MATLAB is using the desired BLAS library, type the following at the MATLAB prompt:
>> version -blas
In MATLAB R2023b Update 4 this should return:
BLAS: trying environment BLAS_VERSION...
BLAS: loading libmwAF_BLAS_ilp64.dylib
BLAS: loaded libmwAF_BLAS_ilp64.dylib@0xa0a3a390
ans =
'Apple Accelerate BLAS (ILP64)'

Switch to use Apple Accelerate BLAS permanently

The procedure explained above is only active within the used command window. In order to always start MATLAB using AF_BLAS, permanently set these environment variables by adding the ENV BLAS_VERSION with the value described above to your ~/.bashrc.mine, ~/.profile, or similar.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by