Goal: Introduction to Slurm and how to start interactive sessions, submit jobs and monitor.
...
Info |
---|
|
...
Submit Jobs: sbatch
: Template
Code Block |
---|
#!/bin/bash # Shebang indicating this is a bash script. # Do NOT put a comment after the shebang, this will cause an error. #SBATCH --account=arccanetrain # Use #SBATCH to define Slurm related values. #SBATCH --time=10:00 # Must define an account and wall-time. #SBATCH --reservation=<reservation-name> echo "SLURM_JOB_ID:" $SLURM_JOB_ID # Can access Slurm related Environment variables. start=$(date +'%D %T') # Can call bash commands. echo "Start:" $start module load gcc/1213.2.0 python/3.10.6 # Load the modules you require for your environment. python python01.py # Call your scripts/commands. sleep 1m end=$(date +'%D %T') echo "End:" $end |
...
Code Block |
---|
[]$ sbatch –-help #SBATCH --account=arccanetrain # Required: account/time #SBATCH --time=72:00:00 #SBATCH --job-name=workshop # Job name: Help to identify when using squeue. #SBATCH --nodes=1 # Options will typically have defaults. #SBATCH --tasks-per-node=1 # Request resources in accordance to how you want #SBATCH --cpus-per-task=1 # to parallelize your job, type of hardware partition #SBATCH --partition=teton-gpumb # and if you require a GPU. #SBATCH --gres=gpu:1 #SBATCH --mem=100G # Request specific memory needs. #SBATCH --mem-per-cpu=10G #SBATCH --mail-type=ALL # Get email notifications of the state of the job. #SBATCH --mail-user=<email-address> #SBATCH --output=<prefix>_%A.out # Define a named output file postfixed with the job id. |
Info |
---|
...
Submit Jobs: sbatch
: Options: Apply to Example
Info |
---|
Let’s take the previous example, and add some of the additional options: |
Code Block |
---|
#!/bin/bash
#SBATCH --account=arccanetrain
#SBATCH --time=10:00
#SBATCH --reservation=<reservation-name>
#SBATCH --job-name=pytest
#SBATCH --nodes=1
#SBATCH --cpus-per-task=1
#SBATCH --mail-type=ALL
#SBATCH --mail-user=<email-address>
#SBATCH --output=slurms/pyresults_%A.out
echo "SLURM_JOB_ID:" $SLURM_JOB_ID # Can access Slurm related Environment variables.
start=$(date +'%D %T') # Can call bash commands.
echo "Start:" $start
module load gcc/13.2.0 python/3.10.6 # Load the modules you require for your environment.
python python01.py # Call your scripts/commands.
sleep 1m
end=$(date +'%D %T')
echo "End:" $end |
Info |
---|
Notice:
|
...
Extended Example: What Does the Run look Like?
Info |
---|
With the above settings, a submission will look something like the following: |
Expand | ||
---|---|---|
| ||
|
Info |
---|
In my inbox, I also received two emails with the subjects:
|
...
| Workshop Home | Next |
...