User Tools

Site Tools


guides:slurm:using-r

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
guides:slurm:using-r [23.09.2019 11:06]
Teemu Kuulasmaa
guides:slurm:using-r [23.09.2019 11:15]
Teemu Kuulasmaa
Line 1: Line 1:
-# Using R with SLURM+# Using R with Slurm
  
 Example script (**hello.R**): Example script (**hello.R**):
Line 14: Line 14:
 2. Rscript script.R 2. Rscript script.R
  
-Note: With the **R CMD BATCH** command the output of the R script is redirected to file instead of the screen+**Note**: With the **R CMD BATCH** command the output of the R script is redirected to file instead of the screen.
  
-Next user must embed the script to the **SLURM batch job file/control file** (**submit.sbatch**):+Next user must embed the script into the SLURM batch job file/control file (e.g. scriptR.sbatch):
  
 ``` ```
- 
 #!/bin/bash #!/bin/bash
-#SBATCH --job-name helloworld # Name for your job +#SBATCH --job-name helloworld # Name for your job 
-#SBATCH --ntasks 1 # Number of task +#SBATCH --ntasks 1 # Number of task 
-#SBATCH --time 5 # Runtime in minutes. +#SBATCH --time 5 # Runtime in minutes. 
-#SBATCH --mem=2000 # Reserve 2 GB RAM for the job +#SBATCH --mem=2000 # Reserve 2 GB RAM for the job 
-#SBATCH --partition serial # Partition to submit +#SBATCH --partition serial # Partition to submit 
-#SBATCH --output hello.out # Standard out goes to this file +#SBATCH --output hello.out # Standard out goes to this file 
-#SBATCH --error hello.err # Standard err goes to this file +#SBATCH --error hello.err # Standard err goes to this file 
-#SBATCH --mail-user username@uef.fi # this is the email you wish to be notified at +#SBATCH --mail-user username@uef.fi # this is the email you wish to be notified at 
-#SBATCH --mail-type ALL # ALL will alert you of job beginning, completion, failure etc+#SBATCH --mail-type ALL # ALL will alert you of job beginning, completion, failure etc
  
 module load r # load modules module load r # load modules
Line 35: Line 34:
 Rscript hello.R # Execute the script Rscript hello.R # Execute the script
  
-sbatch 
 ``` ```
-User can submit the job to the compute queue with the **[sbatch](https://slurm.schedmd.com/sbatch.html)** command. Note that the batch file (and R script and data) must be located at the /home/ disk.+The last step is to submit the job to the compute queue with the **[sbatch](https://slurm.schedmd.com/sbatch.html)** command. Note that the batch file (and R script and data) must be located at local file system of login node, e.g. /home/users/ disk.
  
 ``` ```
-sbatch submit.sbatch+sbatch scriptR.sbatch
 ``` ```
guides/slurm/using-r.txt · Last modified: 18.11.2021 11:19 by Administrator