-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsummary.sh
More file actions
89 lines (77 loc) · 2.87 KB
/
summary.sh
File metadata and controls
89 lines (77 loc) · 2.87 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# Check if a directory name was provided
if [ $# -lt 1 ]; then
echo "Usage: $0 <directory-name>"
exit 1
fi
# Change to the specified directory
cd "$1" || exit
# Initialize variables
solving_time=0
verification_time=0
leaf_cubes=0
total_cubes=0
timeouted_cubes=0
sat_time=0
unsat_time=0
unknown_time=0
# Read the timeout parameter
timeout=$2
# Compute Solving Time and Verification Time together
while IFS= read -r file; do
if [[ "$file" == *.log ]]; then
# Count as a total cube file
((total_cubes++))
# Check if it's a leaf cube (contains SAT or UNSAT)
if grep -q -E "SAT|UNSAT" "$file"; then
((leaf_cubes++))
else
# Count as a timeouted cube
((timeouted_cubes++))
fi
# Check for CPU time in the file using both formats
if grep -q "CPU time" "$file" || grep -q 'c total process time since initialization:' "$file"; then
# Get CPU time from either format
time=$(grep -E "CPU time|c total process time since initialization:" "$file" | awk '
/CPU time/ {total += $(NF-1)}
/c total process time since initialization:/ {total += $(NF-1)}
END {print total}
')
solving_time=$(echo "$solving_time + $time" | bc)
# Categorize time based on SAT/UNSAT/Unknown
if grep -q "UNSAT" "$file"; then
unsat_time=$(echo "$unsat_time + $time" | bc)
elif grep -q "SAT" "$file"; then
sat_time=$(echo "$sat_time + $time" | bc)
else
unknown_time=$(echo "$unknown_time + $time" | bc)
fi
fi
elif [[ "$file" == *.verify ]]; then
# Add to verification time
time=$(grep 'c verification time:' "$file" | awk '{sum += $4} END {print sum}')
verification_time=$(echo "$verification_time + $time" | bc)
fi
done < <(find . -type f \( -name "*.log" -o -name "*.verify" \))
# Count number of nodes in the cubing tree
num_nodes=$(find . -name "*.simplog" | wc -l)
# Compute Cubing Time - check both "Tool runtime" and "c time" formats
cubing_time=$(grep -E 'Tool runtime|c time = ' slurm-*.out | awk '
/Tool runtime/ {sum += $3}
/c time = / {sum += $4}
END {print sum}
')
# Compute Simp Time (now handled in the main loop)
simp_time=$(grep 'c total process time since initialization:' *.simplog | awk '{SUM += $(NF-1)} END {print SUM}' | bc)
# Output the results
echo "Number of nodes in cubing tree: $num_nodes"
echo "Total cubes: $total_cubes"
echo "Leaf cubes: $leaf_cubes"
echo "Timeouted cubes: $timeouted_cubes"
echo "Solving Time: $solving_time"
echo "SAT Time: $sat_time"
echo "UNSAT Time: $unsat_time"
echo "Unknown Time: $unknown_time"
echo "Cubing Time: $cubing_time"
echo "Simp Time: $simp_time"
echo "Verification Time: $verification_time seconds"