-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_reducers.sh
executable file
·66 lines (53 loc) · 1.09 KB
/
run_reducers.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
#!/bin/bash
set -e
usage() {
>&2 echo "[!] USAGE: $0 <in> <grammar> <test> <out directory> [<args>] [<reducer>...]"
}
check_exists() { # file
if [ ! -f "$1" ] ; then
>&2 echo "[!] file '$1' does not exist"
usage
exit 2
fi
}
if [ $# -lt 4 ] ; then
usage
exit 2
fi
readonly IN="$1"
readonly GRAMMAR="$2"
readonly TEST="$3"
readonly OUT_DIR="$4"
check_exists "$IN"
check_exists "$GRAMMAR"
check_exists "$TEST"
if [ $# -gt 4 ] ; then
readonly ARGS=$5
else
readonly ARGS=""
fi
if [ $# -gt 5 ] ; then
shift 5
reducers=$@
else
shift 4
reducers=( \
"HDD*" \
"CoarseHDD*" \
"HDDr*" \
"GTR*" \
"Perses*" \
"Pardis*" \
"PardisHybrid*" \
)
fi
readonly run="$(dirname "$0")/run.sh"
check_exists "$run"
for reducer in ${reducers[@]} ; do
echo "=====[ $reducer ]====="
out_dir_reducer="$OUT_DIR/$reducer"
stats_file="$out_dir_reducer/stats.json"
mkdir -p "$out_dir_reducer"
"$run" --in "$IN" --grammar "$GRAMMAR" --test "$TEST" --reduce "$reducer" \
--outDir "$out_dir_reducer" --keepIterationResults --statsJSON "$stats_file" $ARGS
done