Examples
CPU Batch Job
sbatch \
-J hello \
-p cpu \
-c 1 \
--mem 512M \
-t 00:05:00 \
-o logs/%j.out \
--wrap 'echo hello'
Expected result:
Submitted batch job <id>logs/<id>.outcontainshello
GPU Batch Job
sbatch \
-J gpu-demo \
-p gpu \
-c 4 \
--mem 8G \
-G 1 \
-t 01:00:00 \
-o logs/%j.out \
--wrap 'nvidia-smi'
Expected result:
- the job runs on the GPU partition
- output contains
nvidia-smidata
Interactive Foreground Run
srun --label --unbuffered -- echo hello
Expected result:
0: hello
Interactive Allocation
salloc -p gpu -c 4 --mem 8G -G 1 -t 00:30:00
Expected result:
Granted job allocation <id>- a shell starts inside the allocation
Array Job
sbatch \
-J array-demo \
-a 0-9%2 \
-o logs/%A_%a.out \
--wrap 'echo task=$SLURM_ARRAY_TASK_ID'
Expected result:
- multiple task records
- logs such as
logs/<array_id>_0.out
Requeue Once
sbatch --requeue --wrap 'exit 1'
Expected result:
- the first failure returns the job to
PENDING - the second failure leaves the final state as
FAILED
Delayed Start
sbatch --begin now+00:10:00 --wrap 'echo delayed'
Expected result:
- the job remains pending until the begin time
squeue --startshows an estimated future start time
Explicit Export
sbatch \
--export FOO=bar,HELLO=world \
--wrap 'echo "$FOO $HELLO"'
Expected result:
- output contains
bar world
Manual Daemon Run
SLOTD_ROOT="$HOME/.local/share/slotd" ./target/release/slotd daemon
Then from another shell:
SLOTD_ROOT="$HOME/.local/share/slotd" ./target/release/slotd sbatch --wrap 'echo hello'