forked from bloomberg/bde-allocator-benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
256 lines (217 loc) · 8.29 KB
/
Copy pathMakefile
File metadata and controls
256 lines (217 loc) · 8.29 KB
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# You may need to set the following variables:
#
# CXX - path to C++ compiler
# CC - path to C compiler
# AR - path to suitable 'ar' tool
# RANLIB - path to suitable 'ranlib' tool
# BDEWAF - path to 'waf' in BDE Tools (https://github.com/bloomberg/bde-tools)
#
# They may be overridden on the command line, e.g. for gcc 5.1 on 4 cores:
# $ make CXX=g++ CC=gcc BDEWAF=$HOME/bde-tools/bin/waf STDLIB= PARALLEL=-j4
CXX = clang++
CC = clang
AR = /usr/local/opt/llvm/bin/llvm-ar
RANLIB = /usr/local/opt/llvm/bin/llvm-ranlib
BDEWAF = ~/bbcm/bde-tools-github/bin/waf
REPS =
OPTIM = -g -O3 -DBSLS_ASSERT_LEVEL_OPT
# OPTIM = -g
LTO =
DEBUG =
PARALLEL =
GROWTH_SIZE = 20 # use 16 or less for testing
BSLSRC = ../..
BSL = $(BSLSRC)/groups/bsl
BDL = $(BSLSRC)/groups/bdl
BSLINC = $(INST)/include/bsl
BDLINC = $(INST)/include/bdl
BSLLIB = $(BSLSRC)/build/groups/bsl
BDLLIB = $(BSLSRC)/build/groups/bdl
# comment this out for gcc-5:
STDLIB = -stdlib=libc++
# If libc++ was built from source (not installed from a system package),
# then libc++abi may not have been linked into libc++. In this situation, the
# linker must be explicitly told to include it in the link, by uncommenting
# the line below.
#STDLIBABI = -lc++abi
INCLUDES = \
-I$(BSL)/bsls -I$(BSL)/bslma -I$(BSL)/bslscm -I$(BSL)/bslh \
-I$(BSL)/bsl+bslhdrs -I$(BSL)/bslstl -I$(BSL)/bslmf -I$(BSL)/bslalg \
-I$(BDL)/bdlscm -I$(BDL)/bdlma
DEFS = -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DBSLS_IDENT_OFF
WAFCONFIGARGS = \
--abi-bits=64 --cpp-std=11 --build-type release \
$(PARALLEL)
LIBS = \
-L$(BDLLIB) -lbdl -L$(BSLLIB) -lbsl \
$(STDLIBABI) \
-lpthread
# LIBS = \
# -Wl,-Bstatic \
# -L$(BDLLIB) -lbdl -L$(BSLLIB) -lbsl \
# -Wl,-Bdynamic \
# $(STDLIBABI) \
# -lpthread
CFLAGS_BDE = $(DEBUG) $(OPTIM) $(LTO) $(DEFS) $(CFLAGS) -std=c99
CXXFLAGS_BDE = $(DEBUG) $(OPTIM) $(LTO) $(DEFS) $(STDLIB)
CXXFLAGS_LOCAL = $(CXXFLAGS_BDE) -std=c++14 $(INCLUDES) $(CXXFLAGS)
LDFLAGS_LOCAL = $(LIBS) $(LDFLAGS)
all: run
BINARIES = growth growth-DS159long shgrowth \
locality-AS1 locality-AS7 locality-AS9 locality-AS13 \
zation tention copymove-CP copymove-MV
build: $(BINARIES)
$(BINARIES): bde-tag
OUTPUT = results/*-result results/growth-*-* \
results/shuffle results/schedule-AS1 results/schedule-AS7
clean:
rm -rf $(BINARIES) bde-tag $(BSLSRC)/build growth-*-* *-result
reallyclean: clean
rm -rf $(OUTPUT)
bde-tag: Makefile
( \
cd $(BSLSRC) && \
export CC='$(CC)' && \
export CXX='$(CXX)' && \
export AR='$(AR)' && \
export RANLIB='$(RANLIB)' && \
export CFLAGS='$(CFLAGS_BDE)' && \
export CXXFLAGS='$(CXXFLAGS_BDE)' && \
$(BDEWAF) configure $(WAFCONFIGARGS) && \
$(BDEWAF) build -v \
)
touch bde-tag
# section 7
growth: growth.cc allocont.h bde-tag
$(CXX) -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
growth-DS159long: growth-DS159long.cc allocont.h bde-tag
$(CXX) -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
shgrowth: shgrowth.cc allocont.h bde-tag
$(CXX) -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
# section 8
locality-AS1: locality.cc allocont.h
$(CXX) -DSTDALLOC -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
locality-AS7: locality.cc allocont.h
$(CXX) -DCTMULTI -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
locality-AS9: locality.cc allocont.h
$(CXX) -DRTMULTI -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
locality-AS13: locality.cc allocont.h
$(CXX) -DRTMULTIMONO -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
# section 9
zation: zation.cc
$(CXX) -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
# section 10
tention: tention.cc
$(CXX) -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
# Copy vs move for AP0 and ACCU talk
copymove-CP: copymove.cc allocont.h
$(CXX) -DUSE_COPY -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
copymove-MV: copymove.cc allocont.h
$(CXX) -DUSE_MOVE -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
# unique_chars example for AP4, demonstrating SequentalAllocator
ap4-uniqchar-default: ap4-uniqchar.cc
$(CXX) -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
ap4-uniqchar-alloc: ap4-uniqchar.cc
$(CXX) -DUSE_ALLOC -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
ap4-uniqchar-count: ap4-uniqchar.cc
$(CXX) -DUSE_COUNT -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
ap4-uniqchar-local: ap4-uniqchar.cc
$(CXX) -DUSE_LOCAL -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
ap4-uniqchar-winkout: ap4-uniqchar.cc
$(CXX) -DUSE_WINKOUT -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
# words example for AP4, demonstrating BufferedSequentalAllocator
ap4-words-default: ap4-words.cc
$(CXX) -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
ap4-words-alloc: ap4-words.cc
$(CXX) -DUSE_ALLOC -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
ap4-words-buffer: ap4-words.cc
$(CXX) -DUSE_BUFFER -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
ap4-words-winkout: ap4-words.cc
$(CXX) -DUSE_WINKOUT -o $@ $(CXXFLAGS_LOCAL) $< $(LDFLAGS_LOCAL)
run: run-locality run-zation run-tention run-growth \
run-shuffle run-schedule-AS1 run-schedule-AS7 run-copymove
run-growth: growth
@echo With GROWTH_SIZE 20 this may take a full day to complete:
SIZE=$(GROWTH_SIZE) ; \
for i in 04 05 06 07 08 09 10 11 12 13 14 15 16; do \
echo ./growth $$SIZE $$i - ; \
(cd results; ../growth $$SIZE $$i - | tee "growth-$$SIZE-$$i") ; \
done && \
(cd results; cat growth-$$SIZE-* >growth-result ) && \
(cd results; ./reduce-growth-results; rm T*; )
run-growth-DS159long: growth-DS159long
@echo With GROWTH_SIZE 20 this may take a full day to complete:
SIZE=$(GROWTH_SIZE) ; \
for i in 04 05 06 07 08 09 10 11 12 13 14 15 16; do \
echo ./growth-DS159long $$SIZE $$i - ; \
mkdir -p results-DS159long; \
(cd results-DS159long; ../growth-DS159long $$SIZE $$i - | tee "growth-$$SIZE-$$i") ; \
done && \
(cd results-DS159long; cat growth-$$SIZE-* >growth-result ) && \
(cd results-DS159long; ./reduce-growth-results; rm T*; )
run-shgrowth: shgrowth
@echo With GROWTH_SIZE 20 this may take a full day to complete:
SIZE=$(GROWTH_SIZE) ; \
for i in 04 05 06 07 08 09 10 11 12 13 14 15 16; do \
echo ./shgrowth $$SIZE $$i - ; \
(cd results; ../shgrowth $$SIZE $$i - | tee "growth-$$SIZE-$$i") ; \
done && \
(cd results; cat growth-$$SIZE-* >growth-result ) && \
(cd results; ./reduce-growth-results; rm T* )
run-locality: locality-AS1 locality-AS7 locality-AS9 locality-AS13
@( \
echo "********** using AS1 default std::allocator:"; \
./test-locality ./locality-AS1 2>&1; \
echo "********** using AS7 compile-time-bound multipool"; \
./test-locality ./locality-AS7 2>&1; \
echo "********** using AS9 polymorphic multipool:"; \
./test-locality ./locality-AS9 2>&1; \
echo "********** using AS13 polymorphic multipool backed by monotonic:"; \
./test-locality ./locality-AS13 2>&1; \
) | tee >results/locality-result
(cd results; ./reduce-locality-results)
run-copymove: copymove-CP copymove-MV
./test-copymove ./copymove-CP ./copymove-MV 2>&1 | tee results/copymove-result
(cd results; ./reduce-copymove-results)
cat results/copymove.csv
run-shuffle: locality-AS1
( \
mkdir -p results/shuffle && cd results/shuffle && \
for i in ../../test-shuffle-scripts/s*; do \
o=$${i##*/} ; \
$$i 2>&1 | tee o$${o%%_*} ; \
done ; \
)
run-schedule-AS1: locality-AS1
( \
mkdir -p results/schedule-AS1 && cd results/schedule-AS1 && \
for i in ../../test-schedule-scripts/z*; do \
o=$${i##*/} ; \
$$i locality-AS1 2>&1 | tee o$${o} ; \
done ; \
)
run-schedule-AS7: locality-AS7
( \
mkdir -p results/schedule-AS7 && cd results/schedule-AS7 && \
for i in ../../test-schedule-scripts/z*; do \
o=$${i##*/} ; \
$$i locality-AS7 2>&1 | tee o$${o} ; \
done ; \
)
run-zation: zation
(ulimit -v 5000000; time ./test-zation 2>/dev/null | tee zation-result)
mv zation-result results/
run-tention: tention
time ./test-tention | tee tention-result
mv tention-result results/
run-ap4-uniqchar: ap4-uniqchar-default ap4-uniqchar-alloc ap4-uniqchar-count ap4-uniqchar-local ap4-uniqchar-winkout
time ./ap4-uniqchar-default $(REPS)
time ./ap4-uniqchar-alloc $(REPS)
./ap4-uniqchar-count
time ./ap4-uniqchar-local $(REPS)
time ./ap4-uniqchar-winkout $(REPS)
run-ap4-words: ap4-words-default ap4-words-alloc ap4-words-buffer ap4-words-winkout
time ./ap4-words-default $(REPS)
time ./ap4-words-alloc $(REPS)
time ./ap4-words-buffer $(REPS)
time ./ap4-words-winkout $(REPS)