[slurm-users] How to access environment variables in submit script?

Dmitri Chebotarov dchebota at gmu.edu
Thu May 10 07:19:10 MDT 2018


Hello

Is it possible to access environment variables in a submit script?
F.e. $SCRATCH is set to a path and I like to use $SCRATCH variable in #SBATCH:

#SBATCH --output=$SCRATCH/slurm/%j.out
#SBATCH --error=$SCRATCH/slurm/%j.err

Since it's Bash script, # are ignored and I suspect these variables need to be defined on Slurm controller (?).

As a workaround I can run 'sbatch --output=$SCRATCH/slurm/%j.out --error=$SCRATCH/slurm/%j.err <myscript>' and it works. But is there any way to use non-slurm env variables via #SBATCH? 

Thank you



More information about the slurm-users mailing list