-
Notifications
You must be signed in to change notification settings - Fork 0
/
full_test.sh
91 lines (70 loc) · 2.14 KB
/
full_test.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
#!/bin/bash
set -e
# Currently this file is nonoperational - decode.c is temporarily changed to use wasm2c
help() {
echo "Run benchmark test after building libpng library"
echo "Note: For WASM Target, wasm_decode.sh should be run before"
echo "this to build the proper AOT compiler."
echo
echo "Syntax: bash native_test.sh [-h|s|w|c]"
echo "options:"
echo "h Print this help menu."
echo "s SIMD instructions included."
echo "w Built to WASM target."
echo
}
while getopts "hsw" OPTION
do
case $OPTION in
h) help
exit;;
s) simd=true
echo "simd enabled...";;
w) wasm=true
echo "wasm compilation enabled...";;
esac
done
SCRIPT=$(readlink -f "$0")
SCRIPT_PATH=$(dirname "$SCRIPT")
N=250
IMAGE=large.png
if [[ "$simd" = true && "$wasm" = true ]]; then # SIMD instructions and WASM target
cp /dev/null results/wasm_with_simd.csv
for i in $(seq 1 $N)
do
${WAMR_PATH}/product-mini/platforms/linux/build/iwasm \
--dir=${SCRIPT_PATH} out/decode_simd.aot \
${SCRIPT_PATH}/images/${IMAGE} \
${SCRIPT_PATH}/results/wasm_with_simd.csv
done
python3 stat_analysis.py results/wasm_with_simd.csv
elif [[ "$simd" = true ]]; then # SSE and native target
cp /dev/null results/native_with_sse.csv
gcc -I/usr/local/include/libpng16 -I${SIMDE_PATH}/simde/wasm \
-L/usr/local/lib -o out/decode decode.c -lpng16
for i in $(seq 1 $N)
do
out/decode images/${IMAGE} results/native_with_sse.csv
done
python3 stat_analysis.py results/native_with_sse.csv
elif [[ "$wasm" = true ]]; then # no SIMD and WASM target
cp /dev/null results/wasm_no_simd.csv
for i in $(seq 1 $N)
do
${WAMR_PATH}/product-mini/platforms/linux/build/iwasm \
--dir=${SCRIPT_PATH} out/decode_nosimd.aot \
${SCRIPT_PATH}/images/${IMAGE} \
${SCRIPT_PATH}/results/wasm_no_simd.csv
done
python3 stat_analysis.py results/wasm_no_simd.csv
else # no SSE and native target
cp /dev/null results/native_no_sse.csv
gcc -I/usr/local/include/libpng16 \
-L/usr/local/lib -o out/decode decode.c -lpng16
for i in $(seq 1 $N)
do
out/decode images/${IMAGE} results/native_no_sse.csv
done
python3 stat_analysis.py results/native_no_sse.csv
fi
echo "done"