-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench.sh
executable file
·76 lines (65 loc) · 1.9 KB
/
bench.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
#!/bin/bash
if [ -z "${VERBOSE}" ]; then
VERBOSE="" # "-v" or "" (empty)
fi
if [ -z "${W_A}" ]; then
W_A="304" # unaligned: 303 aligned: 304
fi
if [ -z "${H_A}" ]; then
H_A="1024" # unaligned: 1023 aligned: 1024
fi
if [ -z "${W_B}" ]; then
W_B="512" # unaligned: 511 aligned: 512
fi
if [ -z "${H_B}" ]; then
H_B="2048" # unaligned: 2047 aligned: 2048
fi
if [ -z "${PLOTMS}" ]; then
PLOTMS="8" # plot 8 MSamples data
fi
if [ -z "${ITERSA}" ]; then
ITERSA="100" # iterations for 300 x 1024 or 1024 x 300; >1 to allow readable millis; =1 to get raw cycles
fi
if [ -z "${ITERSB}" ]; then
ITERSB="25" # iterations for 500 x 2048 or 2048 x 500;
fi
if [ -z "$1" ]; then
BENCHVARIANT="bench44"
else
BENCHVARIANT="bench$1"
shift
fi
if [ -x build/${BENCHVARIANT} ]; then
BENCH="build/${BENCHVARIANT}"
elif [ -x $1/${BENCHVARIANT} ]; then
BENCH="$1/${BENCHVARIANT}"
else
echo "Error could not find built 'bench'"
exit 1
fi
echo "will use executable ${BENCH}"
# taskset to force CPU affinity for benchmarking
# see https://linux.die.net/man/1/taskset
SUCCESS=""
echo -e "\n=== ${H_A} x ${W_A} ===\n"
if taskset 1 ${BENCH} ${VERBOSE} ${ITERSA} ${PLOTMS} ${H_A} ${W_A} ; then
echo -e "\n=== ${W_A} x ${H_A} ===\n"
if taskset 1 ${BENCH} ${VERBOSE} ${ITERSA} ${PLOTMS} ${W_A} ${H_A} ; then
if [ "${W_B}" = "0" ] || [ "${H_B}" = "0" ]; then
SUCCESS="1"
else
echo -e "\n=== ${H_B} x ${W_B} ===\n"
if taskset 1 ${BENCH} ${VERBOSE} ${ITERSB} ${PLOTMS} ${H_B} ${W_B} ; then
echo -e "\n=== ${W_B} x ${H_B} ===\n"
if taskset 1 ${BENCH} ${VERBOSE} ${ITERSB} ${PLOTMS} ${W_B} ${H_B} ; then
SUCCESS="1"
fi
fi
fi
fi
fi
if [ -z "${SUCCESS}" ]; then
echo -e "\n=== error ===\n"
else
echo -e "\n=== success ===\n"
fi