Springe direkt zu Inhalt



R is a programming language and a software environment for statistical calculations and graphics.

Running Batch Jobs


The program can be called directly without a module having to be loaded first. However, there is another version which has been compiled against Intel's optimised mathematics routines in the Math Kernel Library or MKL, which should make it much faster for certain operations. To use the MKL-enabled version, call

module load r

A simple script which can be submitted to Slurm could look like the following:

#SBATCH --job-name=my_R_job 
#SBATCH --mem=2048
#SBATCH --time=1-12:00:00
module load r Rscript script.r arg1 arg2

The R package Rmpi can be used to run parallel jobs. In this case the number of tasks must be specified using the SLURM parameter --ntasks. However, the number of process passed to mpirun via the option -np should be just 1:

#SBATCH --job-name=my_Rmpi_job 
#SBATCH --mem=2048
#SBATCH --ntasks=8
module add r openmpi/intel mpirun -np 1 R --no-save < mpi_job.r

Installing Packages

Users can install package themselves by starting Rand then running the following command:


Users who wish to build their own packages and use the MKL, must load the corresponding modules:

module load intel/compiler intel/mkl

and add the appropriate environment to the definition of PKG_LIBS in the file Makevars:

PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` -l$(BLASLIB)

Using other mathematical libraries

The version of R which is available without module is regularly updated and normally corresponds to the latest version available. By default, this version is linked dynamically to OpenBLAS. However, in many cases it may be worthwhile using a different library for linear algebra operations.

This can be achieved by loading the desired library before any others. This can be done by setting the environment variable LD_PRELOAD, e.g.:

module add intel/compiler/64/16.0
export LD_PRELOAD=${MKLROOT}/lib/intel64/libmkl_rt.so
Rscript myscript.r