Print the number of cpus in use per job in slurm?

We have switched to using slurm from sge for our cluster job queuing system. In sge when you used the qstat function it printed the number of cpus/slots in use per job - is there a simple way to do this in slurm? squeue only shows the number of nodes used per job. Thanks.

           1981      q      run-01     root  R      16:21      1 node001
           1982      q      run-02     root  R      16:21      1 node002
           1983      q      run-03     root  R      16:21      1 node003

1 answer

  • answered 2020-11-20 13:12 damienfrancois

    The squeue command has two parameters that allow choosing the columns displayed in the output --format and --Format. Each have an option (respectively %c and NumCPUs) to display the number of cores requested by the job.

    Try with

    squeue -o "%.18i %.9P %.8j %.8u %.2t %.10M %.6D %R %c"

    This will show the default columns and add the number of cores as the last column. You can fiddle with the format string to arrange the columns as you want. Then, when you are happy with the output, you can set it as the value of the SQUEUE_FORMAT variable in your .bash_profile or .bashrc.

    export SQUEUE_FORMAT='%.18i %.9P %.8j %.8u %.2t %.10M %.6D %R %c'

    See the squeue man page for more details.