User Tools

Site Tools


r_and_blas_libraries

R and BLAS Libraries

R uses BLAS (Basic Linear Algebra Subprograms) to perform many of its operations. There are several different implementations of BLAS each having different performance characteristics in different situations.

The default BLAS on the cluster is Atlas (Automatically Tuned Linear Algebra Software). The Atlas libraries on the cluster use a single thread to perform all operations.

If you suspect that your jobs would benefit from a multi-threaded BLAS library you can try OpenBLAS (which is already installed on the cluster). To do this you would set the dynamic library load path before you start R. For instance:

export LD_LIBRARY_PATH=/usr/lib/openblas-base
R --slave --vanilla -f my_r_script.r

These OpenBLAS libraries will use multiple threads for some operations. You can control how many threads OpenBLAS will use by setting the OPENBLAS_NUM_THREADS environment variable before starting your program.

export OPENBLAS_NUM_THREADS=4

If you use a lot of threads you should increase the number of cores you tell slurm that you job requires (or run your job with exclusive use of a compute node).

You can also download and compile other BLAS libraries in your own home directory and update the dynamic library to match.

r_and_blas_libraries.txt · Last modified: 2020/03/02 11:45 by root