-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheval.sh
More file actions
executable file
·53 lines (39 loc) · 1.18 KB
/
eval.sh
File metadata and controls
executable file
·53 lines (39 loc) · 1.18 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
45
46
47
48
49
50
51
52
53
#!/bin/bash
ENV_ID="Freeway"
AGENT_PATH="PATH_TO_AGENT"
CUDA_DEVICE=2
ARCHITECTURE="PPO"
MODIFICATIONS=(
"stop_random_car"
"stop_all_cars_edge"
"stop_all_cars"
"disable_cars"
"all_black_cars"
)
run_evaluation() {
local modif=$1
local gpu_id=$2
echo "Starting evaluation for modification: $modif on GPU $gpu_id"
CUDA_VISIBLE_DEVICES=$gpu_id python eval.py \
--env_id "$ENV_ID" \
--modifs "$modif" \
--agent_path "$AGENT_PATH" \
--track \
--capture_video \
--architecture "$ARCHITECTURE"
echo "Completed evaluation for modification: $modif"
}
export -f run_evaluation
export ENV_ID AGENT_PATH ARCHITECTURE
if command -v parallel &> /dev/null; then
echo "Using GNU parallel for concurrent execution..."
printf '%s\n' "${MODIFICATIONS[@]}" | parallel -j $(nproc) run_evaluation {} $CUDA_DEVICE
else
echo "GNU parallel not found. Running evaluations sequentially in background..."
# Alternative: Run in background processes
for modif in "${MODIFICATIONS[@]}"; do
run_evaluation "$modif" "$CUDA_DEVICE" &
done
wait
fi
echo "All evaluations completed!"