Run Jobs on Worker Node

Run Jobs on Worker Node

 

Running Jobs on a Worker Node

HPC and DGX users cannot run workloads on the head node. Users must request compute resources through SLURM interactive or batch sessions. HPC and DGX login nodes are intended for accessing the environment, managing files, and submitting jobs. Computational workloads must run on worker nodes using SLURM through one of the methods below:

Interactive session: Use when you need to enter commands directly, test or debug code, or run an interactive application.

The srun command is typically used for interactive jobs, providing a shell to launch commands directly on allocated compute nodes. This is useful for testing, debugging, and interactive applications such as Jupyter notebooks.

srun --partition=batch --propagate=NONE --nodes=1 --time=03:00:00 --cpus-per-task=2 --mem=30G --pty $SHELL -i

Batch session: Use when you have a prepared script that can run without continued interaction, especially for longer-running workloads.

The sbatch command submits a batch script to the scheduler, which queues the job and runs it automatically on compute nodes when the requested resources become available, making it ideal for non-interactive and long-running workloads. Below is a sample header to your SLURM script which will be submitted via the sbatch command.

#!/bin/bash #SBATCH --propagate=NONE #SBATCH --cpus-per-task=1 #SBATCH --mem=16G #SBATCH -p batch #SBATCH -o jupyter_%j.out #SBATCH -e jupyter_%j.err #SBATCH -t 02:00:00 WORKDIR=~