-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_scoreTR.sh
More file actions
executable file
·44 lines (39 loc) · 1.28 KB
/
run_scoreTR.sh
File metadata and controls
executable file
·44 lines (39 loc) · 1.28 KB
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
39
40
41
42
43
44
#!/bin/bash
RANKS=(3 5 8 10)
LEVELS=(1 2 5 10)
SIGMAS=(0.1 0.2 0.5 1.0)
GPUS=(0 1 2 3)
PIDS=()
# 捕获 SIGINT 信号并定义处理函数
trap 'handle_interrupt' INT
handle_interrupt() {
echo "Interrupt signal received. Terminating all subprocesses..."
for pid in "${PIDS[@]}"; do
kill -9 $pid 2>/dev/null
done
exit 1
}
# Loop through the cases and gpus arrays
# for i in "${!RANKS[@]}"; do #获取数组的所有索引值
for i in {0..2}; do
# python exp_beijing_air.py --dev "${GPUS[$i]}" --level 2 --sigma "${SIGMAS[$i]}" &
# python exp_click.py --dev "${GPUS[$i]}" --level 1 --sigma "${SIGMAS[$i]}" &
# python exp_alog.py --dev "${GPUS[$i]}" --level 10 --sigma "${SIGMAS[$i]}" &
# python exp_acc.py --dev "${GPUS[$i]}" --level "${LEVELS[$i]}" --sigma 1.0 &
# python exp_imgC.py --dev "${GPUS[$i]}" --level "${LEVELS[$i]}" --sigma 1.0 &
python exp_imgD.py --case 3 --dev "${GPUS[$i]}" --level "${LEVELS[$i]}" --sigma 1.0 &
# Save process ID
PIDS+=($!)
done
# Wait for all background tasks to complete and check for any failed tasks
FAIL=0
for pid in "${PIDS[@]}"; do
wait $pid || let "FAIL+=1"
done
# Check for failed tasks
if [ "$FAIL" -gt 0 ]; then
echo "Some tasks failed."
exit 1
else
echo "All tasks completed successfully."
fi