-
Notifications
You must be signed in to change notification settings - Fork 5
/
run-native-deflate.sh
executable file
·104 lines (98 loc) · 3.05 KB
/
run-native-deflate.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ARCH=`uname -m`
ITERATIONS="5"
DATA_SIZE="100000000"
START_LEVEL="-2"
END_LEVEL="9"
DATE=`date "+%Y-%m-%d"`
OUT_DIR="/tmp/deflate-$DATE"
INPUT_FILES=()
while (( "$#" )); do
case "$1" in
-s|--start-level)
if [ -n "$2" ]; then
START_LEVEL=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-e|--end-level)
if [ -n "$2" ]; then
END_LEVEL=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-i|--iterations)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
ITERATIONS=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-d|--data-size)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
DATA_SIZE=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-o|--output-dir)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
OUT_DIR=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-*|--*=) # unsupported flags
echo "Error: Unsupported flag $1" >&2
exit 1
;;
*) # preserve positional arguments
INPUT_FILES+=("$( cd "$( dirname "$1" )" >/dev/null 2>&1 && pwd )"/`basename $1`)
shift
;;
esac
done
mkdir -p $OUT_DIR
pushd $OUT_DIR
echo "Changing to $OUT_DIR"
echo "Running benchmarks from $MYDIR"
declare -A IMPL_ENV
declare -A IMPL_ARG
IMPL_ENV["zlib"]="LD_LIBRARY_PATH=$MYDIR/../../build/isa-l:$MYDIR/../../ipp/lib64 LD_PRELOAD=$MYDIR/../../build/zlib-madler/libz.so"
IMPL_ENV["chromium"]="LD_LIBRARY_PATH=$MYDIR/../../build/isa-l:$MYDIR/../../ipp/lib64 LD_PRELOAD=$MYDIR/../../build/zlib-chromium/libz.so"
IMPL_ENV["ng"]="LD_LIBRARY_PATH=$MYDIR/../../build/isa-l:$MYDIR/../../ipp/lib64 LD_PRELOAD=$MYDIR/../../build/zlib-ng/libz.so"
IMPL_ENV["cloudflare"]="LD_LIBRARY_PATH=$MYDIR/../../build/isa-l:$MYDIR/../../ipp/lib64 LD_PRELOAD=$MYDIR/../../build/zlib-cloudflare/libz.so"
if test "$ARCH" = "x86_64"; then
# The following versions are currently not supported on aarch64
IMPL_ENV["jtkukunas"]="LD_LIBRARY_PATH=$MYDIR/../../build/isa-l:$MYDIR/../../ipp/lib64 LD_PRELOAD=$MYDIR/../../build/zlib-jtkukunas/libz.so"
IMPL_ENV["ipp"]="LD_LIBRARY_PATH=$MYDIR/../../build/isa-l:$MYDIR/../../ipp/lib64 LD_PRELOAD=$MYDIR/../../build/zlib-ipp/libz.so"
fi
IMPL_ENV["isal"]="LD_LIBRARY_PATH=$MYDIR/../../build/isa-l:$MYDIR/../../ipp/lib64"
IMPL_ARG["zlib"]=""
IMPL_ARG["chromium"]=""
IMPL_ARG["ng"]=""
IMPL_ARG["cloudflare"]=""
IMPL_ARG["jtkukunas"]=""
IMPL_ARG["ipp"]=""
IMPL_ARG["isal"]="-l"
for file in "${INPUT_FILES[@]}"; do
for impl in "${!IMPL_ENV[@]}"; do
bash -c "${IMPL_ENV[$impl]} $MYDIR/../../build/benchmarks/zbench \
${IMPL_ARG[$impl]} -n $ITERATIONS -d -c $START_LEVEL -c $END_LEVEL -p $DATA_SIZE \
-j $impl -a $file -b /tmp/`basename $file`.zlib"
done
done
popd