Table of Contents
Using SLURM to run jobs
1. Create an example script named slurm_example.sh:
#!/bin/bash
#SBATCH --mem 10gb # the amount of memory you request for your job
#SBATCH --cpus-per-task=4 # Number of CPU cores per task
#SBATCH --output=slurm-%j.log # file name where the job console output will be stored
#SBATCH --mail-type=BEGIN,END # if specified you will receive email when your job starts, ends
#SBATCH --mail-user=<your_mail> # your email address
for i in {1..100..1} your script
do
echo "This is my first script with slurm :)"
done
2. Submit the job:
sbatch slurm_example.sh
3. Check the job status:
squeue
4. Cancel your pending or running job:
scancel 3564
For more detailed information see the https://slurm.schedmd.com/documentation.html.
Tips & Recommendations
Use one script per task
It is recommended to use one script per task. If you happen to run the same script with different parameters, have a separate script for each run and name them accordingly.
Suppose you have a script that performs alignment named: align.sh. And you want to run the alignment in slow and fast modes. Instead of changing the modes inside the script, you can have two scripts
align_slow.sh
align_fast.sh
In this way, you can also separate the log files:
align_slow.log
align_fast.log
This will help you to trace your jobs back easily!
In this way, you will
How to choose CPU and Memory limits
TBA (please contribute)
