This page has not been updated yet. The page does not reflect the transition from PBS to Slurm.
# R
# R
## Introduction
## Introduction
...
@@ -42,7 +39,7 @@ $ rstudio
...
@@ -42,7 +39,7 @@ $ rstudio
### Batch Execution
### Batch Execution
To run R in batch mode, write an R script, then write a bash jobscript and execute via the `qsub` command. By default, R will use 24 threads on Salomon when running MKL kernels.
To run R in batch mode, write an R script, then write a bash jobscript and execute via the `sbatch` command. By default, R will use 24 threads on Salomon when running MKL kernels.
Example jobscript:
Example jobscript:
...
@@ -50,12 +47,12 @@ Example jobscript:
...
@@ -50,12 +47,12 @@ Example jobscript:
#!/bin/bash
#!/bin/bash
# change to local scratch directory
# change to local scratch directory
DIR=/scratch/project/PROJECT_ID/$PBS_JOBID
DIR=/scratch/project/PROJECT_ID/$SLURM_JOBID
mkdir-p"$DIR"
mkdir-p"$DIR"
cd"$DIR"||exit
cd"$DIR"||exit
# copy input file to scratch
# copy input file to scratch
cp$PBS_O_WORKDIR/rscript.R .
cp$SLURM_SUBMIT_DIR/rscript.R .
# load R module
# load R module
ml R
ml R
...
@@ -64,13 +61,14 @@ ml R
...
@@ -64,13 +61,14 @@ ml R
R CMD BATCH rscript.R routput.out
R CMD BATCH rscript.R routput.out
# copy output file to home
# copy output file to home
cp routput.out $PBS_O_WORKDIR/.
cp routput.out $SLURM_SUBMIT_DIR/.
#exit
#exit
exit
exit
```
```
This script may be submitted directly to the PBS workload manager via the `qsub` command. The inputs are in the rscript.R file, the outputs in the routput.out file. See the single node jobscript example in the [Job execution section][1].
The inputs are in the `rscript.R` file, the outputs in the `routput.out` file.
See the single node jobscript example in the [Job execution section][1].
## Parallel R
## Parallel R
...
@@ -363,23 +361,23 @@ Currently, the two packages cannot be combined for hybrid calculations.
...
@@ -363,23 +361,23 @@ Currently, the two packages cannot be combined for hybrid calculations.
## Parallel Execution
## Parallel Execution
R parallel jobs are executed via the PBS queue system exactly as any other parallel jobs. The user must create an appropriate jobscript and submit it via `qsub`
R parallel jobs are executed via the SLURM partition system exactly as any other parallel jobs. The user must create an appropriate jobscript and submit it via `sbatch`
An example jobscript for [static Rmpi][4] parallel R execution, running 1 process per core:
An example jobscript for [static Rmpi][4] parallel R execution, running 1 process per core: