Skip to content

Instantly share code, notes, and snippets.

@kabouzeid
Created May 19, 2025 18:07
Show Gist options
  • Save kabouzeid/f3251e4bfbbd9e6099d85781691d8ce9 to your computer and use it in GitHub Desktop.
Save kabouzeid/f3251e4bfbbd9e6099d85781691d8ce9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
torchrun \
--nproc-per-node=$SLURM_GPUS_ON_NODE\
--nnodes=$SLURM_JOB_NUM_NODES \
--node_rank=$SLURM_NODEID \
--master_addr=$(scontrol show hostnames $SLURM_JOB_NODELIST | head -n1) \
--master_port=$(expr 10000 + $(echo -n $SLURM_JOBID | tail -c 4)) \
"$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment