-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathrun_all_benchmarks_ci.sh
executable file
·88 lines (85 loc) · 2.45 KB
/
run_all_benchmarks_ci.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
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
#!/bin/bash
export PASH_TOP=${PASH_TOP:-$(git rev-parse --show-toplevel --show-superproject-working-tree)}
## This script is necessary to ensure that sourcing happens with bash
source run.seq.sh
source run.par.sh
# total tests
total=0
# number of tests that passed
passed=0
compare_outputs(){
dir=$1
outputs=$(ls $dir | grep "seq" | sed 's/.seq.out$//')
for out in $outputs;
do
seq_output="${dir}/${out}.seq.out"
pash_output="${dir}/${out}.par.out"
res=$(diff -q "$seq_output" "$pash_output")
if [[ "${res}" -eq "" ]]; then
passed=$((passed + 1))
fi
total=$((total + 1))
done
}
EXPERIMENTAL=1
if [ "$EXPERIMENTAL" -eq 1 ]; then
configurations=(
# "" # Commenting this out since the tests take a lot of time to finish
"--r_split"
"--dgsh_tee"
"--r_split --dgsh_tee"
# "--speculation quick_abort"
)
else
configurations=(
""
)
fi
n_inputs=(
2
8
16
)
# Array to store all the execution results
EXEC=()
# cleanup
rm -f $1/*.res
# run bash
$1 > /dev/null
# execute the bash script and fetch the script_name, time
b=$(cat $1/seq.res | awk '{if (NR>2) {print $1","$2}}' | sed 's\.sh:\\g')
labels="group,Bash"
for conf in "${configurations[@]}"; do
for n_in in "${n_inputs[@]}"; do
# cleanup all the files generated by pash
trash=$(find /tmp/ -group dkarnikis | grep sg | xargs -n1 rm -f 2> /dev/null)
# on each run, clean all the res files
rm -f $1/par.res
# re-export the new config
export PASH_FLAGS="${conf} -w ${n_in}"
# append the new labels for the plot
labels="${labels},${conf}_${n_in}"
# execute the pash with the new config
$1_pash > /dev/null
res=$(awk '{if (NR>2) {print $2}}' $1/par.res)
# store the results
EXEC+=("${res}")
done
done
# concat all the results and merge them to create the final data for plotting
labels=$(echo $labels | sed 's\--\\g' | sed -e 's/ /_/g')
res="$b"
for i in "${EXEC[@]}"
do
res=$(paste -d'@' <(echo "$res") <(echo "$i"))
done
# write the labels to the file
echo "$labels" > results.time
# write the data formatted
echo -e "$res" | sed 's\@\,\g' >> results.time
# compare the results
compare_outputs "$1/outputs"
# this is going to be written on the UI output log
cat results.time
# this is going to be written on the UI output log / CLI output
echo "Summary: ${passed}/${total} tests passed."