Skip to content

Accounts & Fairshare

Exercises

  1. Create a three-level account hierarchy

Create an organizational structure: a top-level account research, a department account structural_biology under it, and a lab account cryo_lab under the department. Add two users (pi_chen and postdoc_kim) to cryo_lab with different fairshare weights.

Hint / Solution
# Create the hierarchy
sacctmgr add account research Description="Research Division"
sacctmgr add account structural_biology parent=research Description="Structural Biology Dept"
sacctmgr add account cryo_lab parent=structural_biology Description="Cryo-EM Lab"

# Add users with different share weights
sacctmgr add user pi_chen account=cryo_lab fairshare=20 qos=normal defaultqos=normal
sacctmgr add user postdoc_kim account=cryo_lab fairshare=10 qos=normal defaultqos=normal

# Verify the tree
sacctmgr show association where account=cryo_lab format=Account,User,Fairshare tree withd
Expected output: Validated 2026-04-15 on slurm-training-val (Slurm 25.11.4, ParallelCluster 3.15.0).
$ sudo /opt/slurm/bin/sacctmgr -i add account val_research Description='Research Division'
 Adding Account(s)
  val_research
 Settings
  Description     = research division
  Organization    = Parent/Account Name
 Associations =
  C = slurm-training-val A = val_research        
 Settings

$ sudo /opt/slurm/bin/sacctmgr -i add account val_structural_biology parent=val_research Description='Structural Biology Dept'
 Adding Account(s)
  val_structural_biology
 Settings
  Description     = structural biology dept
  Organization    = Parent/Account Name
 Associations =
  C = slurm-training-val A = val_structural_biology
 Settings
  Parent        = val_research

$ sudo /opt/slurm/bin/sacctmgr -i add account val_cryo_lab parent=val_structural_biology Description='Cryo-EM Lab'
 Adding Account(s)
  val_cryo_lab
 Settings
  Description     = cryo-em lab
  Organization    = Parent/Account Name
 Associations =
  C = slurm-training-val A = val_cryo_lab        
 Settings
  Parent        = val_structural_biology

$ sudo /opt/slurm/bin/sacctmgr -i add user val_pi_chen account=val_cryo_lab fairshare=20 qos=normal defaultqos=normal
 Adding User(s)
  val_pi_chen
 Settings
 Associations =
  C = slurm-training-val A = val_cryo_lab         U = val_pi_chen
 Non Default Settings
  Fairshare     = 20
  QOS           = normal
  DefQOS        = normal

$ sudo /opt/slurm/bin/sacctmgr -i add user val_postdoc_kim account=val_cryo_lab fairshare=10 qos=normal defaultqos=normal
 Adding User(s)
  val_postdoc_kim
 Settings
 Associations =
  C = slurm-training-val A = val_cryo_lab         U = val_postdoc_kim
 Non Default Settings
  Fairshare     = 10
  QOS           = normal
  DefQOS        = normal

$ sacctmgr show association where account=val_cryo_lab format=Account,User,Fairshare tree withd
Account                    User     Share 
-------------------- ---------- --------- 
val_cryo_lab                            1 
 val_cryo_lab        val_pi_ch+        20 
 val_cryo_lab        val_postd+        10 

$ sacctmgr show user val_pi_chen,val_postdoc_kim format=User%-20,DefaultAccount%-20
User                 Def Acct             
-------------------- -------------------- 
val_pi_chen          val_cryo_lab         
val_postdoc_kim      val_cryo_lab         
  1. Inspect fairshare values with sshare

Use sshare to view the current fairshare state for an account hierarchy. Identify which account has the best LevelFS (most under-served relative to its share) and which has the worst.

Hint / Solution
# View full fairshare tree
sshare -l -A research

# Key columns to examine:
# - NormShares: the account's share as a fraction of its siblings
# - EffectvUsage: normalized actual usage
# - LevelFS: NormShares / EffectvUsage (higher = more under-served)

# To sort by fairshare factor (most under-served first):
sshare -l | sort -k7 -rn | head -20
Expected output: Validated 2026-04-15 on slurm-training-val (Slurm 25.11.4, ParallelCluster 3.15.0).
$ sshare -l | head -20
Account                    User  RawShares  NormShares    RawUsage   NormUsage  EffectvUsage  FairShare    LevelFS                    GrpTRESMins                    TRESRunMins 
-------------------- ---------- ---------- ----------- ----------- ----------- ------------- ---------- ---------- ------------------------------ ------------------------------ 
root                                          0.000000        7172                  1.000000                                                      cpu=0,mem=0,energy=0,node=0,b+ 
 pcdefault                               1    0.006579        6891    0.960861      0.960861              0.006847                                cpu=0,mem=0,energy=0,node=0,b+ 
  pcdefault            ec2-user          1    0.500000        6891    0.960861      1.000000   0.250000   0.500000                                cpu=0,mem=0,energy=0,node=0,b+ 
 research                               50    0.328947         280    0.039139      0.039139              8.404634                                cpu=0,mem=0,energy=0,node=0,b+ 
 training                              100    0.657895           0    0.000000      0.000000                   inf                                cpu=0,mem=0,energy=0,node=0,b+ 
  1. Modify share allocation for a department

Change the fairshare allocation so that structural_biology gets 40 shares and a sibling account gets 60 shares. Verify the normalized shares reflect the new 40/60 split.

Hint / Solution
# Set shares
sacctmgr modify account structural_biology set fairshare=40
sacctmgr modify account chemistry set fairshare=60    # sibling account

# Verify normalized shares
sshare -l -A structural_biology,chemistry
# structural_biology NormShares should be ~0.400000
# chemistry NormShares should be ~0.600000
Expected output: Validated 2026-04-15 on slurm-training-val (Slurm 25.11.4, ParallelCluster 3.15.0).
$ sudo /opt/slurm/bin/sacctmgr -i modify account val_structural_biology set fairshare=40
 Modified account associations...
  C = slurm-training-val A = val_structural_biology of val_research

$ sudo /opt/slurm/bin/sacctmgr -i modify account val_chemistry set fairshare=60
 Modified account associations...
  C = slurm-training-val A = val_chemistry of val_research

$ sacctmgr show account val_structural_biology,val_chemistry format=Account%-25,Description%-25,Organization%-25
Account                   Descr                     Org                       
------------------------- ------------------------- ------------------------- 
val_chemistry             val_chemistry             val_research              
val_structural_biology    val_structural_biology    val_research              
  1. Generate a usage report with sreport

Use sreport to produce a report showing CPU-hour usage by account for the current month. Then generate a second report showing the top 10 users by CPU hours.

Hint / Solution
# Usage by account for the current month
sreport cluster AccountUtilizationByUser start=2026-04-01 --tres=cpu

# Top 10 users by CPU hours
sreport user TopUsage start=2026-04-01 --tres=cpu TopCount=10

# For GPU usage by account:
sreport cluster AccountUtilizationByUser start=2026-04-01 --tres=gres/gpu
Expected output: Validated 2026-04-15 on slurm-training-val (Slurm 25.11.4, ParallelCluster 3.15.0).
$ sreport cluster AccountUtilizationByUser start=now-7days --tres=cpu | head -15
--------------------------------------------------------------------------------
Cluster/Account/User Utilization 2026-04-08T02:00:00 - 2026-04-15T00:59:59 (601200 secs)
Usage reported in TRES Minutes
--------------------------------------------------------------------------------
  Cluster         Account     Login     Proper Name      TRES Name     Used 
--------- --------------- --------- --------------- -------------- -------- 
slurm-tr+            root                                      cpu      286 
slurm-tr+       pcdefault                                      cpu      281 
slurm-tr+       pcdefault  ec2-user AWS ParallelCl+            cpu      281 
slurm-tr+        research                                      cpu        5 
slurm-tr+        research testuser1                            cpu        5 

$ sreport user TopUsage start=now-7days --tres=cpu TopCount=10 | head -15
--------------------------------------------------------------------------------
Top 10 Users 2026-04-08T02:00:00 - 2026-04-15T00:59:59 (601200 secs)
Usage reported in TRES Minutes
--------------------------------------------------------------------------------
  Cluster     Login     Proper Name         Account      TRES Name     Used 
--------- --------- --------------- --------------- -------------- -------- 
slurm-tr+  ec2-user AWS ParallelCl+       pcdefault            cpu      281 
slurm-tr+ testuser1                        research            cpu        5 

References