-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_bi_codebert_all.sh
More file actions
38 lines (27 loc) · 894 Bytes
/
Copy pathrun_bi_codebert_all.sh
File metadata and controls
38 lines (27 loc) · 894 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
pls=(lisp go c++ c# ruby php java python)
gpu_ids=($(seq 0 2))
n_cards=${#gpu_ids[@]}
echo "Using ${n_cards} gpu cards..."
declare -A gpuid2pids
for gpu_id in ${gpu_ids[@]}; do
echo $gpu_id
gpuid2pids[$gpu_id]=0
done
idx=0
for pl in ${pls[@]}; do
echo ""
echo "dataset id ${idx}"
gpu_idx=$(($idx % $n_cards))
gpu_id=${gpu_ids[$gpu_idx]}
echo "GPU id ${gpu_id}"
echo "${pl} will run on card ${gpu_id}"
pid=${gpuid2pids[$gpu_id]}
echo "Previous job pid on ${gpu_id} is ${pid}, wating it to be done"
wait $pid
CUDA_VISIBLE_DEVICES=$gpu_id nohup bash run_biencoder_codebert_pl.sh $pl > $pl.log 2>&1 &
# python -c "import time; time.sleep(10); print('${dataset}')" > debug/${dataset}.log &
pid=$!
gpuid2pids[$gpu_id]=$pid
echo "New pid on gpu ${gpu_id} is ${gpuid2pids[$gpu_id]}"
((idx++))
done