[90a3a89] | 1 | # For correctness, see test-correctness.sh. |
---|
| 2 | # For performance: |
---|
| 3 | # pushd ~/cfax |
---|
[9bb8ee42] | 4 | # . ~/setcfa build-fast |
---|
[90a3a89] | 5 | # popd |
---|
| 6 | # make perfprogs CFA=$cfa -j8 MODE=performance |
---|
[9bb8ee42] | 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 |
---|
[0b66ef9] | 11 | |
---|
| 12 | CFA = cfa |
---|
| 13 | CXX = g++-11 |
---|
| 14 | UXX = ~/u++/u++-7.0.0/bin/u++ |
---|
| 15 | |
---|
[1dfc3d0] | 16 | MODE=performance |
---|
| 17 | EXTRA_COMP_FLAGS= |
---|
| 18 | RUN_NUM_REPS=3 |
---|
[9bb8ee42] | 19 | RUN_DATA_SIZE_MODE=none |
---|
| 20 | RUN_DURATION_SEC=5 |
---|
[0b66ef9] | 21 | |
---|
| 22 | ifeq "$(MODE)" "performance" |
---|
| 23 | PERFFLAGS_CFA = -nodebug -O3 |
---|
| 24 | PERFFLAGS_CC = -DNDEBUG -O3 |
---|
| 25 | else ifeq "$(MODE)" "correctness" |
---|
| 26 | PERFFLAGS_CFA = -debug -O0 -g |
---|
| 27 | PERFFLAGS_CC = -O0 -g |
---|
| 28 | else |
---|
| 29 | $(error Bad MODE ($(MODE)); should be performance or correctness) |
---|
| 30 | endif |
---|
| 31 | |
---|
| 32 | PERFFLAGS_CXX = $(PERFFLAGS_CC) |
---|
| 33 | PERFFLAGS_UXX = $(PERFFLAGS_CC) |
---|
| 34 | |
---|
| 35 | SHELL = /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 |
---|
| 41 | define proj |
---|
| 42 | $(word $(3),$(subst $(1), ,$(basename $(2)))) |
---|
| 43 | endef |
---|
| 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 |
---|
| 49 | define cross |
---|
| 50 | $(foreach x,$(2),$(foreach xs,$(3),$(x)$(1)$(xs))) |
---|
| 51 | endef |
---|
| 52 | define cross3 |
---|
| 53 | $(call cross,$(1),$(2),$(call cross,$(1),$(3),$(4))) |
---|
| 54 | endef |
---|
| 55 | define cross4 |
---|
| 56 | $(call cross,$(1),$(2),$(call cross3,$(1),$(3),$(4),$(5))) |
---|
| 57 | endef |
---|
| 58 | define cross5 |
---|
| 59 | $(call cross,$(1),$(2),$(call cross4,$(1),$(3),$(4),$(5),$(6))) |
---|
| 60 | endef |
---|
| 61 | |
---|
| 62 | OP_MOVEMENTS=stack queue |
---|
| 63 | OP_POLARITIES=insfirst inslast |
---|
| 64 | OP_ACCESSORS=allhead inselem remelem |
---|
| 65 | FX_SOLUTIONS=lq-tailq lq-list cfa-cfa upp-upp cpp-stlref |
---|
| 66 | |
---|
| 67 | OPS=$(call cross3,-,$(OP_MOVEMENTS),$(OP_POLARITIES),$(OP_ACCESSORS)) |
---|
| 68 | FXS=$(FX_SOLUTIONS) |
---|
| 69 | |
---|
| 70 | all : 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 |
---|
| 76 | LQ_LIST_INCOMPAT_OP_MOVEMENTS=$(filter-out stack,$(OP_MOVEMENTS)) |
---|
| 77 | LQ_LIST_INCOMPAT_OP_POLARITIES=$(filter-out insfirst,$(OP_POLARITIES)) |
---|
| 78 | LQ_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)) |
---|
| 80 | INCOMPAT=$(call cross,--,lq-list,$(LQ_LIST_INCOMPAT_OPS)) |
---|
| 81 | define filterFds |
---|
| 82 | $(filter-out $(INCOMPAT),$(1)) |
---|
| 83 | endef |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | CORES_FULL=$(call cross,--,$(FXS),$(OPS)) # lq-tailq--stack-inslast-allhead |
---|
| 87 | CORES=$(call filterFds,$(CORES_FULL)) # lq-tailq--stack-inslast-allhead |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | PERFPROGS=$(call cross,--,perfexp,$(CORES)) |
---|
| 91 | |
---|
| 92 | perfprogs : $(PERFPROGS) |
---|
| 93 | |
---|
| 94 | perfexp--% driver--%.o result--%.1csv : FX=$(call proj,--,$@,2) |
---|
| 95 | perfexp--% driver--%.o result--%.1csv : FX_COARSE=$(call proj,-,$(FX),1) |
---|
| 96 | perfexp--% driver--%.o result--%.1csv : OP=$(call proj,--,$@,3) |
---|
| 97 | perfexp--% driver--%.o result--%.1csv : OP_MOVEMENT=$(call proj,-,$(OP),1) |
---|
| 98 | perfexp--% driver--%.o result--%.1csv : OP_POLARITY=$(call proj,-,$(OP),2) |
---|
| 99 | perfexp--% driver--%.o result--%.1csv : OP_ACCESSOR=$(call proj,-,$(OP),3) |
---|
| 100 | perfexp--% driver--%.o result--%.1csv : OP_DEFINES=-DOP_MOVEMENT=$(OP_MOVEMENT) -DOP_POLARITY=$(OP_POLARITY) -DOP_ACCESSOR=$(OP_ACCESSOR) |
---|
| 101 | |
---|
| 102 | perfexp--cfa-% driver--cfa-%.o : COMPILER=$(CFA) $(PERFFLAGS_CFA) |
---|
| 103 | perfexp--lq-% driver--lq-%.o : COMPILER=$(CC) $(PERFFLAGS_CC) |
---|
| 104 | perfexp--cpp-% driver--cpp-%.o : COMPILER=$(CXX) $(PERFFLAGS_CXX) |
---|
| 105 | perfexp--upp-% driver--upp-%.o : COMPILER=$(UXX) $(PERFFLAGS_UXX) |
---|
| 106 | perfexp--% driver--%.o : COMPILER=NO-COMPILER-FOR-$(FX_COARSE) |
---|
| 107 | |
---|
[fdc042d] | 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 | |
---|
[0b66ef9] | 117 | perfexp--% : driver--%.o observation.o |
---|
[1dfc3d0] | 118 | $(COMPILER) $(EXTRA_COMP_FLAGS) $^ -o $@ |
---|
[0b66ef9] | 119 | |
---|
| 120 | driver--%.o : driver.c |
---|
[1dfc3d0] | 121 | $(COMPILER) $(EXTRA_COMP_FLAGS) -c $< $(OP_DEFINES) -include op-$(OP).h -include fx-$(FX).h -o $@ -MMD |
---|
[0b66ef9] | 122 | |
---|
[1dfc3d0] | 123 | sayhi: |
---|
| 124 | echo $(PERFPROGS) |
---|
[0b66ef9] | 125 | |
---|
| 126 | |
---|
[9bb8ee42] | 127 | ifeq "$(RUN_DATA_SIZE_MODE)" "common5" |
---|
| 128 | RUN_DATA_SIZES=\ |
---|
| 129 | 7-1000000 \ |
---|
| 130 | 71-100000 \ |
---|
| 131 | 809-10000 \ |
---|
| 132 | 9051-1000 \ |
---|
| 133 | 72421-100 |
---|
| 134 | else ifeq "$(RUN_DATA_SIZE_MODE)" "thorough" |
---|
| 135 | RUN_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 |
---|
| 178 | else ifeq "$(RUN_DATA_SIZE_MODE)" "manual" |
---|
| 179 | ifeq "$(RUN_DATA_SIZES)" "" |
---|
| 180 | $(error RUN_DATA_SIZE_MODE is manual but RUN_DATA_SIZES not given) |
---|
| 181 | endif |
---|
| 182 | else ifeq "$(RUN_DATA_SIZE_MODE)" "none" |
---|
| 183 | # Assume user manages RUN_ARGS; empty RUN_ARGS just means run with compiled-in defaults |
---|
| 184 | RUN_DATA_SIZES=none |
---|
| 185 | else |
---|
| 186 | $(error Bad RUN_DATA_SIZE_MODE ($(RUN_DATA_SIZE_MODE)); should be common5, thorough or manual) |
---|
| 187 | endif |
---|
| 188 | |
---|
[0b66ef9] | 189 | RUN_REP_IDS=$(shell echo {1..$(RUN_NUM_REPS)}) # 1 2 3 |
---|
| 190 | RUN_REP_EXTS=$(call cross3,,run,$(RUN_REP_IDS),.1csv) # run1.1csv run2.1cav run3.1csv |
---|
| 191 | |
---|
[9bb8ee42] | 192 | RUN_LAUNCHES=$(call cross,--,$(RUN_DATA_SIZES),$(RUN_REP_EXTS)) |
---|
| 193 | |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | RESULT1S=$(call cross,.,$(CORES),$(RUN_LAUNCHES)) # lq-tailq--stack-inslast-allhead.run2.1csv |
---|
| 197 | |
---|
[0b66ef9] | 198 | |
---|
| 199 | RESULT1S_SHUFD=$(shell shuf -e $(RESULT1S)) |
---|
| 200 | |
---|
| 201 | %.1csv : CORE=$(basename $(basename $@)) |
---|
[9bb8ee42] | 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)) |
---|
[0b66ef9] | 208 | %.1csv : REP_TIME=$(shell date '+%F %H:%M:%S') |
---|
| 209 | %.1csv : perfprogs FORCE |
---|
[9bb8ee42] | 210 | ./perfexp--$(CORE) $(RUN_ARGS) | xargs -n 1 printf '%s,%s,%s,%s\n' "$(REP_TIME)" "$(REP_ID)" "$(RUN_ARGS)" | tee $@ |
---|
| 211 | |
---|
[0b66ef9] | 212 | |
---|
| 213 | BATCHTIME=$(shell date '+%F--%H-%M-%S') |
---|
| 214 | |
---|
| 215 | results--$(BATCHTIME).csv : $(RESULT1S_SHUFD) |
---|
| 216 | cat $^ | tee $@ |
---|
| 217 | rm $^ |
---|
| 218 | |
---|
| 219 | results-latest.csv : results--$(BATCHTIME).csv |
---|
| 220 | rm -f $@ |
---|
| 221 | ln -s $< $@ |
---|
| 222 | |
---|
| 223 | |
---|
| 224 | |
---|
| 225 | clean : |
---|
| 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 |
---|
| 231 | FORCE: |
---|
| 232 | |
---|
| 233 | .PRECIOUS: result--%.1csv driver--%.o perfexp--% %.o |
---|
| 234 | |
---|
| 235 | -include *.d |
---|