Slurm ExamplesΒΆ

The following examples demonstrate common CoSTAR job submission patterns, from a basic Slurm job through containerised Python, GPU, checkpointing, and MPI workflows.

Example 1: Basic Serial Batch Job

New to Slurm? Start here. Learn how to submit a basic serial batch job and understand Slurm output files.

Example 1: Basic Serial Batch Job
Example 2: Python/Conda + Apptainer

Build a small Apptainer image from a public Docker Python image, create a Conda environment inside it, and run a CPU-only Python calculation.

Example 2: Python/Conda Job
Example 3: PyTorch + MNIST + GPU

Train a PyTorch neural network on the MNIST dataset using a GPU and an Apptainer container.

Example 3: PyTorch + MNIST + GPU
Example 4: TensorFlow + CIFAR-10 + checkpoint

Train a TensorFlow model on CIFAR-10, save checkpoints after each epoch, and resume from the latest checkpoint when resubmitted.

Example 4: TensorFlow + CIFAR-10 + checkpoint
Example 5: Containerized MPI Multi-Process Job

Run a Python mpi4py calculation across multiple Slurm MPI ranks using Apptainer and the host MPI launcher.

Example 5: Containerized MPI Multi-Process Job

Important

Please remember the Golden Rule of High Performance Computing:

Never run heavy calculations, compile massive codebases, or train models directly on the login node! Always use Open OnDemand or the SLURM scheduler to request a dedicated compute node.