Documentation access will be interrupted from time to time due to some bug correction.


Page tree
Skip to end of metadata
Go to start of metadata

Running R from SLURM


R is compiled with Intel Compilers and MKL.

The SLURM script calling an R script should look like this:

#!/bin/bash -l

#SBATCH --nodes 1 
#SBATCH --ntasks 1 
#SBATCH --cpus-per-task 1
#SBATCH --mem 60000
#SBATCH --time 00:05:00
 
echo STARTING AT `date`

module purge 
module load intel intel-mkl
module load r
srun R CMD BATCH ./rscript.R
 
echo FINISHED at `date`

...where rscript.sh is executable (chmod +x rscript.sh) and begins with the line

#!/usr/bin/env Rscript

Installing packages within R

To allow proper compilation with Intel compilers, create the ~/.R/Makevars file with the following content:

CC=icc
CXX=icpc
FC=ifort
F77=ifort

Packages requiring libcurl

Libcurl is available via the curl module. Just load it before running R with

module load curl

Installing SparkR

You will first need to load the following modules

module load intel intel-mkl
module load r curl spark

Then, you can launch R and do the following

install.packages("devtools")
devtools::install_github('apache/spark@v2.0.2', subdir='R/pkg')