-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sikan Li
committed
Jun 28, 2024
1 parent
66289a5
commit 9a8ea12
Showing
3 changed files
with
46 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
LOCAL_RANK=$PMI_RANK | ||
|
||
NODEFILE=/tmp/hostfile | ||
scontrol show hostnames > $NODEFILE | ||
if [[ -z "${NODEFILE}" ]]; then | ||
RANKS=$NODEFILE | ||
NNODES=1 | ||
else | ||
MAIN_RANK=$(head -n 1 $NODEFILE) | ||
RANKS=$(tr '\n' ' ' < $NODEFILE) | ||
NNODES=$(< $NODEFILE wc -l) | ||
fi | ||
|
||
|
||
PRELOAD="/opt/apps/tacc-apptainer/1.1.8/bin/apptainer exec --nv $1 " | ||
CMD="torchrun --nproc_per_node 4 --nnodes $NNODES --node_rank=$LOCAL_RANK --master_addr=$MAIN_RANK --master_port=1234 train.py" | ||
|
||
FULL_CMD="$PRELOAD $CMD" | ||
echo "Training command: $FULL_CMD" | ||
|
||
eval $FULL_CMD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
#SBATCH -J train # Job name | ||
#SBATCH -o train.o%j # Name of stdout output file | ||
#SBATCH -e train.e%j # Name of stderr error file | ||
#SBATCH -p gpu-a100 # Queue (partition) name | ||
#SBATCH -N 2 # Total # of nodes (must be 1 for serial) | ||
#SBATCH -n 2 # Total # of mpi tasks (should be 1 for serial) | ||
#SBATCH -t 0:05:00 # Run time (hh:mm:ss) | ||
#SBATCH --mail-type=all # Send email at begin and end of job | ||
|
||
|
||
# Train for a few steps. | ||
NODEFILE=/tmp/hostfile | ||
scontrol show hostnames > $NODEFILE | ||
NNODES=$(< $NODEFILE wc -l) | ||
|
||
CONTAINER=$1 | ||
mpiexec.hydra -np $NNODES -ppn 1 ../slurm_scripts/launch_helper.sh $CONTAINER |