Slurm Demo
This page will walk you through submitting a job via SLURM.
Aquire SLURM Demo Files
1 - Log in to the head node server using your StatDS computing account through your terminal. (If you forget your password, reset it here.)
This cluster is used for demonstration purposes only. Actual compute jobs are not meant to be submitted to this cluster.
ssh statdsuser@ood.stat.cmu.edu
2 - Copy the Slurm Demo folder to your home directory. Do not run these files without moving them to your own working directory.
cp -r /share/slurmdemo ~/slurmdemo
3 - Navigate to your new Slurm Demo directory.
cd ~/slurmdemo
4 - View the contents of the Slurm Demo directory.
ls -l
Run Batch Submit Scripts
1 - Modify the “submit_bash.sh” script. You may use any text editor (vim, vi, nano, etc). Nano will be used in this example.
nano submit_bash.sh
2 - Change these three lines and make them more specific to you.
Name of your job.
#SBATCH --job-name=yourjobuniquename
Name of your job’s output file. Any output generated from your job will be placed into this file. The “%j” will add the job’s unique JobID to the name.
#SBATCH --output=yourjoboutputfile_%j.out
Name of your job’s error file. Any errors generated in the script will be placed into this file. The “%j” will add the job’s unique JobID to the name.
#SBATCH --error=yourjoberrorfile_%j.err
3 - Run the submit script.
sbatch submit_bash.sh
4 - View Running Jobs.
(Every job) squeue (Only your jobs) squeue -u $USER
5 - View the output file once the script is finished (use your unique outfile name).
cat outputfile.out
Error Example Script
In addition to the regular output file, SLURM produces a dedicated file that contains any errors in your script. In some cases, this is the only file that will contain any output.
Error file name is declared in your submit script as shown…
#SBATCH --error=yourjoberrorfile_%j.err
To see an example, submit the job with a syntax error.
sbatch submit_err.sh
View the contents of the error output file.
cat yourjoberrorfile_%j.err
Requesting Additional Resources
SLURM allows you to request multiple CPU cores, a specified amount of RAM, and even GPUs if they are available. Requesting more than 1 CPU is especially important when paralyzing tasks.Below is an example submit script that shows how to declare each.
#!/bin/bash #SBATCH --partition selectedpartition #SBATCH --ntasks 1
# # Number of CPUs you need: #SBATCH --cpus-per-task 1
# # Amount of RAM in GB #SBATCH --mem 1G
# # Number of GPUs #SBATCH --gres=gpu:1