Is it possible to configure the directory for sbatch's default output file?

kjo picture kjo · Sep 28, 2017 · Viewed 7k times · Source

Is there some way to configure an alternative default directory (other than the current directory) for sbatch to put the file slurm-%j.out (or slurm-%A_%a.out) that it generates when the -o is not specified?

My goals here are to have a convenient/low-maintenance way to

  1. consolidate all default output files generated by sbatch in one place; and
  2. avoid cluttering the current directory with such files.

I had hoped to find something like a SLURM_DEFAULT_OUTPUT_DIRECTORY environment variable to take care of this, but if there is such a variable, I managed to miss it.

Is there some other mechanism to achieve the desired results?


(FWIW, the only precedent that comes to mind for the functionality I'm after is Emacs's backup-directory-alist, which tells Emacs were to put the backup files it generates by default. This feature is more sophisticated than what I'm after, because it supports multiple such directories, to be used according to patterns in the original filenames.)

Answer

milihoosh picture milihoosh · Apr 20, 2018

Pass a log file into a folder as follows in bash script:

#SBATCH -o ./Report/output.%a.out # STDOUT

This will put the output files in "Report" folder next to your batch script.