source: doc/theses/mike_brooks_MMath/benchmarks/list/Makefile @ 9bb8ee42

ADTast-experimental
Last change on this file since 9bb8ee42 was 9bb8ee42, checked in by Mike Brooks <mlbrooks@…>, 15 months ago

Extend LL perf experiment to run on many dataset sizes.

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