Skip to content

SLURM Job Scheduler

Overview

Juno has many nodes, and to manage them effectively and ensure jobs get the right resources, we use SLURM (Simple Linux Utility for Resource Management). SLURM handles job scheduling and resource allocation automatically. This page covers how SLURM prioritizes and schedules jobs, the ways to run work (interactive and batch), writing and submitting job scripts, monitoring and managing jobs, the available partitions, and the QoS limits that apply.

Why Use a Job Scheduler?

  • Resource management: Ensures fair access to compute nodes
  • Job prioritization: Runs jobs based on fair-share and other factors
  • Efficiency: Maximizes cluster utilization
  • Isolation: Your jobs run independently without interference

Important: All computational work must go through SLURM. Never run intensive computations directly on login nodes.

SLURM Scheduling Priorities

The scheduler computes a priority for each queued job and selects the highest-priority job to run next. The formula is:

Job priority = 100,000 × (Fair share) + 1,000 × (Job age factor) + 1,000 × (Job size factor)
Factor Weight Description
Fair share 100,000 How much of the cluster you have used recently
Job age 1,000 How long your job has been waiting in the queue
Job size 1,000 Larger jobs get a slight boost (HPC is designed for large workloads)

Fair share dominates: users who have used the cluster recently get lower priority, which allows occasional users to run sooner.

Understanding Fair Share

Fair share is a system that remembers who has been running jobs recently:

  • Initial state: Everyone starts with a fair share of 1.0
  • After usage: Your fair share drops (e.g., to 0.6)
  • Recovery: Fair share gradually returns to 1.0 over two weeks of non-use

Fair Share Example

Time User A User B Next Job
Initially 1.0 1.0 -
A runs job 0.6 1.0 B (higher share)
B runs job 0.6 0.5 A (higher share)
1 week later 0.8 0.7 A (higher share)
2 weeks later 1.0 1.0 Equal priority

Key Points:

  • User with higher fair share gets priority
  • Heavy users temporarily get lower priority
  • Ensures occasional users aren't stuck behind constant users
  • Complete recovery takes two weeks
  • Fair Share value is reset at the beginning of the month
  Fair Share  (higher value = higher scheduling priority)

              User A   User B   Who runs next?
  ──────────────────────────────────────────────────────
  Initially   ████████ ████████  1.0 vs 1.0  —  equal
  After A     ████▌    ████████  0.6 vs 1.0  —  B wins
  After B     ████▌    ████      0.6 vs 0.5  —  A wins
  +1 week     ██████   █████▌    0.8 vs 0.7  —  A wins
  +2 weeks    ████████ ████████  1.0 vs 1.0  —  equal
  ──────────────────────────────────────────────────────
              0────────────────1
  Both users recover to 1.0 after ~2 weeks of inactivity.

Checking Your Fair Share

# View your own fair share
sshare

# View all users' fair share
sshare -a

Look for your username in the second column and check the last column for your fair share value.

                    sbatch job.sh
                          │
                          ▼
                 ┌─────────────────┐
                 │    PENDING      │  waiting for resources / priority
                 └────────┬────────┘
                          │  resources allocated
                          ▼
                 ┌─────────────────┐
                 │    RUNNING      │  executing on compute node(s)
                 └────────┬────────┘
                          │
            ┌─────────────┼─────────────┐
            ▼             ▼             ▼
      ┌───────────┐ ┌───────────┐ ┌───────────┐
      │ COMPLETED │ │  FAILED   │ │  TIMEOUT  │
      │  exit 0   │ │ exit ≠ 0  │ │ walltime  │
      └───────────┘ └───────────┘ │ exceeded  │
                                  └───────────┘

Ways to Run Jobs

1. Interactive on Login Node

Not Recommended for Computation

Use login nodes only for light tasks: editing, compiling, file management

# You're already on login node after SSH
[netID@juno-l-01 ~]$ 

2. Interactive on Compute Nodes

Two-step process:

# Step 1: Request resources
salloc -p normal -N 1 -n 1 -c 4 --mem=20GB

# Step 2: Start interactive session
srun --pty bash

Example session:

[dal281726@juno-l-02 ~]$ salloc -p normal -N 1 -n 1 -c 4 --mem=20GB
salloc: Granted job allocation 195702
Disk quotas for user dal281726, inode (file) count and disk usage:
=========================  ====================  ================  ============
Disk                       Usage                 Soft Limit        Hard Limit
=========================  ====================  ================  ============
/home/dal281726            70k|48GB              300k|50GB         320k|55GB
/work/dal281726            107k|641GB            3.0M|1.0TB        3.1M|1.1TB
=========================  ====================  ================  ============
[dal281726@juno-l-02 ~]$ srun --pty bash
Disk quotas for user dal281726, inode (file) count and disk usage:
=========================  ====================  ================  ============
Disk                       Usage                 Soft Limit        Hard Limit
=========================  ====================  ================  ============
/home/dal281726            70k|48GB              300k|50GB         320k|55GB
/work/dal281726            107k|641GB            3.0M|1.0TB        3.1M|1.1TB
=========================  ====================  ================  ============
[dal281726@c-03-15 ~]$ squeue --me
           JOBID    PARTITION               NAME      USER ST       TIME  NODES PRIORITY NODELIST(REASON)
          195511       normal sys/dashboard/sys/ dal281726  R      54:43      1    98906 c-03-13
          195702       normal        interactive dal281726  R       0:20      1    98831 c-03-15
[dal281726@c-03-15 ~]$

Notice the prompt changed from juno-l-02 (login node) to c-03-15 (compute node) after srun --pty bash. The quota summary prints automatically on each node login. Use squeue --me to confirm your job is running and see which node you landed on.

Common options for salloc:

  • -p or --partition: Specify partition (normal, h100, a30, etc.)
  • --mem: Memory allocation (e.g., 2GB, 16GB). Default is 64 GB if omitted — always set this explicitly, or your job may be memory-bound without warning.
  • -c or --cpus-per-task: Number of CPUs
  • -t or --time: Time limit (e.g., 1:00:00 for 1 hour)
  • -N or --nodes: Number of nodes

Example with more options:

salloc -p normal --mem=8GB -c 4 -t 2:00:00
srun --pty bash

Submit jobs using sbatch with a job script. The job runs on compute nodes without interactive involvement.

Creating a Batch Job Script

Basic Job Script Template

Create a file named job.sh:

#!/bin/bash
#SBATCH -J myjob              # Job name
#SBATCH -o output_%j.txt      # Output file (%j = job ID)
#SBATCH -e error_%j.txt       # Error file
#SBATCH -p normal             # Partition
#SBATCH -N 1                  # Number of nodes
#SBATCH -n 1                  # Number of tasks
#SBATCH -c 1                  # CPUs per task
#SBATCH --mem=2GB             # Memory (default is 64 GB if omitted)
#SBATCH -t 1:00:00            # Time limit (hh:mm:ss)

# Your commands here
echo "Job started on $(hostname) at $(date)"
echo "Running my program..."

# Load modules if needed
module load python/3.12.2

# Run your program
python my_script.py

echo "Job finished at $(date)"

Nodes, Tasks, and CPUs

SLURM resource requests are built from a few related concepts, and mixing them up is the most common cause of jobs that waste resources or fail to start:

  • Node (-N, --nodes): one physical computer in the cluster. A normal node has 64 cores and 384 GB RAM. Asking for multiple nodes only helps if your program can actually communicate across them (e.g. MPI).
  • Core / CPU: one physical processing unit on a node. SLURM refers to cores as "CPUs." The number of cores you hold is what limits how many threads or processes can truly run at the same time.
  • Task (-n, --ntasks): one instance of your program — a single process. SLURM can launch several tasks, possibly spread across nodes. MPI ranks map to tasks.
  • CPUs per task (-c, --cpus-per-task): how many cores each task gets. Use this for multi-threaded programs (OpenMP, most threaded Python/NumPy, MATLAB) where one process uses many threads.

The total cores a job reserves is ntasks × cpus-per-task. Two common patterns:

Workload Request Why
One multi-threaded program (OpenMP, threaded Python, MATLAB) -N 1 -n 1 -c 8 A single process running 8 threads on one node
MPI program with many processes -N 2 -n 8 -c 1 8 independent processes (ranks), spread across 2 nodes

When in doubt, most single-program jobs want -N 1 -n 1 and then set -c to the number of threads the program uses. See Parallelism Models for choosing between threaded and multi-process approaches.

SBATCH Directives Explained

Directive Description Example
-J or --job-name Job name #SBATCH -J my_analysis
-o or --output Standard output file #SBATCH -o output_%j.log
-e or --error Standard error file #SBATCH -e error_%j.log
-p or --partition Queue/partition #SBATCH -p normal
-N or --nodes Number of nodes #SBATCH -N 2
-n or --ntasks Number of tasks #SBATCH -n 4
-c or --cpus-per-task CPUs per task #SBATCH -c 8
--mem Memory per node #SBATCH --mem=16GB
--mem-per-cpu Memory per CPU #SBATCH --mem-per-cpu=4GB
-t or --time Time limit #SBATCH -t 24:00:00
--mail-type Email notifications #SBATCH --mail-type=END,FAIL
--mail-user Email address #SBATCH --mail-user=user@utdallas.edu

Submitting a Job

sbatch job.sh

You'll receive a job ID:

Submitted batch job 12345

Submitting to Multiple Partitions

You can list several partitions for one job, and SLURM starts it in whichever can run it first:

sbatch -p normal,dev job.sh

This is useful when your job fits on more than one queue — for example a short job that could run on either dev or normal. SLURM picks the earliest available partition and ignores the rest once the job starts. Only list partitions your job actually fits on (matching cores, memory, GPUs, and time limit).

Example Job Scripts

Python Job

#!/bin/bash
#SBATCH -J python_analysis
#SBATCH -o python_%j.out
#SBATCH -e python_%j.err
#SBATCH -p normal
#SBATCH -c 4
#SBATCH --mem=8GB
#SBATCH -t 2:00:00

module load miniconda

conda activate /path/to/env

python analyze_data.py --input data.csv --output results.txt

MATLAB Job

#!/bin/bash
#SBATCH -J matlab_sim
#SBATCH -o matlab_%j.out
#SBATCH -e matlab_%j.err
#SBATCH -p normal
#SBATCH -c 8
#SBATCH --mem=16GB
#SBATCH -t 12:00:00

module load matlab/r2024b

matlab -nodisplay -nosplash -r "run('simulation.m'); exit;"

GPU Job

#!/bin/bash
#SBATCH -J gpu_training
#SBATCH -o gpu_%j.out
#SBATCH -e gpu_%j.err
#SBATCH -p a30
#SBATCH --gres=gpu:1
#SBATCH -c 4
#SBATCH --mem=32GB
#SBATCH -t 24:00:00

module load cuda/12.4

conda activate /path/to/env

python train_model.py

Array Job (Multiple Similar Jobs)

#!/bin/bash
#SBATCH -J array_job
#SBATCH -o array_%A_%a.out
#SBATCH -e array_%A_%a.err
#SBATCH -p normal
#SBATCH --array=1-10
#SBATCH -c 2
#SBATCH --mem=4GB
#SBATCH -t 1:00:00

# Process file based on array index
echo "Processing file_${SLURM_ARRAY_TASK_ID}.dat"
python process.py file_${SLURM_ARRAY_TASK_ID}.dat

Array jobs vs. Launcher

Array jobs work well when each task is itself a sizeable job. If instead you have many short or serial tasks — a large parameter sweep, or processing thousands of small files — bundling them into a single allocation with Launcher is usually more efficient and easier on the scheduler.

Monitoring Jobs

Check Job Queue

# View all your jobs
squeue --me

# View specific job
squeue -j 12345

# View all jobs in a partition
squeue -p normal
             JOBID    PARTITION               NAME      USER ST       TIME  NODES PRIORITY NODELIST(REASON)
            195511       normal sys/dashboard/sys/ dal281726  R       3:47      1    98906 c-03-13

Output columns:

  • JOBID: Job identifier
  • PARTITION: Queue name
  • NAME: Job name
  • USER: Username
  • ST: State (PD=pending, R=running, CG=completing)
  • TIME: Time running
  • NODES: Number of nodes
  • NODELIST(REASON): Nodes allocated or reason for waiting

Check Job Status

# Detailed job information
scontrol show job 12345

# Job accounting information
sacct -j 12345

Check Job History

# View completed jobs
sacct -u $USER

# View jobs from specific date
sacct -u $USER --starttime 2024-01-01

# Detailed format
sacct -j 12345 --format=JobID,JobName,State,Start,End,Elapsed,MaxRSS

What is MaxRSS?

MaxRSS is the maximum resident set size — the peak amount of physical RAM the job actually used at any point during its run. Compare it against the --mem you requested to right-size future jobs: if MaxRSS is far below your request, you're reserving memory you don't need; if your job was killed for running out of memory (exit code 137), MaxRSS shows how close it came to the limit. MaxRSS is reported per job step, so for multi-step jobs check the .batch and .0 rows rather than the top summary line.

Managing Jobs

Cancel a Job

# Cancel specific job
scancel 12345

# Cancel all your jobs
scancel -u $USER

# Cancel all jobs in a partition
scancel -u $USER -p normal

# Cancel array job tasks
scancel 12345_[1-5]

Hold/Release Jobs

# Put job on hold
scontrol hold 12345

# Release held job
scontrol release 12345

Job Dependencies

Run jobs in sequence:

# Submit first job
job1=$(sbatch --parsable job1.sh)

# Submit second job that depends on first
sbatch --dependency=afterok:$job1 job2.sh

Dependency types:

  • afterok: Start after successful completion
  • afternotok: Start only if previous failed
  • afterany: Start after completion (success or failure)
  • after: Start after job begins

Troubleshooting

Job Pending for Long Time

Check reason:

squeue -u $USER -l

Common reasons:

  • Resources: No available resources
  • Priority: Other jobs have higher priority
  • QOSMaxCpuPerUserLimit: Exceeded CPU limit
  • AssocGrpMemLimit: Exceeded memory limit

Solutions:

  • Reduce resource requests
  • Wait for fair share to recover
  • Check if requesting too much memory/CPUs

Job Failed Immediately

Check error file:

cat error_12345.txt

Common issues:

  • Module not loaded
  • Incorrect paths
  • Permission errors
  • Missing input files

Out of Memory Error

Symptoms:

  • Job killed with exit code 137
  • "Out of memory" in error file

Solutions:

# Increase memory request
#SBATCH --mem=32GB

# Or per CPU
#SBATCH --mem-per-cpu=8GB

Job Times Out

Increase time limit:

#SBATCH -t 48:00:00  # 48 hours

Check partition limits with:

sinfo -o "%P %l"

Best Practices

  1. Estimate resources accurately:
  2. Don't over-request (wastes resources)
  3. Don't under-request (job fails)
  4. Run test jobs to determine needs

  5. Use appropriate partitions:

  6. normal for CPU jobs, dev for short test jobs
  7. h200 / h100 / a30 for GPU jobs
  8. See the partitions table or run sinfo

  9. Organize output files:

    #SBATCH -o logs/output_%j.txt
    #SBATCH -e logs/error_%j.txt
    

  10. Test with small jobs first:

    #SBATCH -t 0:10:00  # 10 minutes for testing
    

  11. Monitor resource usage: Run jobstats <jobid> after a job completes to see CPU and memory efficiency. See Monitoring Jobs and Cluster State.

  12. Clean up old files:

  13. Remove old output/error files
  14. Archive completed results

Partitions Overview

Juno cluster partitions — how the compute nodes are divided across dev, normal, h200, h100, a30, and vdi partitions.

Partition name Time limit Nodes Max nodes/job Cores/node Memory/node GPUs/node VRAM/GPU Best used for
dev 2 hours 8* 4 64 384 GB – – Code development and debugging
normal 2 days 92* 8† 64 384 GB – – Large, long jobs, production (main) compute workloads
h200 ‡ 2 days 26 8 64 384 GB 2 H200 NVL 141 GB Large, long jobs requiring high GPU resources
h100 ‡ 2 days 3§ 1 64 512 GB 4 H100, 2 H100 NVL, or 1 H100 NVL§ 80 / 94 GB Large, long jobs requiring high GPU resources
a30 ‡ 2 days 4 2 128 1,024 GB 2 A30 24 GB Large, long jobs requiring medium GPU resources
vdi 8 hours 2 1 64 384 GB – – Used by Open OnDemand workload

* dev partition shares nodes with the normal partition.

† Up to 8 nodes/job. Contact circ-assist@utdallas.edu to request more nodes for jobs that demonstrate efficient parallel scaling.

‡ GPU partitions — pass the --gres=gpu:<n> option to sbatch/srun to request <n> GPUs; jobs that omit it are allocated no GPU.

§ The h100 partition has three nodes, one of each configuration: 4× H100 (80 GB), 2× H100 NVL (94 GB), and 1× H100 NVL (94 GB).

The h200 partition is available. The H200 NVL cards have no NVLink — GPUs connect via PCIe Gen 5.0 within a node and 400 Gb InfiniBand between nodes. See GPU Computing on Juno.

Default memory limit

If a job does not request memory (e.g. via --mem or --mem-per-cpu), a default limit of 64 GB is applied.

Per-user limits: On normal and the GPU partitions, max 4 running jobs and max 100 submitted jobs at a time. On dev, max 1 running job (unlimited submitted). These limits can be relaxed for specific projects — contact support with evidence of efficient scaling.

Quality of Service (QoS) and Limits

Alongside partitions, Juno uses QoS (Quality of Service) policies to enforce per-user and per-job limits — how many jobs you can run or queue, how many nodes a single job may use, and how usage is charged against fair share. The per-user limits above come from the QoS attached to your jobs.

List the QoS policies and their limits with:

sacctmgr show qos

Example output (trimmed to the most relevant columns):

      Name   Priority  UsageFactor    MaxTRES  MaxJobsPU  MaxSubmitPU
---------- ---------- -----------  ---------- ---------- ------------
    normal          0     1.000000
      juno          0     1.000000     node=8          4          100
     hpcre          0     1.000000     node=2          4            8
     large          0     1.000000    node=16        150          150
 fio-bench     200000     1.000000    node=16
  juno-dev          0     1.000000     node=4          1

Reading the normal QoS as an example:

  • Priority 0 — no extra scheduling boost; these jobs are ordered purely by the fair-share formula above. Only special QoS like fio-bench (priority 200000) jump ahead of normal work.
  • UsageFactor 1.000000 — usage is charged at 1× against your fair share. A QoS could set this below 1 to discount certain work, or above 1 to penalize it.
  • Empty MaxTRES / MaxJobsPU / MaxSubmitPU — the normal QoS itself sets no node cap or per-user job cap. By contrast juno limits a single job to node=8 and each user to 4 running (MaxJobsPU) and 100 submitted (MaxSubmitPU) jobs; juno-dev allows just 1 running job per user.

Other columns you may see: GraceTime (how long a job may keep running after being signalled to stop), Flags / PreemptMode (whether this QoS can override partition limits or preempt other jobs — note fio-bench carries the OverPartQOS flag), MaxWall (maximum walltime), and MaxTRESPU (total resources one user may hold across all their jobs). A blank column simply means "no limit set."

Advanced Topics

Job Scripts with Arguments

#!/bin/bash
#SBATCH -J parametric_job

INPUT=$1
OUTPUT=$2

python process.py --input $INPUT --output $OUTPUT

Submit with:

sbatch job.sh data.csv results.txt

Environment Variables

Useful SLURM environment variables:

  • $SLURM_JOB_ID: Job ID
  • $SLURM_ARRAY_TASK_ID: Array task ID
  • $SLURM_CPUS_PER_TASK: CPUs allocated
  • $SLURM_MEM_PER_NODE: Memory allocated
  • $SLURM_SUBMIT_DIR: Directory where job was submitted
  • $SLURM_NODELIST: List of allocated nodes

Next Steps

Need Help?