Advanced Tips and Troubleshooting
Last updated on 2026-08-24 | Edit this page
Overview
Questions
- How can I improve job reliability?
- How do I check my group’s resource quota?
- What are common SLURM errors and how do I fix them?
- How can I optimize job performance?
Objectives
- Implement checkpoint/resume patterns for long jobs
- Check group quotas and resource usage
- Troubleshoot common SLURM errors systematically
- Apply performance optimization techniques
Improving Job Reliability
Checking Quota and Resource Usage
BASH
# Check your group's storage and compute quota
quota_check.sh
# Count your running cores
squeue -u $USER --states=RUNNING --format=cpus --noheader | awk '{s+=$1} END {print s}'
# Historical usage (last 7 days)
sacct -u $USER --starttime=$(date -d '7 days ago' +%Y-%m-%d) \
--format=jobid,jobname,state,elapsed,cpus
Common Errors and Solutions
“Job remains queued indefinitely”
- Resources: No node available – reduce resource requests or wait
- QOSMaxPerUser: Hit quota – wait for other jobs to finish
-
ReqNodeNotAvail: Specific node is down – remove
-wflag
Performance Optimization
Email Notification Strategy
- Testing: No email
-
Medium jobs:
--mail-type=FAIL -
Long important jobs:
--mail-type=END,FAIL -
Job arrays:
--mail-type=FAILonly (avoid floods)
Complete Production Job Template
BASH
#!/bin/bash -l
#SBATCH --job-name=production_pipeline
#SBATCH --cpus-per-task=8
#SBATCH --mem=64G
#SBATCH --time=12:00:00
#SBATCH --partition=amd
#SBATCH --output=/rhome/$USER/logs/job_%j.out
#SBATCH --mail-user=user@pomona.edu
#SBATCH --mail-type=FAIL,END
set -e
echo "Job started at $(date) on $(hostname), ID: $SLURM_JOB_ID"
module load miniconda3
WORK_DIR=/scratch/$SLURM_JOB_USER/$SLURM_JOB_ID
mkdir -p $WORK_DIR && cd $WORK_DIR
cp /bigdata/lab/input.csv $WORK_DIR/
python /rhome/$USER/src/analyze.py --input input.csv --output results.pkl
cp results.pkl /rhome/$USER/results/results_${SLURM_JOB_ID}.pkl
echo "Job completed at $(date)"
Challenge 1: Scratch Storage Benchmark
Compare I/O speed between home and scratch storage:
BASH
#!/bin/bash -l
#SBATCH --job-name=io_bench
#SBATCH --cpus-per-task=1
#SBATCH --mem=4G
#SBATCH --time=00:10:00
#SBATCH --partition=short
WORK_DIR=/scratch/$SLURM_JOB_USER/$SLURM_JOB_ID
mkdir -p $WORK_DIR
dd if=/dev/urandom of=$WORK_DIR/test.bin bs=1M count=100 2>/dev/null
echo "Home storage:"
time dd if=$WORK_DIR/test.bin of=/rhome/$USER/test.tmp bs=1M count=100 2>/dev/null
rm /rhome/$USER/test.tmp
echo "Scratch storage:"
time dd if=$WORK_DIR/test.bin of=$WORK_DIR/test2.bin bs=1M count=100 2>/dev/null
Submit and compare the times.
Scratch should be noticeably faster (often 2-10x) than home storage because it uses local SSDs instead of the network filesystem. This is why scratch is valuable for I/O-heavy jobs.
- Use checkpoint/resume patterns for long jobs that might be interrupted
- Validate output files before declaring success
- Use
set -eto stop scripts on the first error - Check quota with
quota_check.shbefore large submissions - Common fixes: timeout -> more time, OOM -> more RAM, pending -> smaller resources
- Use scratch for fast I/O; always copy results back to persistent storage
- Follow the production template: logging, error handling, scratch, validation