250 words
1 minute
Custom Command

I. sr — Custom SLURM Interactive Job Launcher
Overview:
sr is a small wrapper script around srun that lets you launch an interactive GPU session on an HPC cluster with a short, memorable command — optionally targeting a specific node.
1. Write the Script
Create a file named sr with the following content:
#!/bin/bash
# ===== Argument check =====if [ -z "$1" ]; then echo "Usage:" echo " sr <gpu_type> [node_id]" echo "" echo "Examples:" echo " sr h100" echo " sr h100 007" echo " sr a100" exit 1fi
GPU_TYPE="$1"PARTITION="gpucompute-$GPU_TYPE"NODE_ARG=""
# ===== Optional node targeting =====if [ -n "$2" ]; then NODE_ARG="--nodelist=ghpc$2"fi
# ===== Launch interactive session =====srun \ --gpus-per-node=1 \ --cpus-per-gpu=4 \ $NODE_ARG \ --partition=$PARTITION \ --time=12:00:00 \ --pty /bin/bash2. Install the Script
Move the script to ~/bin and make it executable:
mkdir -p ~/binmv sr ~/bin/chmod +x ~/bin/srEnsure ~/bin is on your PATH:
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrcsource ~/.bashrc3. Usage
sr h100 # Request any H100 nodesr h100 007 # Request H100 node ghpc007 specificallysr a100 # Request any A100 node💡 One-line Takeaway
Drop
Drop
sr into ~/bin, add ~/bin to your PATH, and replace verbose srun commands with sr h100 or sr h100 007 to spin up an interactive GPU session instantly.