-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbencher
executable file
·86 lines (76 loc) · 2.02 KB
/
bencher
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
#!/bin/bash
source config
SCRIPTFILE=`readlink -f $0`
ROOT=`dirname $SCRIPTFILE`
# When was this set of benchmarks initiated
LOGTAG=$(date +%Y-%m-%d-%H-%M-%S)
BENCHROOT=$ROOT/benchmarks
LOGDIR=$ROOT/logs/$LOGTAG
# Run a single benchmark and store the logs
benchmark() {
experiment=$1
instance=$2
tag=$3
input=$4
if [ -z $4 ]; then
columnname="$instance"
else
columnname="$instance-$input"
fi
echo $tag/$columnname
BENCHDIR=$BENCHROOT/$1/$2
mkdir -p $LOGDIR
echo $columnname > $LOGDIR/$experiment-$columnname
for i in `seq 1 $RUNS`
do
if [ -z $4 ]; then
# Run without any command line inputs
$BENCHDIR/run | grep TIMING | cut -c 9- >> $LOGDIR/$experiment-$columnname
else
$BENCHDIR/run $4 | grep TIMING | cut -c 9- >> $LOGDIR/$experiment-$columnname
fi
done
if [ -f "$LOGDIR/$experiment.csv" ]; then
paste -d, $LOGDIR/$experiment.csv $LOGDIR/$experiment-$columnname > $LOGDIR/tmp
mv $LOGDIR/tmp $LOGDIR/$experiment.csv
else
cp $LOGDIR/$experiment-$columnname $LOGDIR/$experiment.csv
fi
}
# Go through all enabled benchmarks and run them
benchmarkall() {
for experiment in $BENCHROOT/*
do
if [ ! -d "$experiment" ]; then
continue
fi
if [ -f "$experiment/disable" ]; then
continue
fi
for instance in $experiment/*
do
if [ ! -d "$instance" ]; then
continue
fi
if [ "$(basename "$instance")" = "data" ]; then
continue
fi
if [ -f "$instance/disable" ]; then
continue
fi
pushd $instance > /dev/null
$instance/setup
if [ -f "$instance/inputs" ]; then
#Run with each of the different inputs
inputs="$(< $instance/inputs)"
for x in $inputs; do
benchmark "$(basename "$experiment")" "$(basename "$instance")" $LOGTAG $x
done
else
benchmark "$(basename "$experiment")" "$(basename "$instance")" $LOGTAG
fi
popd > /dev/null
done
done
}
benchmarkall