Difference between revisions of "Using Variables in SLURM Jobs"
Jump to navigation
Jump to search
(Created page with "Category:SLURM =Passing variables into a job at submission= It is possible to pass variables into a SLURM job when you submit the job using the --export flag. For example...") |
|||
Line 4: | Line 4: | ||
It is possible to pass variables into a SLURM job when you submit the job using the --export flag. | It is possible to pass variables into a SLURM job when you submit the job using the --export flag. | ||
For example to pass the value of the variables A and b into the job script named jobscript.sbatch you can use: | For example to pass the value of the variables A and b into the job script named jobscript.sbatch you can use: | ||
− | |||
− | |||
− | |||
sbatch --export=A=5,b='test' jobscript.sbatch | sbatch --export=A=5,b='test' jobscript.sbatch | ||
Line 12: | Line 9: | ||
SLURM does not support using variables in the #SBATCH lines within a job script. However, values passed from the command line have precedence over values defined in the job script. So job name and output/error files can be passed on the sbatch command line: | SLURM does not support using variables in the #SBATCH lines within a job script. However, values passed from the command line have precedence over values defined in the job script. So job name and output/error files can be passed on the sbatch command line: | ||
− | sbatch --job-name=$A.$b.run --output=$A.$b.out --export=A,b jobscript.sbatch | + | sbatch --job-name=$A.$b.run --output=$A.$b.out --export=A=5,b='test' jobscript.sbatch |
Revision as of 15:51, 10 June 2016
Passing variables into a job at submission
It is possible to pass variables into a SLURM job when you submit the job using the --export flag. For example to pass the value of the variables A and b into the job script named jobscript.sbatch you can use:
sbatch --export=A=5,b='test' jobscript.sbatch
Using variables to set SLURM job name and output files
SLURM does not support using variables in the #SBATCH lines within a job script. However, values passed from the command line have precedence over values defined in the job script. So job name and output/error files can be passed on the sbatch command line:
sbatch --job-name=$A.$b.run --output=$A.$b.out --export=A=5,b='test' jobscript.sbatch