How do I redirect stdout/stderr in my SLURM job scripts?



I submit a job in a slurm cluster and all output and error messages go into the same file. Is there a way I can separate the error messages from the output?

CURATOR: torey


ORIGINAL AUTHOR of this ANSWER: toreliza

With SLURM, the default stdout and stderr are directed to the same file. The file has a .out extension and the filename is dependent on the job ID and array index, if applicable. The default can be changed in the preamble of the SLURM submit script (the β€˜top’ part where β€˜#SBATCH’ is used). Below is a code fragment showing a redirect of stderr (-e) separately from a redirect of stdout (-o). The %j will be replaced by the SLURM_JOB_ID.

#SBATCH -e slurm-%j.err
#SBATCH -o slurm-%j.out