Using Slurm
Slurm is used to manage jobs on the workstation.
Please use Slurm for long-running or computationally intensive work.
1 Check node status
sinfoExample output may show:
PARTITION AVAIL TIMELIMIT NODES STATE NODELIST
compute* up infinite 1 idle mod-linux-ws01
2 Check running jobs
squeueShow only your jobs:
squeue -u $USER3 Submit a job
Create a job script, for example job.sh:
#!/bin/bash
#SBATCH --job-name=my-job
#SBATCH --cpus-per-task=1
#SBATCH --mem=2G
#SBATCH --output=my-job.out
hostname
dateSubmit the job:
sbatch job.sh4 Cancel a job
scancel JOBIDReplace JOBID with the job ID shown by squeue.
5 Interactive job
Use this when you need an interactive shell with allocated resources:
srun --cpus-per-task=4 --mem=8G --pty bash6 Request CPUs
#SBATCH --cpus-per-task=4Use more CPUs only if your program can actually use them.
7 Request memory
#SBATCH --mem=8GIf a job fails because of memory, increase this value.
8 Output files
This line writes job output to a file:
#SBATCH --output=my-job.outFor error output:
#SBATCH --error=my-job.err9 Check job details
scontrol show job JOBID10 Good Slurm habits
- do not request all CPUs unless necessary
- do not request excessive memory
- save output files clearly
- check logs after jobs finish
- cancel jobs that are no longer needed