source: doc/theses/mike_brooks_MMath/benchmarks/list/Makefile@ e9ed2a1

ADT ast-experimental
Last change on this file since e9ed2a1 was e9ed2a1, checked in by Mike Brooks <mlbrooks@…>, 3 years ago

Run LL perf with more stable compile flags and run context.

  • Property mode set to 100644
File size: 7.1 KB
Line 
1# For correctness, see test-correctness.sh.
2# For performance:
3# pushd ~/cfax
4# . ~/setcfa build-fast
5# popd
6# make perfprogs CFA=$cfa -j8 MODE=performance
7# make results-latest.csv RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=common5
8# cp results-latest.csv results-baseline.csv
9# make results-latest.csv OP_MOVEMENTS=stack OP_POLARITIES=insfirst OP_ACCESSORS=allhead RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=thorough
10# cp results-latest.csv results-sizing.csv
11
12CFA = cfa
13CXX = g++-11
14UXX = ~/u++/u++-7.0.0/bin/u++
15
16MODE=performance
17EXTRA_COMP_FLAGS=
18RUN_NUM_REPS=3
19RUN_DATA_SIZE_MODE=none
20RUN_DURATION_SEC=5
21RUN_TASKSET_CPULIST=6
22
23ifeq "$(MODE)" "performance"
24PERFFLAGS_CFA = -DNDEBUG -O3 -nodebug
25PERFFLAGS_CC = -DNDEBUG -O3
26else ifeq "$(MODE)" "correctness"
27PERFFLAGS_CFA = -O0 -g -debug
28PERFFLAGS_CC = -O0 -g
29else
30$(error Bad MODE ($(MODE)); should be performance or correctness)
31endif
32
33PERFFLAGS_CXX = $(PERFFLAGS_CC)
34PERFFLAGS_UXX = $(PERFFLAGS_CFA)
35
36SHELL = /usr/bin/bash
37
38# function: project an element from a filename that contains a delimited tuple
39# (call proj,-,a-b-c.hfa,3)
40# is
41# c
42define proj
43$(word $(3),$(subst $(1), ,$(basename $(2))))
44endef
45
46# functions: cross two lists, adding given delimiter between
47# (call cross,-,a b c,1 2)
48# is
49# a-1 a-2 b-1 b-2 c-1 c-2
50define cross
51$(foreach x,$(2),$(foreach xs,$(3),$(x)$(1)$(xs)))
52endef
53define cross3
54$(call cross,$(1),$(2),$(call cross,$(1),$(3),$(4)))
55endef
56define cross4
57$(call cross,$(1),$(2),$(call cross3,$(1),$(3),$(4),$(5)))
58endef
59define cross5
60$(call cross,$(1),$(2),$(call cross4,$(1),$(3),$(4),$(5),$(6)))
61endef
62
63OP_MOVEMENTS=stack queue
64OP_POLARITIES=insfirst inslast
65OP_ACCESSORS=allhead inselem remelem
66FX_SOLUTIONS=lq-tailq lq-list cfa-cfa upp-upp cpp-stlref
67
68OPS=$(call cross3,-,$(OP_MOVEMENTS),$(OP_POLARITIES),$(OP_ACCESSORS))
69FXS=$(FX_SOLUTIONS)
70
71all : perfprogs results-latest.csv
72
73# Want to add functional dependency:
74# if current FX_SOLUTION is lq-list then
75# current OP_MOVEMENT must be stack and
76# current OP_POLARITY must be insfirst
77LQ_LIST_INCOMPAT_OP_MOVEMENTS=$(filter-out stack,$(OP_MOVEMENTS))
78LQ_LIST_INCOMPAT_OP_POLARITIES=$(filter-out insfirst,$(OP_POLARITIES))
79LQ_LIST_INCOMPAT_OPS=$(call cross3,-,$(LQ_LIST_INCOMPAT_OP_MOVEMENTS),$(OP_POLARITIES),$(OP_ACCESSORS)) \
80 $(call cross3,-,$(OP_MOVEMENTS),$(LQ_LIST_INCOMPAT_OP_POLARITIES),$(OP_ACCESSORS))
81INCOMPAT=$(call cross,--,lq-list,$(LQ_LIST_INCOMPAT_OPS))
82define filterFds
83$(filter-out $(INCOMPAT),$(1))
84endef
85
86
87CORES_FULL=$(call cross,--,$(FXS),$(OPS)) # lq-tailq--stack-inslast-allhead
88CORES=$(call filterFds,$(CORES_FULL)) # lq-tailq--stack-inslast-allhead
89
90
91PERFPROGS=$(call cross,--,perfexp,$(CORES))
92
93perfprogs : $(PERFPROGS)
94
95perfexp--% driver--%.o result--%.1csv : FX=$(call proj,--,$@,2)
96perfexp--% driver--%.o result--%.1csv : FX_COARSE=$(call proj,-,$(FX),1)
97perfexp--% driver--%.o result--%.1csv : OP=$(call proj,--,$@,3)
98perfexp--% driver--%.o result--%.1csv : OP_MOVEMENT=$(call proj,-,$(OP),1)
99perfexp--% driver--%.o result--%.1csv : OP_POLARITY=$(call proj,-,$(OP),2)
100perfexp--% driver--%.o result--%.1csv : OP_ACCESSOR=$(call proj,-,$(OP),3)
101perfexp--% driver--%.o result--%.1csv : OP_DEFINES=-DOP_MOVEMENT=$(OP_MOVEMENT) -DOP_POLARITY=$(OP_POLARITY) -DOP_ACCESSOR=$(OP_ACCESSOR)
102
103perfexp--cfa-% driver--cfa-%.o : COMPILER=$(CFA) $(PERFFLAGS_CFA)
104perfexp--lq-% driver--lq-%.o : COMPILER=$(CC) $(PERFFLAGS_CC)
105perfexp--cpp-% driver--cpp-%.o : COMPILER=$(CXX) $(PERFFLAGS_CXX)
106perfexp--upp-% driver--upp-%.o : COMPILER=$(UXX) $(PERFFLAGS_UXX)
107perfexp--% driver--%.o : COMPILER=NO-COMPILER-FOR-$(FX_COARSE)
108
109# Without this %.d rule, ordinary make runs have noise about the recipe for driver--%.o being ill-formed when called on a *.d.
110# https://stackoverflow.com/questions/3714041/why-does-this-makefile-execute-a-target-on-make-clean
111# Whatever you -include gets called as a target first.
112# One such example is driver--upp-upp--stack-insfirst-allhead.d
113# Without this %.d rule, `make make driver--upp-upp--stack-insfirst-allhead.d` leads to the rule for driver--%.o firing.
114# Though my dumb human eyes don't see the pattern as matching.
115%.d:
116 @touch $@
117
118perfexp--% : driver--%.o observation.o
119 $(COMPILER) $(EXTRA_COMP_FLAGS) $^ -o $@
120
121driver--%.o : driver.c
122 $(COMPILER) $(EXTRA_COMP_FLAGS) -c $< $(OP_DEFINES) -include op-$(OP).h -include fx-$(FX).h -o $@ -MMD
123
124sayhi:
125 echo $(PERFPROGS)
126
127
128ifeq "$(RUN_DATA_SIZE_MODE)" "common5"
129RUN_DATA_SIZES=\
130 7-1000000 \
131 71-100000 \
132 809-10000 \
133 9051-1000 \
134 72421-100
135else ifeq "$(RUN_DATA_SIZE_MODE)" "thorough"
136RUN_DATA_SIZES=\
137 7-1000000 \
138 11-100000 \
139 13-100000 \
140 19-100000 \
141 29-100000 \
142 37-100000 \
143 53-100000 \
144 71-100000 \
145 101-10000 \
146 149-10000 \
147 211-10000 \
148 283-10000 \
149 401-10000 \
150 569-10000 \
151 809-10000 \
152 1151-1000 \
153 1601-1000 \
154 2267-1000 \
155 3203-1000 \
156 4547-1000 \
157 6473-1000 \
158 9051-1000 \
159 12809-100 \
160 18119-100 \
161 25601-100 \
162 36209-100 \
163 51203-100 \
164 72421-100 \
165 102407-10 \
166 144817-10 \
167 204803-10 \
168 289637-10 \
169 409609-10 \
170 579263-10 \
171 819229-10 \
172 1158613-1 \
173 1638431-1 \
174 2317057-1 \
175 3276803-1 \
176 4634111-1 \
177 6553621-1 \
178 9268211-1
179else ifeq "$(RUN_DATA_SIZE_MODE)" "manual"
180ifeq "$(RUN_DATA_SIZES)" ""
181$(error RUN_DATA_SIZE_MODE is manual but RUN_DATA_SIZES not given)
182endif
183else ifeq "$(RUN_DATA_SIZE_MODE)" "none"
184# Assume user manages RUN_ARGS; empty RUN_ARGS just means run with compiled-in defaults
185RUN_DATA_SIZES=none
186else
187$(error Bad RUN_DATA_SIZE_MODE ($(RUN_DATA_SIZE_MODE)); should be common5, thorough or manual)
188endif
189
190RUN_REP_IDS=$(shell echo {1..$(RUN_NUM_REPS)}) # 1 2 3
191RUN_REP_EXTS=$(call cross3,,run,$(RUN_REP_IDS),.1csv) # run1.1csv run2.1cav run3.1csv
192
193RUN_LAUNCHES=$(call cross,--,$(RUN_DATA_SIZES),$(RUN_REP_EXTS))
194
195
196
197RESULT1S=$(call cross,.,$(CORES),$(RUN_LAUNCHES)) # lq-tailq--stack-inslast-allhead.run2.1csv
198
199
200RESULT1S_SHUFD=$(shell shuf -e $(RESULT1S))
201
202%.1csv : CORE=$(basename $(basename $@))
203%.1csv : LAUNCH=$(subst .,,$(suffix $(basename $@)))
204%.1csv : SIZING=$(call proj,--,$(LAUNCH),1)
205%.1csv : NUMNODES=$(call proj,-,$(SIZING),1)
206%.1csv : CHECKDONE=$(call proj,-,$(SIZING),2)
207%.1csv : RUN_ARGS=$(if $(filter none,$(SIZING)),,$(RUN_DURATION_SEC) $(CHECKDONE) $(NUMNODES))
208%.1csv : REP_ID=$(subst run,,$(call proj,--,$(LAUNCH),2))
209%.1csv : REP_TIME=$(shell date '+%F %H:%M:%S')
210%.1csv : perfprogs FORCE
211 taskset --cpu-list $(RUN_TASKSET_CPULIST) ./perfexp--$(CORE) $(RUN_ARGS) | xargs -n 1 printf '%s,%s,%s,%s\n' "$(REP_TIME)" "$(REP_ID)" "$(RUN_ARGS)" | tee $@
212
213
214BATCHTIME=$(shell date '+%F--%H-%M-%S')
215
216results--$(BATCHTIME).csv : $(RESULT1S_SHUFD)
217 cat $^ | tee $@
218 rm $^
219
220results-latest.csv : results--$(BATCHTIME).csv
221 rm -f $@
222 ln -s $< $@
223
224
225
226clean :
227 rm -f *.o *.d perfexp--*
228
229# The FORCE business means any target that mentions it is also phony
230# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html says: To always rebuild a pattern rule consider using a “force target” (see [https://www.gnu.org/software/make/manual/html_node/Force-Targets.html]).
231.PHONY: all perfprogs results-latest.csv clean
232FORCE:
233
234.PRECIOUS: result--%.1csv driver--%.o perfexp--% %.o
235
236-include *.d
Note: See TracBrowser for help on using the repository browser.