From c8683d3daa2465a4b248d66574391b51a1d2431d Mon Sep 17 00:00:00 2001 From: Jackmin801 Date: Sun, 29 Sep 2024 12:04:10 +0800 Subject: [PATCH] use env vars for ports --- scripts/simulate_multi_node_diloco.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/simulate_multi_node_diloco.sh b/scripts/simulate_multi_node_diloco.sh index a8917302..4a69912a 100755 --- a/scripts/simulate_multi_node_diloco.sh +++ b/scripts/simulate_multi_node_diloco.sh @@ -53,17 +53,18 @@ trap cleanup SIGINT mkdir -p logs export GLOBAL_ADDR=localhost -export GLOBAL_PORT=1234 +export GLOBAL_PORT=${GLOBAL_PORT:-1234} export GLOBAL_WORLD_SIZE=$N +export BASE_PORT=${BASE_PORT:-10001} for i in $(seq 0 $(($N - 1 ))) do > logs/log$i - GLOBAL_UNIQUE_ID=$i GLOBAL_RANK=$i CUDA_VISIBLE_DEVICES=$(get_cuda_devices $NUM_GPU $i) uv run torchrun --nproc_per_node=$NUM_GPU --node-rank 0 --rdzv-endpoint localhost:$((10001 + $i)) --nnodes=1 $@ > logs/log$i.log 2>&1 & + GLOBAL_UNIQUE_ID=$i GLOBAL_RANK=$i CUDA_VISIBLE_DEVICES=$(get_cuda_devices $NUM_GPU $i) uv run torchrun --nproc_per_node=$NUM_GPU --node-rank 0 --rdzv-endpoint localhost:$((BASE_PORT + $i)) --nnodes=1 $@ > logs/log$i.log 2>&1 & child_pids+=($!) done tail -f logs/log0.log & child_pids+=($!) - + wait