Page tree
Skip to end of metadata
Go to start of metadata

In many occasions we may need to name the output file of a slurm script different to "slurm-123456.out" (where 123456 is the jobID).

In order to change the name, use the option:

--output=<filename pattern>

sbatch allows for a filename pattern to contain one or more replacement symbols. The syntax is a percentage sign "%" followed by a letter.

As a pracical example, let's say the user wants to name the output file as "myLog-123456.out" (where 123456 is the jobID). The settings should be:

#SBATCH --output=myLog-%j.out

As another example, consider that the user wants the first part of the output file to have exactly the same name as the job. The symbol "%x" is used for that:

#SBATCH --job-name=CaseReynolds100
#SBATCH --output=%x-%j.out
Then, the output file will be named: "CaseReynolds100-123456.out"

Other replacement symbols are:

SymbolEffect
\\Do not process any of the replacement symbols.
%%The character "%".
%AJob array's master job allocation number.
%aJob array ID (index) number.
%Jjobid.stepid of the running job. (e.g. "128.0")
%jjobid of the running job.
%Nshort hostname. This will create a separate IO file per node.
%nNode identifier relative to current job (e.g. "0" is the first node of the running job) This will create a separate IO file per node.
%sstepid of the running job.
%task identifier (rank) relative to current job. This will create a separate IO file per task.
%uUser name.
%xJob name.

For further information consult the slurm documentation here: https://slurm.schedmd.com/sbatch.html