How to Use FlexiBLAS
What is FlexiBLAS?
FlexiBLAS is a wrapper library that enables the exchange of the BLAS and LAPACK implementation used by a program without recompiling or relinking it.
To use any BLAS backend other than OpenBLAS it will need to be installed. Since Intel has licence restrictions on their code, NeSI is unable to make these available, but a researcher (or AgR IT) may be able to get the Intel suite of libraries licenced for use on eRI.
If it is decided that MKL provides a significant enough performance boost and the libraries are installed one can use the tools provided by the FlexiBLAS module to manage the backend:
$ module load FlexiBLAS
$ flexiblas list
System-wide:
System-wide (config directory):
IMKL
library = libflexiblas_imkl_gnu_thread.so
comment =
IMKL_SEQ
library = libflexiblas_imkl_sequential.so
comment =
OPENBLAS
library = libflexiblas_openblas.so
comment =
BLIS
library = libflexiblas_blis.so
comment =
NETLIB
library = libflexiblas_netlib.so
comment =
User config:
Host config:
Enviroment config:
A researcher can also change the backend:
$ flexiblas default IMKL
Setting user default BLAS to IMKL.
$ cat $HOME/.flexiblasrc
default=IMKL
NOTE: The above will only work if the backend requested is actually installed. FlexiBLAS only lists supported backends, not necessarily installed backends. More information on FlexiBLAS can be found at the developer sites:
GitHub - mpimd-csc/flexiblas: FlexiBLAS - A BLAS and LAPACK wrapper library with runtime exchangeable backends. This is only a mirror of https://gitlab.mpi-magdeburg.mpg.de/software/flexiblas-releaseandhttps://www.mpi-magdeburg.mpg.de/projects/flexiblas
Also, R has a library that one can use to switch to an available BLAS library, similar to the flexiblas
command mentioned above. That R Lib is called flexiblas
and can be installed using the normal install.packages function.
You can see that the current BLAS is the one we have installed:
> flexiblas_current_backend()
[1] "OPENBLAS"
You can list known backends:
More details can be found on the authoratative CRAN page, here: https://cran.r-project.org/web/packages/flexiblas/readme/README.html