- First of all, have a look at the chapter First steps on the clusters
- Then, get the R scripts example from our c4science repository
(Method to get those scripts explained at first step)
This part below is out-dated
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')