source: doc/theses/mike_brooks_MMath/benchmarks/list/Makefile @ 1dfc3d0

ADTast-experimental
Last change on this file since 1dfc3d0 was 1dfc3d0, checked in by Mike Brooks <mlbrooks@…>, 20 months ago

Tweak LL perf compilation--CLI to support a fixed-work mode that does not re-check clock() during the run.

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