forked from KomaEc/crown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·66 lines (55 loc) · 1.78 KB
/
run.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
set -euf
PROJ_DIR=$(dirname $0)
source $PROJ_DIR/find_entry.sh
PREPROCESS="$PROJ_DIR/preprocess.sh"
BENCHMARK="$PROJ_DIR/benchmark2"
WORKSPACE=""
if [ $# -eq 0 ]; then
if [ -d "$PROJ_DIR/results" ]; then
echo "Please provide a workspace dir. Tried $PROJ_DIR/results but exists"
exit 1
fi
WORKSPACE="$PROJ_DIR/results"
elif [ -d $1 ]; then
echo "$1 exists"
exit 1
else
WORKSPACE=$1
fi
cp -r $BENCHMARK $WORKSPACE
"$PREPROCESS" $WORKSPACE
CROWN="$PROJ_DIR/target/release/crown"
RUSTC_PATH=$(rustc --print sysroot)/lib
if [[ "$OSTYPE" == "darwin"* ]]; then
# add rustc lib to dyld path
export DYLD_FALLBACK_LIBRARY_PATH=$RUSTC_PATH
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
export LD_LIBRARY_PATH=$RUSTC_PATH
else
echo "platform $OSTYPE" not supported
exit 1
fi
for f in $(find $WORKSPACE -name "Cargo.toml"); do
BENCH_DIR="$(dirname $f)"
BENCH_NAME="$(basename $BENCH_DIR)"
ENTRY=$(find_entry $BENCH_DIR)
echo "rewriting $BENCH_NAME"
OPTIONS=""
if [ $BENCH_NAME = "lil" ]; then
OPTIONS="--type-reconstruction --no-attempt .*fnc_.*|do_exit|lil_find_var|lil_to_double"
elif [ $BENCH_NAME = "libsamplerate" ]; then
OPTIONS="--no-attempt .*_vari_process|.*_reset"
elif [ $BENCH_NAME = "lodepng" ]; then
OPTIONS="--no-attempt bpmnode_create|uivector_resize"
elif [ $BENCH_NAME = "quadtree" ]; then
OPTIONS="--force-box"
elif [ $BENCH_NAME = "genann" ]; then
OPTIONS="--raw-mutability"
fi
if [ -d "$BENCH_DIR/analysis_results" ]; then
rm $BENCH_DIR/analysis_results/*
else
mkdir -p $BENCH_DIR/analysis_results
fi
$CROWN $ENTRY rewrite --results-path $BENCH_DIR/analysis_results $OPTIONS in-place || { echo "rewrite $f crashed" ; exit 1; }
done