We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6938996 commit 44220b1Copy full SHA for 44220b1
scripts/run_llmc.sh
@@ -12,11 +12,21 @@ nnodes=1
12
nproc_per_node=1
13
14
15
-MASTER_ADDR=127.0.0.1
16
-MASTER_PORT=$((10000 + RANDOM % 20000))
+find_unused_port() {
+ while true; do
17
+ port=$(shuf -i 10000-60000 -n 1)
18
+ if ! ss -tuln | grep -q ":$port "; then
19
+ echo "$port"
20
+ return 0
21
+ fi
22
+ done
23
+}
24
+UNUSED_PORT=$(find_unused_port)
25
+
26
-RANDOM=$(python -c 'import uuid; print(uuid.uuid4())')
-task_id=$RANDOM
27
+MASTER_ADDR=127.0.0.1
28
+MASTER_PORT=$UNUSED_PORT
29
+task_id=$UNUSED_PORT
30
31
nohup \
32
torchrun \
0 commit comments