-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.sh
executable file
·48 lines (40 loc) · 1.31 KB
/
script.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
max_rep=100
max_bids=50
num_edges=5
req_number=100
timeout=100 # Set a timeout of 300 seconds (5 minutes)
# strings=("stefano")
strings=("alpha_GPU_CPU" "alpha_BW_CPU" "alpha_GPU_BW" "stefano")
rm -rf "res"
mkdir -p "res"
# for i in $(seq 100 100 1000)
# for i in $(seq 1 1 1)
for filename in "${strings[@]}"
do
for i in $(seq 0 0.25 1)
# for i in $(seq 1 1 10)
do
rm -rf "res/""$i"
mkdir -p ./"res"/"$i"/
for b in `seq 0 $max_rep`
do
# Start the Python process and get its PID
python3 main.py "$req_number" "$i" "$num_edges" "$filename"> "./res/$i/$b" &
pid=$!
# Wait for the process to complete or time out
start_time=$(date +%s)
while ps -p $pid > /dev/null && [ $(( $(date +%s) - $start_time )) -lt $timeout ]; do sleep 1; done
# Check if the process has completed or timed out
if ps -p $pid > /dev/null; then
# The process has timed out, kill it
kill $pid
echo "Process $pid has timed out and been killed"
fi
# Move debug log to result directory
mv debug.log ./"res"/"$i"/debug_"$b".log
# Print the iteration number
echo "$i"
done
done
done