Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 1.34 KB

README.md

File metadata and controls

32 lines (26 loc) · 1.34 KB

R_array_job_example

Example Slurm array job script that runs an R script

To use R on a HPC machine, you will typically first need to load an R environment module, e.g. on University of Bristol Advanced Computing Research Centre's BluePebble facility

$ module load lang/r

The example array job script submit_R_array.sh is written for the Slurm job scheduler and can be submitted to run on a HPC machine using

$ sbatch submit_R_array.sh

This example uses the commandArgs() function from base R to read the array job index provided as a command line argument in submit_R_array.sh. R packages which support more sophisticated access and manipulation of command line arguments are available, e.g. optparse.

NOTE
On University of Bristol HPC facilities, a HPC account project code must be provided at the command line, i.e.

$ sbatch --account=<project code> submit_R_array.sh

where <project code> is replaced with your University of Bristol HPC project code.

This can alternatively be added to the job script itself, by adding a #SBATCH directive line, i.e.

#SBATCH --account=<project code>