forked from ischlag/distributed-tensorflow-example
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_multi_gpu.sh
26 lines (20 loc) · 640 Bytes
/
run_multi_gpu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
name=sess
num_workers=16
num_gpus=4
GPU_ID=(0 1 2 3)
tmux kill-session -t $name
tmux new-session -s $name -n ps -d bash
for (( i=0; i<$num_workers; i++ ))
do
tmux new-window -t $name -n worker$i -d bash
done
sleep 1
tmux send-keys -t $name:ps "CUDA_VISIBLE_DEVICES= python main.py --num_workers $num_workers --num_gpus $num_gpus --job_name ps --task_index=0" Enter
for (( i=0; i<$num_workers; i++ ))
do
ID=$((i % $num_gpus))
tmux send-keys -t $name:worker$i "CUDA_VISIBLE_DEVICES=${GPU_ID[$ID]} python main.py --num_workers $num_workers --num_gpus $num_gpus --job_name worker --task_index $i" Enter
done
sleep 1
tmux a