Difference between revisions of "SLURM"

From Mufasa (BioHPC)
Jump to navigation Jump to search
 
(246 intermediate revisions by the same user not shown)
Line 13: Line 13:
Computation jobs on Mufasa needs to be launched via [[System#The SLURM job scheduling system|SLURM]]. SLURM provides jobs with access to the [[#System resources subjected to limitations|physical resources]] of Mufasa, such as CPUs, GPUs and RAM. Thanks to SLURM, processing jobs share system resources, optimising their occupation and availability.  
Computation jobs on Mufasa needs to be launched via [[System#The SLURM job scheduling system|SLURM]]. SLURM provides jobs with access to the [[#System resources subjected to limitations|physical resources]] of Mufasa, such as CPUs, GPUs and RAM. Thanks to SLURM, processing jobs share system resources, optimising their occupation and availability.  


When a user runs a job, the job does not get executed immediately and is instead ''queued''. SLURM executes jobs according to their order in the queue: the top job in the queue gets executed as soon as the necessary resources are available, while jobs lower in the queue wait longer. The position of a job in the queue is due to the '''[[#Job priority|priority]]''' assigned to it by SLURM, with higher-priority jobs closer to the top. As a general rule:
When a user runs a job, the job does not get executed immediately and is instead ''queued''. SLURM executes jobs according to their order in the queue: the top job in the queue gets executed as soon as the necessary resources are available, while jobs lower in the queue wait longer. The position of a job in the queue is due to the '''priority''' assigned to it by SLURM, with higher-priority jobs closer to the top. As a general rule:


;: '''the greater the fraction of Mufasa's overall resources that a job asks for, the lower the job's priority will be'''.
;: '''the greater the fraction of Mufasa's overall resources that a job asks for, the lower the job's priority will be'''.


The priority mechanism is used to encourage users to use Mufasa's resources in an effective and equitable manner. This page includes a [[#How_to_maximise_the_priority_of_your_jobs|chart explaining how to maximise the priority of your jobs]].
The [[#Job priority|priority mechanism]] is used to encourage users to use Mufasa's resources (i.e.: GPUs, CPUs, RAM, execution time) in an effective and equitable manner. This page includes a [[#How_to_maximise_the_priority_of_your_jobs|chart explaining how to maximise the priority of your jobs]].


The '''time''' available to a job for its execution is controlled by SLURM. When a user requests execution of a job, they must specify the duration of the time slot that the job needs. The job must complete its execution before the end of the requested time slot, otherwise it gets killed by SLURM.
The '''time''' available to a job for its execution is controlled by SLURM. When a user requests execution of a job, they must specify the duration of the time slot that the job needs. The job must complete its execution before the end of the requested time slot, because at the end of such slot it gets killed by SLURM.


In Mufasa 2.0 access to system resources is managed via SLURM's '''[[#SLURM Quality of Service (QOS)|Quality of Service (QOS)]]''' mechanism (Mufasa 1.0 used [[#SLURM_partitions|partitions]] instead). To launch a processing job via SLURM, the user must always specify the chosen QOS. QOSes differ in the set of resources that they provide access to because each of them is designed to fit a given type of job.
In Mufasa 2.0 access to system resources is managed via SLURM's [[#SLURM Quality of Service (QOS)|Quality of Service (QOS)]] mechanism (Mufasa 1.0 used [[#SLURM_partitions|partitions]] instead). While [[User Jobs#Running jobs with SLURM|launching a processing job via SLURM]], the user must always specify the chosen QOS. QOSes differ in the set of resources that they provide access to because each of them is designed to fit a given type of job.


Mufasa sets limits to the number of jobs by the same user. This page includes a [[#Limits on jobs by the same user|table summarising such limits]].
Mufasa sets limits to the number of jobs by the same user. This page includes a [[#Limits on jobs by the same user|table summarising such limits]].
Line 34: Line 34:


<pre style="color: lightgrey; background: black;">
<pre style="color: lightgrey; background: black;">
sacctmgr list qos format=name%-11,priority,MaxSubmit,maxwall,maxtres%-80
sacctmgr list qos format=name%-11,priority,MaxSubmit,maxwall,maxtres%-80,mintres%-18
</pre>
</pre>


which provides an output similar to the following:
which provides an output similar to the following (see below for the same data in table form):


<pre style="color: lightgrey; background: black;">
<pre style="color: lightgrey; background: black;">
Name          Priority MaxSubmit    MaxWall MaxTRES                                                                           
Name          Priority MaxSubmit    MaxWall MaxTRES                                                                          MinTRES           
----------- ---------- --------- ----------- --------------------------------------------------------------------------------  
----------- ---------- --------- ----------- -------------------------------------------------------------------------------- ------------------  
normal              0                                                                                                      
normal              0                                                                                                                          
nogpu                4        1  3-00:00:00 cpu=16,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,gres/gpu=0,mem=128G  
nogpu                4        1  3-00:00:00 cpu=16,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,gres/gpu=0,mem=128G                  
gpuheavy-20          1        1            cpu=8,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=2,mem=128G             
gpuheavy-20          1        1            cpu=8,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=2,mem=128G            gres/gpu:4g.20gb=1
gpuheavy-40          1        1            cpu=8,gres/gpu:3g.20gb=0,gres/gpu:40gb=1,gres/gpu:4g.20gb=0,mem=128G             
gpuheavy-40          1        1            cpu=8,gres/gpu:3g.20gb=0,gres/gpu:40gb=1,gres/gpu:4g.20gb=0,mem=128G            gres/gpu:40gb=1   
gpulight            8        1    12:00:00 cpu=2,gres/gpu:3g.20gb=1,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,mem=64G               
gpulight            8        1    12:00:00 cpu=2,gres/gpu:3g.20gb=1,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,mem=64G              gres/gpu:3g.20gb=1
gpu                  2        1  1-00:00:00 cpu=8,gres/gpu:3g.20gb=1,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,mem=64G               
gpu                  2        1  1-00:00:00 cpu=8,gres/gpu:3g.20gb=1,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,mem=64G              gres/gpu:3g.20gb=1
gpuwide              2        2  1-00:00:00 cpu=8,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=1,mem=64G               
gpuwide              2        2  1-00:00:00 cpu=8,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=1,mem=64G              gres/gpu:4g.20gb=1
build              32        1    02:00:00 cpu=2,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,gres/gpu=0,mem=16G
build              32        1    02:00:00 cpu=2,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,gres/gpu=0,mem=16G
</pre>
</pre>
Line 77: Line 77:
::: --> if not specified, the job gets the default amount of RAM specified by the [[#SLURM partitions|partition]]
::: --> if not specified, the job gets the default amount of RAM specified by the [[#SLURM partitions|partition]]


For instance, QOS <code>gpulight</code> provides jobs that use it with:
:; MinTRES
* priority tier equal to 8
:: minimum amount of [[#System resources subjected to limitations|resources subjected to limitations]] ("''Trackable RESources''") that a job using the QOS must request in order to actually get executed by SLURM.
* a maximum of 1 submitted job per user
:: (If your job does not actually need these resources, you've chosen the wrong QOS: you can use one with a higher priority.)
* a maximum of 12 hours of duration
* a maximum of 2 CPUs
* a maximum of 64 GB of RAM
* this access to GPUs:
** maximum 1 GPU of type ''gpu:3g.20gb''
** no GPUs of type ''gpu:40gb=0''
** no GPUs of type ''gpu:4g.20gb''


As seen in the example output from <code>sacctmgr list qos</code> above, each QOS has an associated '''priority tier'''. In Mufasa 2.0, priority tiers are used to encourage users to use the '''least powerful QOS that is compatible with their needs''', where "powerful" means "rich with resources". Less powerful QOSes increase the priority of the jobs that use them, so these jobs tend to be executed sooner.


See [[#Priority|Priority]] to understand how priority affects the execution order of jobs in Mufasa 2.0.
The <code>normal</code> QOS is the default one, and exists only to ensure that users always specify a QOS when running a job. Since <code>normal</code> has zero priority and no resources, a job run using this QOS would never be run.


The <code>normal</code> QOS is the default one: it exists only to ensure that users always specify a QOS when running a job. Since <code>normal</code> has zero priority and no resources, a job run using this QOS would never be run.
The information provided by the <code>sacctmgr list qos</code> command above is summarised by the following table:
 
{| class="wikitable" style="text-align:center;"
|-
! QOS
! Priority</br>tier
! Max</br>Submit
! MaxWall</br>[h]
! max # of</br>CPUs
! max RAM</br>[GB]
! max # of</br>3g.20GB</br>GPUs
! max # of</br>4g.20GB</br>GPUs
! max # of</br>40GB</br>GPUs
|-
! rowspan="1" style="text-align:center;" | build
| 32
| 1
| 2
| 2
| 16
| -
| -
| -
|-
! rowspan="1" style="text-align:center;" | gpulight
| 8
| 1
| 12
| 2
| 64
| 1 (min=1)
| -
| -
|-
! rowspan="1" style="text-align:center;" | nogpu
| 4
| 1
| 72
| 16
| 128
| -
| -
| -
|-
! rowspan="1" style="text-align:center;" | gpu
| 2
| 1
| 24
| 8
| 64
| 1 (min=1)
| -
| -
|-
! rowspan="1" style="text-align:center;" | gpuwide
| 2
| 2
| 24
| 8
| 64
| -
| 1 (min=1)
| -
|-
! rowspan="1" style="text-align:center;" | gpuheavy-20
| 1
| 1
| 72 (set by partition)
| 8
| 128
| -
| 2 (min=1)
| -
|-
! rowspan="1" style="text-align:center;" | gpuheavy-40
| 1
| 1
| 72 (set by partition)
| 8
| 128
| -
| -
| 1 (min=1)
|}
 
A key piece of information in the table above is the '''priority tier''' associated to each QOS. In Mufasa 2.0, priority tiers are used to encourage users to use the '''least powerful QOS that is compatible with their needs''', where "powerful" means "rich with resources". Less powerful QOSes increase the priority of the jobs that use them, so these jobs tend to be executed sooner. See [[#Job priority|Job priority]] for details about how priority affects the execution order of jobs in Mufasa 2.0.


== The <code>build</code> QOS ==
== The <code>build</code> QOS ==


This QOS is specifically designed to be used by Mufasa users to '''build [[System#Containers|container images]]'''. Its associated priority tier is very high, so  SLURM jobs launched using this QOS are executed quickly.  
This QOS is specifically designed to be used by Mufasa users to '''quickly build [[System#Containers|container images]]'''. Its associated priority tier is very high: this, combined with the fact that jobs using this QOS require few resources, means that such jobs usually get executed very soon.


The <code>build</code> QOS, though, has resources that are strictly limited to those needed for building operations; additionally, it has no access to GPUs and a short maximum duration for jobs. This makes it unsuitable for computing activities different from building containers.
On the other hand, the limited resources and the lack of access to the GPUs make the <code>build</code> QOS unsuitable for other tasks.


See [[Singularity#Building Singularity images|Building Singularity images]] for directions about building Singularity container images.
See [[Singularity#Building Singularity images|Building Singularity images]] for directions about building Singularity container images.
Line 104: Line 181:
== Restricted QOSes ==
== Restricted QOSes ==


In Mufasa, the most powerful QOSes are reserved to researchers (including Ph.D. students), and not available to M.Sc. students.
In Mufasa, the most powerful QOSes are reserved to researchers (called <code>research</code> users: these include academic personnel and Ph.D. students). M.Sc. students, called <code>students</code> users, cannot use them while running jobs.


See [[#research users and students users|below]] to understand the differences between <code>researcher</code> users and <code>students</code> users.
See [[#research users and students users|below]] to understand how ''user categories'' work in Mufasa 2.0.


= <code>research</code> users and <code>students</code> users =
= <code>research</code> users and <code>students</code> users =


Users of Mufasa belong to two '''user categories''', which provide the users belonging to them with different access to system resources. The idea behind these categories is to provide researchers with more access to Mufasa's resources, without preventing students from using the server.
Users of Mufasa belong to two '''user categories'''. Categories provide users with different access to to Mufasa's resources: the idea being to provide researchers with more access while still letting students benefit from the server's capabilities.


User categories are:
User categories in Mufasa are the following:


:: '''<code>research</code>''', i.e. academic personnel and Ph.D. students
:: '''<code>research</code>''', i.e. academic personnel and Ph.D. students
::: * have access to all [[#SLURM Quality of Service (QOS)|QOSes]]
::: * can use all QOSes, including the the [[#Restricted QOSes|restricted ones]]
::: * their jobs have a higher ''base priority''
::: * their jobs have a higher ''base priority''
::: * the number of running jobs that the user can have is higher
::: * have a higher number of jobs that can be running at the same time


:: '''<code>students</code>''', i.e. M.Sc. students
:: '''<code>students</code>''', i.e. M.Sc. students
::: * have access to a restricted set of [[#SLURM Quality of Service (QOS)|QOSes]]
::: * cannot use the [[#Restricted QOSes|restricted QOSes]]
::: * their jobs have a lower ''base priority''
::: * their jobs have a lower ''base priority''
::: * the number of running jobs that the user can have is lower
::: * have a lower number of jobs that can be running at the same time


You can inspect the differences between <code>research</code> and <code>students</code> users with command
You can inspect the differences in priority and running jobs between <code>research</code> and <code>students</code> users with command


<pre style="color: lightgrey; background: black;">
<pre style="color: lightgrey; background: black;">
Line 156: Line 233:
= Limits on jobs by the same user =
= Limits on jobs by the same user =


Mufasa sets limits on the number of jobs from a single user. Such limits aim at preventing users from "hoarding" system resources, and apply to:
Mufasa enforces limits on the number of jobs from a single user. Such limits aim at preventing users from "hogging" system resources, and apply to:
* '''submitted jobs''', i.e. jobs that the user asked SLURM to execute, each of which may currently be either running or queued
* '''submitted jobs''', i.e. jobs that the user asked SLURM to execute, each of which may currently be either running or queued
* '''running jobs''', i.e. jobs that are currently in execution
* '''running jobs''', i.e. jobs that are currently in execution


The following table summarises the limits that Mufasa sets on the number of jobs by the same user:
Limits on submitted jobs are set via [[#SLURM Quality of Service (QOS)|QOSes]], while limits on running jobs are set via [[#research users and students users|user category]].
 
The following table summarises what limits exist:


{| class="wikitable" style="text-align:center;"
{| class="wikitable" style="text-align:center;"
|-
|-
!  
!  
! number of running jobs
! on the number of <u>running</u> jobs</br>by a single user
! number of submitted jobs
! on the number of <u>submitted</u> jobs</br>by a single user
|-
|-
! rowspan="1" style="text-align:center;" | global limits<br/>(system-wide)
! rowspan="1" style="text-align:center;" | global limits<br/>(system-wide)
| '''''2 for'' <code>research</code> ''users'''''<br/>'''''1 for'' <code>students</code> ''users'''''
| '''''2 for'' <code>research</code> ''users'''''<br/>'''''1 for'' <code>students</code> ''users'''''
| '''''not limited directly...'''''<br/>...but cannot exceed the sum of the limits on submitted jobs set by the QOSes (below)
| '''''not limited directly...'''''<br/>...but subject to limits set by individual QOSes (below)
|-
|-
! rowspan="1" style="text-align:center;" | limits for each QoS
! rowspan="1" style="text-align:center;" | limits for<br/>individual</br>QOSes
| '''''not limited directly...'''''<br/>...but cannot exceed the global limit on running jobs (above) nor the QoS limit on submitted jobs (on the right)
| '''''not limited directly...'''''<br/>...but subject to global limits (above)
| '''''2 for'' <code>gpuwide</code> ''QOS'''''<br/>'''''1 for all other QOSes'''''
| '''''2 for the'' <code>gpuwide</code> ''QOS'''''<br/>'''''1 for each of the other QOSes'''''
|}
|}
Limits on the number of running jobs depend on the user category (either [[#research users and students users|researcher or students]]) that the user belongs to; limits on the number of submitted jobs depend on the properties of the [[#SLURM Quality of Service (QOS)|SLURM QOSes]] used to launch them.


= Job priority =
= Job priority =
Line 190: Line 267:
* they ensure that their job is executed as soon as possible;
* they ensure that their job is executed as soon as possible;
* they leave as much as possible of Mufasa's resources free for other users's jobs.
* they leave as much as possible of Mufasa's resources free for other users's jobs.
[[#How to maximise the priority of your jobs|Useful tips]] to maximise the priority of your jobs are provided below.


== Elements determining job priority ==
== Elements determining job priority ==
Line 200: Line 279:
::: Used to provide higher priority to jobs asking for '''less resources'''
::: Used to provide higher priority to jobs asking for '''less resources'''


: '''Number of CPUs''' requested by the job (also called "job size")
: '''Number of CPUs''' requested by the job
::: Used to provide higher priority to jobs asking for '''a lower number of CPUs'''
::: Used to provide higher priority to jobs asking for '''a lower number of CPUs'''
: '''Job duration''', i.e. the execution time requested by the job
::: Used to provide higher priority to '''shorter jobs'''


: '''Job Age''', i.e. the time that the job has been waiting in the queue
: '''Job Age''', i.e. the time that the job has been waiting in the queue
::: Used to provide higher priority to jobs which have been '''queued for a longer time'''
::: Used to provide higher priority to jobs which have been '''queued for a longer time'''
::: (Periods when a queued job is not eligible for running because of the [[#Limits on jobs by the same user|limits on running jobs by the same user]] do not increase job age)


: '''FairShare''', i.e. a factor computed by SLURM to balance use of the system by different users
: '''FairShare''', i.e. a factor computed by SLURM to balance use of the system by different users
::: Used to provide higher priority to jobs by users who '''used Mufasa less than others''' (i.e., used less resources: CPUs, GPUs, RAM, execution time)
::: Used to provide higher priority to jobs by users who '''used Mufasa's resources less than others''' (see [[#How FairShare works|below]])
::: FairShare has a "fading memory", i.e. the influence of past resource usage gets lower the farther it is from now


== How to maximise the priority of your jobs ==
== Contributions to priority ==
You can understand how each element contributes to the priority of the jobs waiting for execution (both yours and of other users) with command <code>sprio</code>. A tailored version of <code>sprio</code> that only displays the parameters listed above is the following:
<pre style="color: lightgrey; background: black;">
sprio --sort=-y -o "%6i %9u %.8Y %.10B %.5Q %.9T %.5A %.5F"
</pre>


Every time you run a SLURM job, follow these guidelines:
Here is an example of the output of the command above:
<pre style="color: lightgrey; background: black;">
JOBID  USER      PRIORITY      ASSOC  QOS      TRES  AGE FAIRS
6663  amarzullo    5053      2000  3000  cpu=-150  132    71
6685  cmanzoni      4528        500  3000  cpu=-300    7  1321
6682  sgirardi      4466        500  3000  cpu=-300    17  1250
6660  bagostini    4361        500  3000  cpu=-300  162  1000
6615  lpassoni      2884      2000  375 cpu=-1200  1656    54
6686  amoglia      2597      2000  750  cpu=-600    1  446
6616  lpassoni      2561      2000  375 cpu=-1200  1333    54
6659  rjiao        2064        500  750  cpu=-600  432  982
6669  amarasi      1639      2000  750 cpu=-1200    0    89
6673  fbottazzi    1614        500  750  cpu=-600    0  964
6657  fpastori      1210      2000  375 cpu=-1200    0    36
6676  flazzaro      1029        500  750 cpu=-1200    33  946
</pre>
In it, column PRIORITY provides the overall priority of each job. Each priority value is the sum of the five values to its right; in particular, column ASSOC corresponds to user category, while column TRES corresponds to the number of CPUs. Note that the contribution of TRES to priority is ''negative'', i.e. it is a penalty; its value is proportional to the number of CPUs requested by the job.


:{|class="wikitable"
'''Things to consider when using <code>sprio</code>'''
|
* Its output is only relevant for jobs ''not yet in execution''. For an already running job, the values shown by <code>sprio</code> correspond to the priority that the job would get if evaluated now: however, this priority does not affect job execution in any way.
; Choose the less powerful QOS compatible with the needs of your job
* Jobs listed by <code>sprio</code> may temporarily differ from jobs listed by <code>squeue</code>: this is due to the fact that SLURM updates its internal data (used by <code>sprio</code>) every few minutes, while the output of <code>squeue</code> is updated much more frequently.
:: QOSes with access to less resources lead to higher priority


; Only request CPUs that your job will actually use
===Contributions to priority===
:: If you didn't design your code to exploit multiple CPUs, check that it does! If it doesn't, do not ask for them
The maximum (in absolute value) contribution that each element can provide to priority can be inspected with
<pre style="color: lightgrey; background: black;">
sprio -w -o "%10B %10Q %10T %10A %10F"
</pre>
which provides an output similar to the following:
<pre style="color: lightgrey; background: black;">
ASSOC      QOS        TRES      AGE        FAIRSHARE
2000      12000      CPU=-8700  10000      1500
</pre>
For a particular job, the contribution of each element is equal to the maximum for that element scaled according to factors associated to each of the possible choices.


; Do not request more time than your jobs needs to complete
For [[#research users and students users|association]] the scaling factor is proportional to the "Priority" feature of the corresponding elements of SLURM. For instance, <code>researcher</code> may get the maximum value while <code>students</code> users may only get a contribution equal to 1/4 of it (if <code>researcher</code> has a Priority of 4 and <code>students</code> has a Priority of 1).
:: Make a worst-case estimate and only ask for that duration


; Test and debug your code using less powerful QOSes before running it on more powerful QOSes
Also for [[#SLURM Quality of Service (QOS)|QOS]] the scaling factor is proportional to the "Priority" feature of the corresponding elements of SLURM. For instance, jobs using the <code>build</code> may get the maximum value while jobs using QOS <code>nogpu</code> users may only get 1/8 of it (=(1/32)*4, if Priorities are 32 and 4 for <code>build</code> and <code>nogpu</code> respectively).
:: Your test jobs will get a higher priority and your FairShare will improve


; Cancel jobs when you don't need them anymore
For age, the scaling factor is the ratio between the job's waiting time and a maximum age defined by <code>slurm.conf</code>: e.g., 10 days.
:: [[User_Jobs#Cancelling_a_job_with_scancel|Use scancel]] to delete your jobs when finished (or if they become useless due to a bug): your Fairshare will improve
|}


= System resources subjected to limitations =
For the TRES and FairShare contributions, see sections [[#Understanding CPU impact on priority|Understanding CPU impact on priority]] and [[#How FairShare works|How FairShare works]] below.


In systems based on SLURM like Mufasa, '''TRES (Trackable RESources)''' are (from [https://slurm.schedmd.com/tres.html SLURM's documentation] "''resources that can be tracked for usage or used to enforce limits against.''"
=== Understanding CPU impact on priority ===
The contribution of the CPUs requested by a job to the priority of the job is always negative, i.e. it penalises the job. The penalisation is proportional to the number of CPUs requested by the job. The per-CPU penalty is equal to the output of command
<pre style="color: lightgrey; background: black;">
sprio -w -o "%T"
</pre>
divided by the number of CPUs available to SLURM, which is 58.
For instance, if the output of the command is
<pre style="color: lightgrey; background: black;">
TRES
CPU=-8700
</pre>
this corresponds to a per-CPU penalty of


TRES include CPUs, RAM and '''GRES'''. The last term stands for ''Generic RESources'' that a job may need for its execution. In Mufasa, the only <code>gres</code> resources are the GPUs.
:-8700 / 58 = -150


== <code>gres</code> syntax ==
=== How FairShare works ===
In Mufasa 2.0, the FairShare of each user is computed according to these rules:
# It considers the quantity used by (current and past) user jobs of:
#* '''CPUs''' - impact on FairShare is proportional to the number of CPUs used
#* '''RAM''' - impact on FairShare is proportional to the amount of RAM used
#* '''GPUs''' - impact on FairShare is proportional to the number of GPUs used
#** note: 40 GB GPUs have double the impact on FairShare than 20 GB GPUs
# The impact on FairShare of any use of resources is '''proportional to its duration'''
#* example: using 32 GB of RAM for 48h has the same impact of using 64 GB of RAM for 24h
# FairShare has a "fading memory": i.e., resource use has less and less impact on FairShare the farther in the past it is
#* consequence: over time, the "history" of a user gets forgotten by FairShare


To ask SLURM to assign GRES resources (i.e., GPUs) to a job, a special syntax must be used. Precisely, the name of each GPU resource takes the form
== How to maximise the priority of your jobs ==


'''<code>gpu:Name:Type</code>'''
Every time you run a SLURM job, follow these guidelines:


Considering the [[System#CPUs and GPUs|GPU complement of Mufasa]], <code>Type</code> takes the following values:
:{|class="wikitable"
|
; Choose the less powerful QOS compatible with the needs of your job
:: QOSes with access to less resources have higher base priority.


* '''<code>gpu:40gb</code>''' for GPUs with 40 Gbytes of RAM
; Only request CPUs and RAM that your job really needs
* '''<code>gpu:4g.20gb</code>''' for GPUs with 20 Gbytes of RAM and 4 compute units
:: Usually, code exploits multiple CPUs only if specifically designed to do so: if unsure, only ask for 1 CPU.
* '''<code>gpu:3g.20gb</code>''' for GPUs with 20 Gbytes of RAM and 3 compute units
:: The fewer resources your job asks for, the less it will wait before they become available.
:: The more CPUs your job asks for, the stronger the penalty to its priority.
:: Asking for fewer CPUs and/or less RAM improves your FairShare.


So, for instance,
; Do not request more time than your jobs needs to complete
:: Make a worst-case estimate and only ask for that duration.
:: Asking for less of Mufasa's time improves your FairShare.


<code>gpu:3g.20gb</code>
; Debug and test code using less powerful QOSes before running it with more powerful QOSes
:: Your test jobs will get a higher priority and your FairShare will improve.


identifies a resource corresponding to a GPU with 20 GB of RAM and 3 compute units.
; Cancel jobs when you don't need them anymore
 
:: Always use [[User_Jobs#Cancelling_a_job_with_scancel|scancel]] to delete completed (or crashed) jobs: your Fairshare will improve.
When asking for a GRES resource (e.g., in an <code>srun</code> command or an <code>SBATCH</code> directive of an [[User Jobs#Using execution scripts to run jobs|execution script]]), the syntax required by SLURM is
|}
 
'''<code>gpu:<Type>:<Quantity></code>'''


where <code>Quantity</code> is an integer value specifying how many items of the resource are requested. So, for instance, to ask for 2 GPUs of type <code>4g.20gb</code> the syntax is
Protip: it's a good idea to [[User Jobs#Looking for unused GPUs|check for unused GPUs]] before choosing what to request. Requesting a GPU that is currently idle will help your job get executed sooner.
 
<code>gpu:4g.20gb:2</code>
 
SLURM's ''generic resources'' are defined in <code>/etc/slurm/gres.conf</code>. In order to make GPUs available to SLURM's <code>gres</code> management, Mufasa makes use of Nvidia's [https://developer.nvidia.com/nvidia-management-library-nvml NVML library]. For additional information see [https://slurm.schedmd.com/gres.html SLURM's documentation].
 
== Looking for unused GPUs ==
 
GPUs are usually the most limited resource on Mufasa. So, if your job requires a GPU, the best way to get it executed quickly is to use a QOS associated to a type of GPU of which there are one or more that aren't currently in use. This command
 
<pre style="color: lightgrey; background: black;">
sinfo -O Gres:100
</pre>
 
provides a summary of all the Gres (i.e., GPU) resources possessed by Mufasa. It provides an output similar to the following:
 
<pre style="color: lightgrey; background: black;">
GRES                                                                                               
gpu:40gb:3,gpu:4g.20gb:5,gpu:3g.20gb:5
</pre>
 
To know which of the GPUs are currently in use, use command
 
<pre style="color: lightgrey; background: black;">
sinfo -O GresUsed:100
</pre>
 
which provides an output similar to this:
 
<pre style="color: lightgrey; background: black;">
GRES_USED
gpu:40gb:2(IDX:0-1),gpu:4g.20gb:2(IDX:5,8),gpu:3g.20gb:3(IDX:3-4,6)
</pre>
 
By comparing the two lists (GRES and GRES_USED) you can easily spot unused GPUs.


= SLURM partitions =
= SLURM partitions =


Partitions are another mechanism provided by SLURM to create different levels of access to system resources. Since in Mufasa 2.0 access to resources is controlled via [[#SLURM Quality of Service (QOS)|QOSes]], partitions are not very relevant.  
Partitions are another mechanism provided by SLURM to create different levels of access to system resources. Since in Mufasa 2.0 access to resources is controlled via [[#SLURM Quality of Service (QOS)|QOSes]], partitions are not very relevant. (This is one of the main differences between Mufasa 1.0 and Mufasa 2.0.)


Note, however, that the default values for some features of SLURM jobs (e.g., duration) are [[#Default values|set by the partition]].
Note, however, that the default values for some features of SLURM jobs (e.g., duration) are [[#Default values|set by the partition]].


In Mufasa 2.0, there is a single SLURM partition, called <code>jobs</code>, and all jobs run on it. The partition status of Mufasa can be inspected with
In Mufasa 2.0, there is a single SLURM partition, called <code>jobs</code>, and all jobs run on it. The state of <code>jobs</code> can be inspected with


<pre style="color: lightgrey; background: black;">
<pre style="color: lightgrey; background: black;">
Line 336: Line 429:


The asterisk at the end of the partition name indicates the default partition, i.e. the one on which jobs which do not ask for a specific partition are run.
The asterisk at the end of the partition name indicates the default partition, i.e. the one on which jobs which do not ask for a specific partition are run.
Command <code>sinfo</code> does not tell you about the ''jobs'' submitted to a partition. This information is obtained, instead, with [[User Jobs#Inspecting jobs with squeue|command <code>squeue</code>]].


== Partition availability ==
== Partition availability ==


The most important information that <code>sinfo</code> provides is the '''availability''' (also called ''state'') of partitions. This is shown in column "AVAIL". Possible partition states are:
The most important information that <code>sinfo</code> provides is the '''availability''' (also called '''state''') of partitions. This is shown in column "AVAIL". Possible partition states are:


:'''<code>up</code>''' = the partition is available
:'''<code>up</code>''' = the partition is available
:: Currently running jobs will be completed
:: It's possible to launch jobs on the partition
:: It's possible to launch jobs on the partition
:: Queued jobs will be executed as soon as resources allow
:'''<code>drain</code>''' = the partition is in the process of becoming unavailable (i.e., of entering the <code>down</code> state: see below)
:: Currently running jobs will be completed
:: Currently running jobs will be completed
:: Currently queued jobs will be executed as soon as resources allow
:'''<code>drain</code>''' = the partition is in the process of becoming unavailable (i.e., of entering the <code>down</code> state)
:: It's not possible to launch jobs on the partition
:: It's not possible to launch jobs on the partition
:: Currently running jobs will be completed
:: Queued jobs will be executed when the partition becomes available again (i.e. goes back to the <code>up</code> state)
:: Queued jobs will be executed when the partition becomes available again (i.e. goes back to the <code>up</code> state)


:'''<code>down</code>''' = the partition is unavailable
:'''<code>down</code>''' = the partition is unavailable
:: There are no running jobs
:: It's not possible to launch jobs on the partition
:: It's not possible to launch jobs on the partition
:: There are no running jobs
:: Queued jobs will be executed when the partition becomes available again (i.e. goes back to the <code>up</code> state)
:: Queued jobs will be executed when the partition becomes available again (i.e. goes back to the <code>up</code> state)


When a partition goes from <code>up</code> to <code>drain</code> no harm is done to running jobs. When a partition passes from any other state to <code>down</code>, running jobs (if they exist) get killed. A partition in state <code>drain</code> or <code>down</code> requires intervention by a [[Roles|Job Administrator]] to be restored to <code>up</code>.
When a partition goes from <code>up</code> to <code>drain</code> no harm is done to running jobs. In a normally functioning SLURM system, the passage from <code>up</code> or <code>drain</code> to <code>down</code> happens only when no jobs are running on the partition. If (e.g., due to a malfunction) the passage happens with jobs still running, they get killed.
 
A partition in state <code>drain</code> or <code>down</code> requires intervention by a [[Roles|Job Administrator]] to be restored to <code>up</code>.


== Default values ==
== Default values ==


The features of SLURM partitions can be inspected with
The features of SLURM partitions, including the '''default values''' which are applied to jobs that do not make explicit requests, can be inspected with


<pre style="color: lightgrey; background: black;">
<pre style="color: lightgrey; background: black;">
Line 372: Line 469:
   AllowGroups=ALL AllowAccounts=ALL AllowQos=nogpu,gpulight,gpu,gpuwide,gpuheavy-20,gpuheavy-40
   AllowGroups=ALL AllowAccounts=ALL AllowQos=nogpu,gpulight,gpu,gpuwide,gpuheavy-20,gpuheavy-40
   AllocNodes=ALL Default=YES QoS=N/A
   AllocNodes=ALL Default=YES QoS=N/A
-> DefaultTime=01:00:00 DisableRootJobs=NO ExclusiveUser=NO ExclusiveTopo=NO GraceTime=0 Hidden=NO
  DefaultTime=01:00:00 DisableRootJobs=NO ExclusiveUser=NO ExclusiveTopo=NO GraceTime=0 Hidden=NO
   MaxNodes=UNLIMITED MaxTime=3-00:00:00 MinNodes=0 LLN=NO MaxCPUsPerNode=UNLIMITED MaxCPUsPerSocket=UNLIMITED
   MaxNodes=UNLIMITED MaxTime=3-00:00:00 MinNodes=0 LLN=NO MaxCPUsPerNode=UNLIMITED MaxCPUsPerSocket=UNLIMITED
   Nodes=gn01
   Nodes=gn01
Line 379: Line 476:
   State=UP TotalCPUs=48 TotalNodes=1 SelectTypeParameters=NONE
   State=UP TotalCPUs=48 TotalNodes=1 SelectTypeParameters=NONE
   JobDefaults=(null)
   JobDefaults=(null)
-> DefMemPerNode=4096 MaxMemPerNode=UNLIMITED
  DefMemPerNode=4096 MaxMemPerNode=UNLIMITED
   TRES=cpu=48,mem=1011435M,node=1,billing=49,gres/gpu=13,gres/gpu:3g.20gb=5,gres/gpu:40gb=3,gres/gpu:4g.20gb=5
   TRES=cpu=48,mem=1011435M,node=1,billing=49,gres/gpu=13,gres/gpu:3g.20gb=5,gres/gpu:40gb=3,gres/gpu:4g.20gb=5
   TRESBillingWeights=cpu=1.0,gres/gpu:3g.20gb=6.0,gres/gpu:4g.20gb=6.0,gres/gpu:40gb=6.0,mem=0.05g
   TRESBillingWeights=cpu=1.0,gres/gpu:3g.20gb=6.0,gres/gpu:4g.20gb=6.0,gres/gpu:40gb=6.0,mem=0.05g
</pre>
</pre>


In the example, we have highlighted with "->" the most relevant for Mufasa users, i.e. two '''default values''' which are applied to jobs that do not make explicit requests. Precisely:
In the output of <code>scontrol show partition</code> the most relevant default values for Mufasa users are:


;<code>DefaultTime</code>
;<code>DefaultTime</code>
Line 391: Line 488:
;<code>DefMemPerNode</code>
;<code>DefMemPerNode</code>
:: the default amount of RAM assigned to a job run on the partition (e.g., 4GB)
:: the default amount of RAM assigned to a job run on the partition (e.g., 4GB)
= System resources subjected to limitations =
In systems based on SLURM like Mufasa, '''TRES (Trackable RESources)''' are (from [https://slurm.schedmd.com/tres.html SLURM's documentation] "''resources that can be tracked for usage or used to enforce limits against.''"
TRES include CPUs, RAM and '''GRES'''. The last term stands for ''Generic RESources'' that a job may need for its execution. In Mufasa, the only <code>gres</code> resources are the GPUs.
== <code>gres</code> syntax ==
To ask SLURM to assign GRES resources (i.e., GPUs) to a job, a special syntax must be used. Precisely, the name of each GPU resource takes the form
'''<code>gpu:Name:Type</code>'''
Considering the [[System#CPUs and GPUs|GPU complement of Mufasa]], <code>Type</code> takes the following values:
* '''<code>gpu:40gb</code>''' for GPUs with 40 Gbytes of RAM
* '''<code>gpu:4g.20gb</code>''' for GPUs with 20 Gbytes of RAM and 4 compute units
* '''<code>gpu:3g.20gb</code>''' for GPUs with 20 Gbytes of RAM and 3 compute units
So, for instance,
<code>gpu:3g.20gb</code>
identifies a resource corresponding to a GPU with 20 GB of RAM and 3 compute units.
When asking for a GRES resource (e.g., in an <code>srun</code> command or an <code>SBATCH</code> directive of an [[User Jobs#Using execution scripts to run jobs|execution script]]), the syntax required by SLURM is
'''<code>gpu:<Type>:<Quantity></code>'''
where <code>Quantity</code> is an integer value specifying how many items of the resource are requested. So, for instance, to ask for 2 GPUs of type <code>4g.20gb</code> the syntax is
<code>gpu:4g.20gb:2</code>
SLURM's ''generic resources'' are defined in <code>/etc/slurm/gres.conf</code>. In order to make GPUs available to SLURM's <code>gres</code> management, Mufasa makes use of Nvidia's [https://developer.nvidia.com/nvidia-management-library-nvml NVML library]. For additional information see [https://slurm.schedmd.com/gres.html SLURM's documentation].

Latest revision as of 15:46, 25 November 2026

This page presents the features of SLURM that are most relevant to Mufasa's Job Users. Job Users can submit jobs for execution, cancel their own jobs, and see other users' jobs (but not intervene on them).

Users of Mufasa must use SLURM to run resource-heavy processes, i.e. computing jobs that require one or more of the following:

  • GPUs
  • multiple CPUs
  • powerful CPUs
  • a significant amount of RAM

In fact, only processes run via SLURM have access to all the resources of Mufasa. Processes run outside SLURM are executed by the login server virtual machine, which has minimal resources and no GPUs. Using SLURM is therefore the only way to execute resource-heavy jobs on Mufasa (this is a key difference between Mufasa 1.0 and Mufasa 2.0).

SLURM in a nutshell

Computation jobs on Mufasa needs to be launched via SLURM. SLURM provides jobs with access to the physical resources of Mufasa, such as CPUs, GPUs and RAM. Thanks to SLURM, processing jobs share system resources, optimising their occupation and availability.

When a user runs a job, the job does not get executed immediately and is instead queued. SLURM executes jobs according to their order in the queue: the top job in the queue gets executed as soon as the necessary resources are available, while jobs lower in the queue wait longer. The position of a job in the queue is due to the priority assigned to it by SLURM, with higher-priority jobs closer to the top. As a general rule:

the greater the fraction of Mufasa's overall resources that a job asks for, the lower the job's priority will be.

The priority mechanism is used to encourage users to use Mufasa's resources (i.e.: GPUs, CPUs, RAM, execution time) in an effective and equitable manner. This page includes a chart explaining how to maximise the priority of your jobs.

The time available to a job for its execution is controlled by SLURM. When a user requests execution of a job, they must specify the duration of the time slot that the job needs. The job must complete its execution before the end of the requested time slot, because at the end of such slot it gets killed by SLURM.

In Mufasa 2.0 access to system resources is managed via SLURM's Quality of Service (QOS) mechanism (Mufasa 1.0 used partitions instead). While launching a processing job via SLURM, the user must always specify the chosen QOS. QOSes differ in the set of resources that they provide access to because each of them is designed to fit a given type of job.

Mufasa sets limits to the number of jobs by the same user. This page includes a table summarising such limits.

SLURM Quality of Service (QOS)

Through Quality of Services (QOSes), SLURM lets system configurators assign a name to a set of related constraints.

In Mufasa 2.0, QOSes are used to define different levels of access to the server's resources. When executing a job with SLURM, a user must always specify the QOS that their job will use: this choice, in turn, determines what resources the job is able to access and influences the priority of the job.

Mufasa's QOSes and their features can be inspected with command

sacctmgr list qos format=name%-11,priority,MaxSubmit,maxwall,maxtres%-80,mintres%-18

which provides an output similar to the following (see below for the same data in table form):

Name          Priority MaxSubmit     MaxWall MaxTRES                                                                          MinTRES            
----------- ---------- --------- ----------- -------------------------------------------------------------------------------- ------------------ 
normal               0                                                                                                                           
nogpu                4         1  3-00:00:00 cpu=16,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,gres/gpu=0,mem=128G                    
gpuheavy-20          1         1             cpu=8,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=2,mem=128G             gres/gpu:4g.20gb=1 
gpuheavy-40          1         1             cpu=8,gres/gpu:3g.20gb=0,gres/gpu:40gb=1,gres/gpu:4g.20gb=0,mem=128G             gres/gpu:40gb=1    
gpulight             8         1    12:00:00 cpu=2,gres/gpu:3g.20gb=1,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,mem=64G              gres/gpu:3g.20gb=1 
gpu                  2         1  1-00:00:00 cpu=8,gres/gpu:3g.20gb=1,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,mem=64G              gres/gpu:3g.20gb=1 
gpuwide              2         2  1-00:00:00 cpu=8,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=1,mem=64G              gres/gpu:4g.20gb=1 
build               32         1    02:00:00 cpu=2,gres/gpu:3g.20gb=0,gres/gpu:40gb=0,gres/gpu:4g.20gb=0,gres/gpu=0,mem=16G

The columns of this output are the following:

Name
name of the QOS
Priority
priority tier associated to the QOS (higher value = higher priority): see Job priority for details
MaxSubmit
maximum number of jobs from a single user that can be submitted to SLURM with this QOS; submitted jobs include both running and queued jobs
See Limits on jobs by the same user for an overview of the limits on jobs set by Mufasa.
MaxWall
maximum wall clock duration of the jobs using the QOS (after which they are killed by SLURM), in format [days-]hours:minutes:seconds
For some QOSes these are not set: it means that they are determined by the partition. Partitions also define the default duration of jobs.
MaxTRES
amount of resources subjected to limitations ("Trackable RESources") available to a job using the QOS, where
cpu=K means that the maximum number of CPUs (i.e., processor cores) is K
--> if not specified, the job gets the default amount of CPUs specified by the partition
gres/gpu:Type=K means that the maximum number of GPUs of class Type (see gres syntax) is K
--> (for QOSes that allow access to GPUs) if not specified, the job cannot be launched
mem=KG means that the maximum amount of system RAM is K GBytes
--> if not specified, the job gets the default amount of RAM specified by the partition
MinTRES
minimum amount of resources subjected to limitations ("Trackable RESources") that a job using the QOS must request in order to actually get executed by SLURM.
(If your job does not actually need these resources, you've chosen the wrong QOS: you can use one with a higher priority.)


The normal QOS is the default one, and exists only to ensure that users always specify a QOS when running a job. Since normal has zero priority and no resources, a job run using this QOS would never be run.

The information provided by the sacctmgr list qos command above is summarised by the following table:

QOS Priority
tier
Max
Submit
MaxWall
[h]
max # of
CPUs
max RAM
[GB]
max # of
3g.20GB
GPUs
max # of
4g.20GB
GPUs
max # of
40GB
GPUs
build 32 1 2 2 16 - - -
gpulight 8 1 12 2 64 1 (min=1) - -
nogpu 4 1 72 16 128 - - -
gpu 2 1 24 8 64 1 (min=1) - -
gpuwide 2 2 24 8 64 - 1 (min=1) -
gpuheavy-20 1 1 72 (set by partition) 8 128 - 2 (min=1) -
gpuheavy-40 1 1 72 (set by partition) 8 128 - - 1 (min=1)

A key piece of information in the table above is the priority tier associated to each QOS. In Mufasa 2.0, priority tiers are used to encourage users to use the least powerful QOS that is compatible with their needs, where "powerful" means "rich with resources". Less powerful QOSes increase the priority of the jobs that use them, so these jobs tend to be executed sooner. See Job priority for details about how priority affects the execution order of jobs in Mufasa 2.0.

The build QOS

This QOS is specifically designed to be used by Mufasa users to quickly build container images. Its associated priority tier is very high: this, combined with the fact that jobs using this QOS require few resources, means that such jobs usually get executed very soon.

On the other hand, the limited resources and the lack of access to the GPUs make the build QOS unsuitable for other tasks.

See Building Singularity images for directions about building Singularity container images.

Restricted QOSes

In Mufasa, the most powerful QOSes are reserved to researchers (called research users: these include academic personnel and Ph.D. students). M.Sc. students, called students users, cannot use them while running jobs.

See below to understand how user categories work in Mufasa 2.0.

research users and students users

Users of Mufasa belong to two user categories. Categories provide users with different access to to Mufasa's resources: the idea being to provide researchers with more access while still letting students benefit from the server's capabilities.

User categories in Mufasa are the following:

research, i.e. academic personnel and Ph.D. students
* can use all QOSes, including the the restricted ones
* their jobs have a higher base priority
* have a higher number of jobs that can be running at the same time
students, i.e. M.Sc. students
* cannot use the restricted QOSes
* their jobs have a lower base priority
* have a lower number of jobs that can be running at the same time

You can inspect the differences in priority and running jobs between research and students users with command

sacctmgr list association format="account,priority,maxjobs" | grep -E 'Account|research|students'

which provides an output similar to the following:

   Account   Priority MaxJobs 
  research          4       2 
  students          1       1

To know what limits apply to your own user, use command

sacctmgr list association where user=$USER format="user,priority,maxjobs,qos%-60"

which provides an output similar to the following:

      User   Priority MaxJobs QOS                                                          
---------- ---------- ------- ------------------------------------------------------------ 
    preali          4       2 build,gpu,gpuheavy-20,gpuheavy-40,gpulight,gpuwide,nogpu

The list under "QOS" shows what QOSes your user is allowed to use when running jobs. research users can use all of them, while students users can only access a subset of them.

Limits on jobs by the same user

Mufasa enforces limits on the number of jobs from a single user. Such limits aim at preventing users from "hogging" system resources, and apply to:

  • submitted jobs, i.e. jobs that the user asked SLURM to execute, each of which may currently be either running or queued
  • running jobs, i.e. jobs that are currently in execution

Limits on submitted jobs are set via QOSes, while limits on running jobs are set via user category.

The following table summarises what limits exist:

on the number of running jobs
by a single user
on the number of submitted jobs
by a single user
global limits
(system-wide)
2 for research users
1 for students users
not limited directly...
...but subject to limits set by individual QOSes (below)
limits for
individual
QOSes
not limited directly...
...but subject to global limits (above)
2 for the gpuwide QOS
1 for each of the other QOSes

Job priority

Once the execution of a job has been requested, the job is not run immediately: it is instead queued by SLURM, together with all the other jobs awaiting execution. The job on top of the queue at any time is the first to be put into execution as soon as the resources it requires are available.

The order of the items in the job queue depends on their priority. The job with the highest priority is put by SLURM on top of the queue, while all other jobs are put in the queue in order of descending priority.

The goal of SLURM is to maximise resource availability: i.e., to ensure the shorter possible wait time before job execution. To achieve this goal, in Mufasa SLURM is configured to encourage users not to ask for resources or execution time that their job doesn't need. This is done via the priority mechanism: the more resources and/or time a job requests, the lower its priority will be; and the later it will be executed.

Priority management in Mufasa is designed to set up a virtuous cycle where users, by carefully choosing what to ask for, obtain two results:

  • they ensure that their job is executed as soon as possible;
  • they leave as much as possible of Mufasa's resources free for other users's jobs.

Useful tips to maximise the priority of your jobs are provided below.

Elements determining job priority

In Mufasa, the priority of a job is computed by SLURM according to the following elements:

User category (i.e., research or students)
Used to provide higher priority to jobs run by research personnel
QOS used by the job
Used to provide higher priority to jobs asking for less resources
Number of CPUs requested by the job
Used to provide higher priority to jobs asking for a lower number of CPUs
Job Age, i.e. the time that the job has been waiting in the queue
Used to provide higher priority to jobs which have been queued for a longer time
(Periods when a queued job is not eligible for running because of the limits on running jobs by the same user do not increase job age)
FairShare, i.e. a factor computed by SLURM to balance use of the system by different users
Used to provide higher priority to jobs by users who used Mufasa's resources less than others (see below)

Contributions to priority

You can understand how each element contributes to the priority of the jobs waiting for execution (both yours and of other users) with command sprio. A tailored version of sprio that only displays the parameters listed above is the following:

sprio --sort=-y -o "%6i %9u %.8Y %.10B %.5Q %.9T %.5A %.5F"

Here is an example of the output of the command above:

JOBID  USER      PRIORITY      ASSOC   QOS      TRES   AGE FAIRS
6663   amarzullo     5053       2000  3000  cpu=-150   132    71
6685   cmanzoni      4528        500  3000  cpu=-300     7  1321
6682   sgirardi      4466        500  3000  cpu=-300    17  1250
6660   bagostini     4361        500  3000  cpu=-300   162  1000
6615   lpassoni      2884       2000   375 cpu=-1200  1656    54
6686   amoglia       2597       2000   750  cpu=-600     1   446
6616   lpassoni      2561       2000   375 cpu=-1200  1333    54
6659   rjiao         2064        500   750  cpu=-600   432   982
6669   amarasi       1639       2000   750 cpu=-1200     0    89
6673   fbottazzi     1614        500   750  cpu=-600     0   964
6657   fpastori      1210       2000   375 cpu=-1200     0    36
6676   flazzaro      1029        500   750 cpu=-1200    33   946

In it, column PRIORITY provides the overall priority of each job. Each priority value is the sum of the five values to its right; in particular, column ASSOC corresponds to user category, while column TRES corresponds to the number of CPUs. Note that the contribution of TRES to priority is negative, i.e. it is a penalty; its value is proportional to the number of CPUs requested by the job.

Things to consider when using sprio

  • Its output is only relevant for jobs not yet in execution. For an already running job, the values shown by sprio correspond to the priority that the job would get if evaluated now: however, this priority does not affect job execution in any way.
  • Jobs listed by sprio may temporarily differ from jobs listed by squeue: this is due to the fact that SLURM updates its internal data (used by sprio) every few minutes, while the output of squeue is updated much more frequently.

Contributions to priority

The maximum (in absolute value) contribution that each element can provide to priority can be inspected with

sprio -w -o "%10B %10Q %10T %10A %10F"

which provides an output similar to the following:

ASSOC      QOS        TRES       AGE        FAIRSHARE 
2000       12000      CPU=-8700  10000      1500

For a particular job, the contribution of each element is equal to the maximum for that element scaled according to factors associated to each of the possible choices.

For association the scaling factor is proportional to the "Priority" feature of the corresponding elements of SLURM. For instance, researcher may get the maximum value while students users may only get a contribution equal to 1/4 of it (if researcher has a Priority of 4 and students has a Priority of 1).

Also for QOS the scaling factor is proportional to the "Priority" feature of the corresponding elements of SLURM. For instance, jobs using the build may get the maximum value while jobs using QOS nogpu users may only get 1/8 of it (=(1/32)*4, if Priorities are 32 and 4 for build and nogpu respectively).

For age, the scaling factor is the ratio between the job's waiting time and a maximum age defined by slurm.conf: e.g., 10 days.

For the TRES and FairShare contributions, see sections Understanding CPU impact on priority and How FairShare works below.

Understanding CPU impact on priority

The contribution of the CPUs requested by a job to the priority of the job is always negative, i.e. it penalises the job. The penalisation is proportional to the number of CPUs requested by the job. The per-CPU penalty is equal to the output of command

sprio -w -o "%T"

divided by the number of CPUs available to SLURM, which is 58. For instance, if the output of the command is

TRES
CPU=-8700

this corresponds to a per-CPU penalty of

-8700 / 58 = -150

How FairShare works

In Mufasa 2.0, the FairShare of each user is computed according to these rules:

  1. It considers the quantity used by (current and past) user jobs of:
    • CPUs - impact on FairShare is proportional to the number of CPUs used
    • RAM - impact on FairShare is proportional to the amount of RAM used
    • GPUs - impact on FairShare is proportional to the number of GPUs used
      • note: 40 GB GPUs have double the impact on FairShare than 20 GB GPUs
  2. The impact on FairShare of any use of resources is proportional to its duration
    • example: using 32 GB of RAM for 48h has the same impact of using 64 GB of RAM for 24h
  3. FairShare has a "fading memory": i.e., resource use has less and less impact on FairShare the farther in the past it is
    • consequence: over time, the "history" of a user gets forgotten by FairShare

How to maximise the priority of your jobs

Every time you run a SLURM job, follow these guidelines:

Choose the less powerful QOS compatible with the needs of your job
QOSes with access to less resources have higher base priority.
Only request CPUs and RAM that your job really needs
Usually, code exploits multiple CPUs only if specifically designed to do so: if unsure, only ask for 1 CPU.
The fewer resources your job asks for, the less it will wait before they become available.
The more CPUs your job asks for, the stronger the penalty to its priority.
Asking for fewer CPUs and/or less RAM improves your FairShare.
Do not request more time than your jobs needs to complete
Make a worst-case estimate and only ask for that duration.
Asking for less of Mufasa's time improves your FairShare.
Debug and test code using less powerful QOSes before running it with more powerful QOSes
Your test jobs will get a higher priority and your FairShare will improve.
Cancel jobs when you don't need them anymore
Always use scancel to delete completed (or crashed) jobs: your Fairshare will improve.

Protip: it's a good idea to check for unused GPUs before choosing what to request. Requesting a GPU that is currently idle will help your job get executed sooner.

SLURM partitions

Partitions are another mechanism provided by SLURM to create different levels of access to system resources. Since in Mufasa 2.0 access to resources is controlled via QOSes, partitions are not very relevant. (This is one of the main differences between Mufasa 1.0 and Mufasa 2.0.)

Note, however, that the default values for some features of SLURM jobs (e.g., duration) are set by the partition.

In Mufasa 2.0, there is a single SLURM partition, called jobs, and all jobs run on it. The state of jobs can be inspected with

sinfo -o "%10P %5a %9T %11L %10l"

which provides an output similar to the following:

PARTITION  AVAIL STATE     DEFAULTTIME TIMELIMIT 
jobs*      up    idle      1:00:00     3-00:00:00

where columns correspond to the following information:

PARTITION
name of the partition; the asterisks indicates that it's the default one
AVAIL
state/availability of the partition: see below
STATE
state (using these codes)
typical values are mixed - meaning that some of the resources are busy executing jobs while other are idle, and allocated - meaning that all of the resources are in use
DEFAULTTIME
default runtime of a job, in format [days-]hours:minutes:seconds
TIMELIMIT
maximum runtime of a job, in format [days-]hours:minutes:seconds

The asterisk at the end of the partition name indicates the default partition, i.e. the one on which jobs which do not ask for a specific partition are run.

Command sinfo does not tell you about the jobs submitted to a partition. This information is obtained, instead, with command squeue.

Partition availability

The most important information that sinfo provides is the availability (also called state) of partitions. This is shown in column "AVAIL". Possible partition states are:

up = the partition is available
Currently running jobs will be completed
It's possible to launch jobs on the partition
Queued jobs will be executed as soon as resources allow
drain = the partition is in the process of becoming unavailable (i.e., of entering the down state: see below)
Currently running jobs will be completed
It's not possible to launch jobs on the partition
Queued jobs will be executed when the partition becomes available again (i.e. goes back to the up state)
down = the partition is unavailable
There are no running jobs
It's not possible to launch jobs on the partition
Queued jobs will be executed when the partition becomes available again (i.e. goes back to the up state)

When a partition goes from up to drain no harm is done to running jobs. In a normally functioning SLURM system, the passage from up or drain to down happens only when no jobs are running on the partition. If (e.g., due to a malfunction) the passage happens with jobs still running, they get killed.

A partition in state drain or down requires intervention by a Job Administrator to be restored to up.

Default values

The features of SLURM partitions, including the default values which are applied to jobs that do not make explicit requests, can be inspected with

scontrol show partition

which provides an output similar to this:

PartitionName=jobs
   AllowGroups=ALL AllowAccounts=ALL AllowQos=nogpu,gpulight,gpu,gpuwide,gpuheavy-20,gpuheavy-40
   AllocNodes=ALL Default=YES QoS=N/A
   DefaultTime=01:00:00 DisableRootJobs=NO ExclusiveUser=NO ExclusiveTopo=NO GraceTime=0 Hidden=NO
   MaxNodes=UNLIMITED MaxTime=3-00:00:00 MinNodes=0 LLN=NO MaxCPUsPerNode=UNLIMITED MaxCPUsPerSocket=UNLIMITED
   Nodes=gn01
   PriorityJobFactor=1 PriorityTier=1 RootOnly=NO ReqResv=NO OverSubscribe=NO
   OverTimeLimit=NONE PreemptMode=OFF
   State=UP TotalCPUs=48 TotalNodes=1 SelectTypeParameters=NONE
   JobDefaults=(null)
   DefMemPerNode=4096 MaxMemPerNode=UNLIMITED
   TRES=cpu=48,mem=1011435M,node=1,billing=49,gres/gpu=13,gres/gpu:3g.20gb=5,gres/gpu:40gb=3,gres/gpu:4g.20gb=5
   TRESBillingWeights=cpu=1.0,gres/gpu:3g.20gb=6.0,gres/gpu:4g.20gb=6.0,gres/gpu:40gb=6.0,mem=0.05g

In the output of scontrol show partition the most relevant default values for Mufasa users are:

DefaultTime
the default execution time assigned to a job run on the partition (e.g., 1 hour)
DefMemPerNode
the default amount of RAM assigned to a job run on the partition (e.g., 4GB)

System resources subjected to limitations

In systems based on SLURM like Mufasa, TRES (Trackable RESources) are (from SLURM's documentation "resources that can be tracked for usage or used to enforce limits against."

TRES include CPUs, RAM and GRES. The last term stands for Generic RESources that a job may need for its execution. In Mufasa, the only gres resources are the GPUs.

gres syntax

To ask SLURM to assign GRES resources (i.e., GPUs) to a job, a special syntax must be used. Precisely, the name of each GPU resource takes the form

gpu:Name:Type

Considering the GPU complement of Mufasa, Type takes the following values:

  • gpu:40gb for GPUs with 40 Gbytes of RAM
  • gpu:4g.20gb for GPUs with 20 Gbytes of RAM and 4 compute units
  • gpu:3g.20gb for GPUs with 20 Gbytes of RAM and 3 compute units

So, for instance,

gpu:3g.20gb

identifies a resource corresponding to a GPU with 20 GB of RAM and 3 compute units.

When asking for a GRES resource (e.g., in an srun command or an SBATCH directive of an execution script), the syntax required by SLURM is

gpu:<Type>:<Quantity>

where Quantity is an integer value specifying how many items of the resource are requested. So, for instance, to ask for 2 GPUs of type 4g.20gb the syntax is

gpu:4g.20gb:2

SLURM's generic resources are defined in /etc/slurm/gres.conf. In order to make GPUs available to SLURM's gres management, Mufasa makes use of Nvidia's NVML library. For additional information see SLURM's documentation.