massive-website-banner

Slurm FAQ

How do I use named variables in Slurm scripts?

Question:

I have some qsub scripts which use the -v option to pass named variables to my job script.

e.g.

qsub -v INPUTDATA=~/mydata/data.dat jobscript

How can I do the same in Slurm and keep this part of my jobscript the same?

Answer: 

By default Slurm uses the environment variables from the submit host in the job. So all you need to do is change the variable to be a shell variable and the named variable will be available from the script. This can be done on the command line by moving the variable definition before the sbatch command (and removing the -v).

e.g.

INPUTDATA=~/mydata/data.dat sbatch jobscript

Copyright © 2016 MASSIVE. All Rights Reserved.