Testing & running your first job
Last updated on 2026-06-17 | Edit this page
Overview
Questions
- How do you verify that a Slurm cluster is working correctly?
- How do you submit and monitor batch jobs?
Objectives
- Check cluster health using
sinfo - Submit a batch job with
sbatchand monitor it withsqueue - Run an interactive job using
srun - Verify the shared filesystem works across nodes
Before submitting any work, verify that the cluster is healthy and all nodes are visible to the scheduler.
Check cluster status
From the login node, run:
You should see your compute node listed as idle:
PARTITION AVAIL TIMELIMIT NODES STATE NODELIST
pixiecluster* up infinite 1 idle pixie02
If the node shows down or unknown, check
that slurmd is running on the compute node:
Submit a minimal batch job
Create a file called hello.sh:
BASH
#!/bin/bash
#SBATCH --job-name=hello
#SBATCH --output=hello-%j.out
#SBATCH --ntasks=1
echo "Hello from $(hostname) at $(date)"
Submit it:
Slurm will print a job ID,
e.g. Submitted batch job 1.
Check job status
While the job is running you will see it listed. Once it completes
the queue will be empty. Check the output file (replace 1
with your job ID):
Expected output:
Hello from pixie02 at Fri Jun 13 10:00:00 BST 2026
The hostname should be your compute node, not the login node.
Run an interactive job
For debugging it is often useful to get a shell directly on a compute node:
Your prompt will change to reflect the compute node hostname. Type
exit to return to the login node.
Test the shared filesystem
Jobs can read and write to /sharedfs from any node.
Verify this round-trips correctly:
BASH
#!/bin/bash
#SBATCH --job-name=sharedfs-test
#SBATCH --output=sharedfs-%j.out
#SBATCH --ntasks=1
echo "written by $(hostname)" > /sharedfs/test.txt
cat /sharedfs/test.txt
After the job completes, confirm the file is visible from the login node:
Test a multi-node job
If you have more than one compute node, verify that Slurm can span them:
BASH
#!/bin/bash
#SBATCH --job-name=multinode
#SBATCH --output=multinode-%j.out
#SBATCH --ntasks-per-node=1
#SBATCH --nodes=2
srun hostname
The output file should contain one line per node.
- Use
sinfoto check that all nodes are visible and inidlestate before submitting jobs -
sbatchsubmits batch jobs;squeuemonitors the queue; job output goes to the file specified by--output -
srun --pty bashopens an interactive shell on a compute node for debugging