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:
Symbol | Effect |
---|---|
\\ | Do not process any of the replacement symbols. |
%% | The character "%". |
%A | Job array's master job allocation number. |
%a | Job array ID (index) number. |
%J | jobid.stepid of the running job. (e.g. "128.0") |
%j | jobid of the running job. |
%N | short hostname. This will create a separate IO file per node. |
%n | Node 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. |
%s | stepid of the running job. |
%t | ask identifier (rank) relative to current job. This will create a separate IO file per task. |
%u | User name. |
%x | Job name. |
For further information consult the slurm documentation here: https://slurm.schedmd.com/sbatch.html
Related articles