Basic R job¶
A basic R job can be enqueued via SLURM in the following way. First of all put the following text in a script and name it as you prefer (e.g. my_batch_script.sh). You have your own R script named script.R too.
#!/bin/sh #SBATCH --mail-type=ALL #SBATCH --partition=all #SBATCH --ntasks=1 #SBATCH --cpus-per-task=32 #SBATCH --mail-user=your_email@address #SBATCH --hint=compute_bound #SBATCH --mem-per-cpu=100G srun R CMD BATCH ./script.R
Then you can launch it with the following command:
- Parallelize R code on a SLURM cluster https://cran.r-project.org/web/packages/rslurm/vignettes/rslurm.html