-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_presentation_benchmark.sh
executable file
·177 lines (149 loc) · 6.75 KB
/
run_presentation_benchmark.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/bin/bash
# set -x
if [ "$EUID" -ne 0 ]; then
echo "Please run as root (necessary for prefetcher and SMT settings)"
exit
fi
if lscpu | grep -E '^Model name\:\s+POWER'; then
IS_POWER=true
FOLDER="power-results"
SMT_CONFIGURATIONS=4
SMT_SETTINGS=(1 2 4 8)
THREAD_COUNTS=(12 24 48 96)
SINGLE_THREAD_COUNTS=(1 2 6 12)
# on the FSOC Lab machine, these are the NUMA cpus: 80 88 96 104 112 120 128 136 144 152 160 168
CPUNODE=1
MEMNODE=1
# be careful: 0 means off, and 1 means on (medium-depth hardware pre-fetching)
# you can set other values for the DSCR register as well:
# e.g. 2 for the least aggressive hardware pre-fetching or 7 for the most aggressive setting
PREFETCHER_SETTINGS=(1 0)
else
IS_POWER=false
FOLDER="intel-results"
SMT_CONFIGURATIONS=2
SMT_SETTINGS=(1 2)
THREAD_COUNTS=(15 30)
SINGLE_THREAD_COUNTS=(1 2 8 15)
# on the rapa.eaalab machine, these are the NUMA node0 CPUs
CORE_BINDINGS=("`seq -s, 0 1 14`"
"`seq -s, 0 1 14`,`seq -s, 120 1 134`")
MEMNODE=0
PREFETCHER_SETTINGS=(1 0) # 0 means off, 1 means on (no other options available)
fi
SINGLE_THREAD_COUNT="${THREAD_COUNTS[0]}"
# 1) Baseline and data-layout-picking: single threaded, no prefetching, row- and colstore, int8
DIR=1
mkdir -p "$FOLDER/$DIR/"
FILENAME=benchmark-prefetch0-smt1-thread"${SINGLE_THREAD_COUNTS[0]}-8bit"
if $IS_POWER; then
ppc64_cpu --smt=1 # SMT 1
ppc64_cpu --dscr=1 # no prefetching
numactl --cpunodebind=$CPUNODE --membind=$MEMNODE benchmark/benchmark --column-count 1 --thread-count "${SINGLE_THREAD_COUNTS[0]}" --data-types 8 > $FOLDER/$DIR/$FILENAME-colstore.csv
numactl --cpunodebind=$CPUNODE --membind=$MEMNODE benchmark/benchmark --column-count 10 --thread-count "${SINGLE_THREAD_COUNTS[0]}" --data-types 8 > $FOLDER/$DIR/$FILENAME-rowstore.csv
else
CPU="${CORE_BINDINGS[0]}" # SMT 1
benchmark/prefetching_intel -d # no prefetching
numactl --physcpubind=$CPU --membind=$MEMNODE benchmark/benchmark --column-count 1 --thread-count "${SINGLE_THREAD_COUNTS[0]}" --data-types 8 > $FOLDER/$DIR/$FILENAME-colstore.csv
numactl --physcpubind=$CPU --membind=$MEMNODE benchmark/benchmark --column-count 10 --thread-count "${SINGLE_THREAD_COUNTS[0]}" --data-types 8 > $FOLDER/$DIR/$FILENAME-rowstore.csv
fi
# 2a) Datatype-picking: single threaded, no prefetching, colstore, all datatypes (perf stat)
DIR=2a
mkdir -p "$FOLDER/$DIR/"
EVENTS="cache-references,cache-misses,branches,branch-misses,task-clock,context-switches,cpu-migrations,page-faults,cycles,instructions"
DATA_TYPES=(8 16 32 64)
for DATA_TYPE in "${DATA_TYPES[@]}"; do
FILENAME=benchmark-prefetch1-smt1-thread"${SINGLE_THREAD_COUNTS[0]}"-"$DATA_TYPE"bit-colstore
if $IS_POWER; then
ppc64_cpu --smt=1 # SMT 1
ppc64_cpu --dscr=1 # no prefetching
perf stat -e "$EVENTS" \
--output "$FOLDER/$DIR/$FILENAME-stats.txt" \
numactl --cpunodebind=$CPUNODE --membind=$MEMNODE benchmark/benchmark --column-count 1 --thread-count "${SINGLE_THREAD_COUNTS[0]}" --data-types "$DATA_TYPE" > $FOLDER/$DIR/$FILENAME.csv
else
CPU="${CORE_BINDINGS[0]}" # SMT 1
benchmark/prefetching_intel -d # prefetching
perf stat -e "$EVENTS" \
--output "$FOLDER/$DIR/$FILENAME-stats.txt" \
numactl --physcpubind=$CPU --membind=$MEMNODE benchmark/benchmark --column-count 1 --thread-count "${SINGLE_THREAD_COUNTS[0]}" --data-types "$DATA_TYPE" > $FOLDER/$DIR/$FILENAME.csv
fi
done
# 3) Prefetching: single threaded, with and w/o prefetching, row and colstore, int64
DIR=3
mkdir -p "$FOLDER/$DIR/"
for PREFETCH_SET in "${PREFETCHER_SETTINGS[@]}"; do
FILENAME=benchmark-prefetch"$PREFETCH_SET"-smt1-thread"${SINGLE_THREAD_COUNTS[0]}"-64bit
if $IS_POWER; then
if [[ "$PREFETCH_SET" -eq 0 ]]; then
ppc64_cpu --dscr=1 # turn prefetcher off
elif [[ "$PREFETCH_SET" -eq 1 ]]; then
ppc64_cpu --dscr=0 # turn prefetcher on (default)
else
ppc64_cpu --dscr="$PREFETCH_SET" # prefetcher dscr settings 2-7
fi
else
if [[ "$PREFETCH_SET" -eq 0 ]]; then
benchmark/prefetching_intel -d
else
benchmark/prefetching_intel -e
fi
fi
if $IS_POWER; then
ppc64_cpu --smt=1 # SMT 1
numactl --cpunodebind=$CPUNODE --membind=$MEMNODE benchmark/benchmark --column-count 1 --thread-count "${SINGLE_THREAD_COUNTS[0]}" --data-types 64 > $FOLDER/$DIR/$FILENAME-colstore.csv
numactl --cpunodebind=$CPUNODE --membind=$MEMNODE benchmark/benchmark --column-count 10 --thread-count "${SINGLE_THREAD_COUNTS[0]}" --data-types 64 > $FOLDER/$DIR/$FILENAME-rowstore.csv
else
CPU="${CORE_BINDINGS[0]}" # SMT 1
numactl --physcpubind=$CPU --membind=$MEMNODE benchmark/benchmark --column-count 1 --thread-count "${SINGLE_THREAD_COUNTS[0]}" --data-types 64 > $FOLDER/$DIR/$FILENAME-colstore.csv
numactl --physcpubind=$CPU --membind=$MEMNODE benchmark/benchmark --column-count 10 --thread-count "${SINGLE_THREAD_COUNTS[0]}" --data-types 64 > $FOLDER/$DIR/$FILENAME-rowstore.csv
fi
done
# 4) multicore: single-threaded, with prefetching, colstore, int64, multiple cores
DIR=4
mkdir -p "$FOLDER/$DIR/"
# turn prefetcher on
if $IS_POWER; then
ppc64_cpu --dscr=0
else
benchmark/prefetching_intel -e
fi
for NTHREADS in "${SINGLE_THREAD_COUNTS[@]}"; do
FILENAME=benchmark-prefetch1-smt1-thread"$NTHREADS"-64bit-colstore.csv
if $IS_POWER; then
ppc64_cpu --smt=1 # SMT 1
numactl --cpunodebind=$CPUNODE --membind=$MEMNODE benchmark/benchmark --column-count 1 --thread-count "$NTHREADS" --data-types 64 > $FOLDER/$DIR/$FILENAME
else
CPU="${CORE_BINDINGS[0]}" # SMT 1
numactl --physcpubind=$CPU --membind=$MEMNODE benchmark/benchmark --column-count 1 --thread-count "$NTHREADS" --data-types 64 > $FOLDER/$DIR/$FILENAME
fi
done
# 5) multithreading: single- and multi-threading, with prefetching, colstore, int64
DIR=5a
mkdir -p "$FOLDER/$DIR/"
# turn prefetcher on
if $IS_POWER; then
ppc64_cpu --dscr=0
else
benchmark/prefetching_intel -e
fi
for ((i=0; i<$SMT_CONFIGURATIONS; i++)); do
NTHREADS="${THREAD_COUNTS[i]}"
SMTLVL="${SMT_SETTINGS[i]}"
FILENAME=benchmark-prefetch1-smt"$SMTLVL"-thread"$NTHREADS"-64bit-colstore.csv
if $IS_POWER; then
ppc64_cpu --smt="$SMTLVL" # set SMT level
numactl --cpunodebind=$CPUNODE --membind=$MEMNODE benchmark/benchmark --column-count 1 --thread-count "$NTHREADS" --data-types 64 > $FOLDER/$DIR/$FILENAME
else
CPU="${CORE_BINDINGS[i]}" # set SMT level
numactl --physcpubind=$CPU --membind=$MEMNODE benchmark/benchmark --column-count 1 --thread-count "$NTHREADS" --data-types 64 > $FOLDER/$DIR/$FILENAME
fi
done
# Restore default settings
if $IS_POWER; then
ppc64_cpu --dscr=0 # restore prefetcher settings
ppc64_cpu --smt=4 # restore smt settings
chmod 666 -R "$FOLDER"/ # necessary for files
chmod +X -R "$FOLDER"/ # necessary for directories
else
benchmark/prefetching_intel -e
fi