Submitting an R job is very similar to submitting a serial job shown on Submitting Jobs.
When executing R scripts, output will be directed to an Rout file. This file will have the same name as the submitted script but with the extension `Rout` instead of `R`. For instance, the following examples will have output saved to the file `Rcode.Rout`.
You will notice that the example is very similar to to the serial example. The important line is the
module load command. That tells Tusker to load the R framework into the environment so jobs may use it.
Multicore (parallel) R submission
Submitting a multicore R job to SLURM is very similar to Submitting an OpenMP Job, since both are running multicore jobs on a single node. Below is an example:
The above example will submit a single job which can use up to 16 cores.
Be sure to use limits in your R code so you only use 16 cores, or your performance will suffer. For example, when using the parallel package function mclapply:
Multinode R submission with Rmpi
Submitting a multinode MPI R job to SLURM is very similar to Submitting an MPI Job, since both are running multicore jobs on a multiple nodes. Below is an example of running Rmpi on Crane on 2 nodes and 32 cores:
When you run Rmpi job on Crane, please use the line export OMPI_MCA_mtl=^psm in your submit script. On the other hand, if you run Rmpi job on Tusker, you do not need to add this line. This is because of the different Infiniband cards Tusker and Crane use. Regardless of how may cores your job uses, the Rmpi package should always be run with mpirun -n 1 because it spawns additional processes dynamically.
Please find below an example of Rmpi R script provided by The University of Chicago Research Computing Center:
Users are allowed to install R packages into their own home directories. Instructions are provided by OSU.