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

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

LL perf: Add comments for rerunning tests

  • Property mode set to 100644
File size: 4.6 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 RUNARGS=5 RUN_NUM_REPS=5
8
9
10CFA = cfa
11CXX = g++-11
12UXX = ~/u++/u++-7.0.0/bin/u++
13
14MODE = performance
15RUNARGS=
16
17ifeq "$(MODE)" "performance"
18PERFFLAGS_CFA = -nodebug -O3
19PERFFLAGS_CC = -DNDEBUG -O3
20else ifeq "$(MODE)" "correctness"
21PERFFLAGS_CFA = -debug -O0 -g
22PERFFLAGS_CC = -O0 -g
23else
24$(error Bad MODE ($(MODE)); should be performance or correctness)
25endif
26
27PERFFLAGS_CXX = $(PERFFLAGS_CC)
28PERFFLAGS_UXX = $(PERFFLAGS_CC)
29
30SHELL = /usr/bin/bash
31
32# function: project an element from a filename that contains a delimited tuple
33# (call proj,-,a-b-c.hfa,3)
34# is
35# c
36define proj
37$(word $(3),$(subst $(1), ,$(basename $(2))))
38endef
39
40# functions: cross two lists, adding given delimiter between
41# (call cross,-,a b c,1 2)
42# is
43# a-1 a-2 b-1 b-2 c-1 c-2
44define cross
45$(foreach x,$(2),$(foreach xs,$(3),$(x)$(1)$(xs)))
46endef
47define cross3
48$(call cross,$(1),$(2),$(call cross,$(1),$(3),$(4)))
49endef
50define cross4
51$(call cross,$(1),$(2),$(call cross3,$(1),$(3),$(4),$(5)))
52endef
53define cross5
54$(call cross,$(1),$(2),$(call cross4,$(1),$(3),$(4),$(5),$(6)))
55endef
56
57OP_MOVEMENTS=stack queue
58OP_POLARITIES=insfirst inslast
59OP_ACCESSORS=allhead inselem remelem
60FX_SOLUTIONS=lq-tailq lq-list cfa-cfa upp-upp cpp-stlref
61
62OPS=$(call cross3,-,$(OP_MOVEMENTS),$(OP_POLARITIES),$(OP_ACCESSORS))
63FXS=$(FX_SOLUTIONS)
64
65all : perfprogs results-latest.csv
66
67# Want to add functional dependency:
68# if current FX_SOLUTION is lq-list then
69# current OP_MOVEMENT must be stack and
70# current OP_POLARITY must be insfirst
71LQ_LIST_INCOMPAT_OP_MOVEMENTS=$(filter-out stack,$(OP_MOVEMENTS))
72LQ_LIST_INCOMPAT_OP_POLARITIES=$(filter-out insfirst,$(OP_POLARITIES))
73LQ_LIST_INCOMPAT_OPS=$(call cross3,-,$(LQ_LIST_INCOMPAT_OP_MOVEMENTS),$(OP_POLARITIES),$(OP_ACCESSORS)) \
74 $(call cross3,-,$(OP_MOVEMENTS),$(LQ_LIST_INCOMPAT_OP_POLARITIES),$(OP_ACCESSORS))
75INCOMPAT=$(call cross,--,lq-list,$(LQ_LIST_INCOMPAT_OPS))
76define filterFds
77$(filter-out $(INCOMPAT),$(1))
78endef
79
80
81CORES_FULL=$(call cross,--,$(FXS),$(OPS)) # lq-tailq--stack-inslast-allhead
82CORES=$(call filterFds,$(CORES_FULL)) # lq-tailq--stack-inslast-allhead
83
84
85PERFPROGS=$(call cross,--,perfexp,$(CORES))
86
87perfprogs : $(PERFPROGS)
88
89perfexp--% driver--%.o result--%.1csv : FX=$(call proj,--,$@,2)
90perfexp--% driver--%.o result--%.1csv : FX_COARSE=$(call proj,-,$(FX),1)
91perfexp--% driver--%.o result--%.1csv : OP=$(call proj,--,$@,3)
92perfexp--% driver--%.o result--%.1csv : OP_MOVEMENT=$(call proj,-,$(OP),1)
93perfexp--% driver--%.o result--%.1csv : OP_POLARITY=$(call proj,-,$(OP),2)
94perfexp--% driver--%.o result--%.1csv : OP_ACCESSOR=$(call proj,-,$(OP),3)
95perfexp--% driver--%.o result--%.1csv : OP_DEFINES=-DOP_MOVEMENT=$(OP_MOVEMENT) -DOP_POLARITY=$(OP_POLARITY) -DOP_ACCESSOR=$(OP_ACCESSOR)
96
97perfexp--cfa-% driver--cfa-%.o : COMPILER=$(CFA) $(PERFFLAGS_CFA)
98perfexp--lq-% driver--lq-%.o : COMPILER=$(CC) $(PERFFLAGS_CC)
99perfexp--cpp-% driver--cpp-%.o : COMPILER=$(CXX) $(PERFFLAGS_CXX)
100perfexp--upp-% driver--upp-%.o : COMPILER=$(UXX) $(PERFFLAGS_UXX)
101perfexp--% driver--%.o : COMPILER=NO-COMPILER-FOR-$(FX_COARSE)
102
103perfexp--% : driver--%.o observation.o
104 $(COMPILER) $^ -o $@
105
106driver--%.o : driver.c
107 $(COMPILER) -c $< $(OP_DEFINES) -include op-$(OP).h -include fx-$(FX).h -o $@ -MMD
108
109
110
111
112RUN_NUM_REPS=3
113RUN_REP_IDS=$(shell echo {1..$(RUN_NUM_REPS)}) # 1 2 3
114RUN_REP_EXTS=$(call cross3,,run,$(RUN_REP_IDS),.1csv) # run1.1csv run2.1cav run3.1csv
115
116RESULT1S=$(call cross,.,$(CORES),$(RUN_REP_EXTS)) # lq-tailq--stack-inslast-allhead.run2.1csv
117
118RESULT1S_SHUFD=$(shell shuf -e $(RESULT1S))
119
120%.1csv : CORE=$(basename $(basename $@))
121%.1csv : REP_ID=$(subst .run,,$(suffix $(basename $@)))
122%.1csv : REP_TIME=$(shell date '+%F %H:%M:%S')
123%.1csv : perfprogs FORCE
124 ./perfexp--$(CORE) $(RUNARGS) | xargs -n 1 printf '%s,%s,%s\n' "$(REP_TIME)" "$(REP_ID)" | tee $@
125
126BATCHTIME=$(shell date '+%F--%H-%M-%S')
127
128results--$(BATCHTIME).csv : $(RESULT1S_SHUFD)
129 cat $^ | tee $@
130 rm $^
131
132results-latest.csv : results--$(BATCHTIME).csv
133 rm -f $@
134 ln -s $< $@
135
136
137
138clean :
139 rm -f *.o *.d perfexp--*
140
141# The FORCE business means any target that mentions it is also phony
142# 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]).
143.PHONY: all perfprogs results-latest.csv clean
144FORCE:
145
146.PRECIOUS: result--%.1csv driver--%.o perfexp--% %.o
147
148
149-include *.d
Note: See TracBrowser for help on using the repository browser.