For a parallel program managed by slurm, I'm using the pattern described here https://slurm.schedmd.com/sbatch.html#lbAH to form the output files with the job name and job ids. However, I'm also running analysis on the program's runtime with the number of processors, and I need to add the number of tasks used to the filename to keep track.
I currently have the program (in MPI) printing how many processes are running, but that requires opening each file to inspect the contents and doesn't lend itself to easier manipulation by the shell. How can I encode the number of tasks that %J.%T.%j (for example) gives the job name, the number of tasks, and the job id separated by dots respectively?