| [7d02d35] | 1 | # Usage
 | 
|---|
 | 2 | # $cfabuild/driver/cfa -nodebug -quiet -c -x c /dev/null && rm null.o || echo Need to fix \$cfabuild
 | 
|---|
 | 3 | # make CFABUILD=$cfabuild -j8                                                                                                                                                                                                           # compile
 | 
|---|
 | 4 | # make measurement  CFA_APILEVELS=ll OPERATIONS='pta peq pbv'                             CORPORI='corpus-100-*-1.txt corpus-1-*-1.txt' # append-pbv
 | 
|---|
 | 5 | # make measurement2 CFA_APILEVELS=ll OPERATIONS='pall' PLATFORMS=cfa CFA_SHARINGS=share   CORPORI='corpus-1-*-1.txt'                                            # allocate-speed-cfa
 | 
|---|
 | 6 | # make measurement2 CFA_APILEVELS=ll OPERATIONS='pall' PLATFORMS=stl CFA_EXPANSIONS=-1.0  CORPORI='corpus-1-*-1.txt'                                            # allocate-speed-stl
 | 
|---|
 | 7 | # make measurement3 CFA_APILEVELS=ll OPERATIONS='pall' PLATFORMS=cfa CFA_SHARINGS=share   CORPORI='corpus-1-*-1.txt'                                            # allocate-space-cfa
 | 
|---|
 | 8 | # make measurement3 CFA_APILEVELS=ll OPERATIONS='pall' PLATFORMS=stl CFA_EXPANSIONS=-1.0  CORPORI='corpus-1-*-1.txt'                                            # allocate-space-stl
 | 
|---|
 | 9 | # make measurement4 CFA_APILEVELS=ll OPERATIONS='pall' PLATFORMS=cfa CFA_EXPANSIONS=0.2   CFA_SHARINGS=share   CORPORI='corpus-1-*-1.txt'       # allocate-attrib-cfa
 | 
|---|
 | 10 | # make measurement4 CFA_APILEVELS=ll OPERATIONS='pall' PLATFORMS=stl CFA_EXPANSIONS=-1.0                       CORPORI='corpus-1-*-1.txt'       # allocate-attrib-stl
 | 
|---|
| [01db301] | 11 | 
 | 
|---|
| [e0350e0] | 12 | LIBCFA = $(cfabuild)/libcfa/*/src/.libs/libcfa.so
 | 
|---|
| [01db301] | 13 | 
 | 
|---|
| [e0350e0] | 14 | CFA = $(cfabuild)/driver/cfa
 | 
|---|
| [01db301] | 15 | PERFFLAGS_CFA = -nodebug -O2
 | 
|---|
| [08ed947] | 16 | PERFFLAGS_CXX = -DNDEBUG -O2 -Wl,--no-as-needed -ldl
 | 
|---|
| [01db301] | 17 | 
 | 
|---|
 | 18 | 
 | 
|---|
| [fefd77a] | 19 | # function: convert to upper case
 | 
|---|
| [97d58dc] | 20 | define uc
 | 
|---|
| [e0350e0] | 21 | $(shell echo $1 | tr  '[:lower:]' '[:upper:]')
 | 
|---|
 | 22 | endef
 | 
|---|
 | 23 | 
 | 
|---|
 | 24 | # function: project numbered element of filename named by any-delimited tuple
 | 
|---|
 | 25 | # (call proj,q-w-e-r.txt,-,4) is 4.txt
 | 
|---|
 | 26 | # (call proj,q-w-e-r.foo.txt,.,1) is q-w-e-r
 | 
|---|
 | 27 | define proj
 | 
|---|
 | 28 | $(word $3,$(subst $2, ,$1))
 | 
|---|
| [97d58dc] | 29 | endef
 | 
|---|
| [01db301] | 30 | 
 | 
|---|
| [fefd77a] | 31 | # function: project numbered element of filename named by hyphen-delimited tuple
 | 
|---|
| [e0350e0] | 32 | # (call hyphProj,q-w-e-r.txt,4) is r.txt
 | 
|---|
 | 33 | define hyphProj
 | 
|---|
 | 34 | $(call proj,$1,-,$2)
 | 
|---|
 | 35 | endef
 | 
|---|
 | 36 | 
 | 
|---|
 | 37 | # function: drop file extension and project element
 | 
|---|
 | 38 | # (call bnHyphProj,q-w-e-r.txt,4) is r
 | 
|---|
 | 39 | define bnHyphProj
 | 
|---|
 | 40 | $(call hyphProj,$(basename $1),$2)
 | 
|---|
 | 41 | endef
 | 
|---|
 | 42 | 
 | 
|---|
 | 43 | # function: drop file extension, project element and uppercase it
 | 
|---|
 | 44 | # (call ucBnhyphProj,q-w-e-r.txt,4) is R
 | 
|---|
 | 45 | define ucBnHyphProj
 | 
|---|
 | 46 | $(call uc,$(call bnHyphProj,$1,$2))
 | 
|---|
 | 47 | endef
 | 
|---|
 | 48 | 
 | 
|---|
 | 49 | # function: cross two lists, adding given delimiters
 | 
|---|
 | 50 | # (call delCross,+,a b c,1 2) is a+1 a+2 b+1 b+2 c+1 c+2
 | 
|---|
 | 51 | define delCross
 | 
|---|
 | 52 | $(foreach x,$2,$(foreach xs,$3,$(x)$1$(xs)))
 | 
|---|
 | 53 | endef
 | 
|---|
 | 54 | 
 | 
|---|
 | 55 | define delCross3
 | 
|---|
 | 56 | $(call delCross,$1,$2,$(call delCross,$1,$3,$4))
 | 
|---|
 | 57 | endef
 | 
|---|
 | 58 | 
 | 
|---|
 | 59 | define delCross4
 | 
|---|
 | 60 | $(call delCross,$1,$2,$(call delCross3,$1,$3,$4,$5))
 | 
|---|
 | 61 | endef
 | 
|---|
 | 62 | 
 | 
|---|
 | 63 | define delCross5
 | 
|---|
 | 64 | $(call delCross,$1,$2,$(call delCross4,$1,$3,$4,$5,$6))
 | 
|---|
| [fefd77a] | 65 | endef
 | 
|---|
 | 66 | 
 | 
|---|
 | 67 | # function: cross two lists, adding hyphen delimiters
 | 
|---|
 | 68 | # (call hyphCross,a b c,1 2) is a-1 a-2 b-1 b-2 c-1 c-2
 | 
|---|
 | 69 | define hyphCross
 | 
|---|
| [e0350e0] | 70 | $(call delCross,-,$1,$2)
 | 
|---|
| [fefd77a] | 71 | endef
 | 
|---|
 | 72 | 
 | 
|---|
 | 73 | define hyphCross3
 | 
|---|
| [e0350e0] | 74 | $(call delCross3,-,$1,$2,$3)
 | 
|---|
| [fefd77a] | 75 | endef
 | 
|---|
 | 76 | 
 | 
|---|
 | 77 | define hyphCross4
 | 
|---|
| [e0350e0] | 78 | $(call delCross4,-,$1,$2,$3,$4)
 | 
|---|
| [fefd77a] | 79 | endef
 | 
|---|
 | 80 | 
 | 
|---|
 | 81 | define hyphCross5
 | 
|---|
| [e0350e0] | 82 | $(call delCross5,-,$1,$2,$3,$4,$5)
 | 
|---|
| [fefd77a] | 83 | endef
 | 
|---|
 | 84 | 
 | 
|---|
| [e0350e0] | 85 | OPERATIONS?=pta peq pbv pall #pno
 | 
|---|
 | 86 | ALLOCS?=reuse fresh
 | 
|---|
 | 87 | CFA_APILEVELS?=hl ll
 | 
|---|
 | 88 | CFA_SHARINGS?=share noshare
 | 
|---|
 | 89 | PLATFORMS?=cfa stl #buhr94
 | 
|---|
| [fefd77a] | 90 | 
 | 
|---|
 | 91 | ifneq ($(filter cfa,$(PLATFORMS)),)
 | 
|---|
| [08ed947] | 92 |     CFA_APIS=$(call hyphCross,$(CFA_APILEVELS),$(CFA_SHARINGS))
 | 
|---|
| [fefd77a] | 93 | endif
 | 
|---|
 | 94 | 
 | 
|---|
 | 95 | ifneq ($(filter stl,$(PLATFORMS)),)
 | 
|---|
| [08ed947] | 96 |     STL_APIS=na-na
 | 
|---|
| [fefd77a] | 97 | endif
 | 
|---|
 | 98 | 
 | 
|---|
 | 99 | ifneq ($(filter buhr94,$(PLATFORMS)),)
 | 
|---|
| [08ed947] | 100 |     BUHR94_APIS=na-na
 | 
|---|
| [fefd77a] | 101 | endif
 | 
|---|
 | 102 | 
 | 
|---|
| [08ed947] | 103 | APIS = $(CFA_APIS) $(STL_APIS) $(BUHR94_APIS)
 | 
|---|
| [fefd77a] | 104 | 
 | 
|---|
| [08ed947] | 105 | OPERATIONS_USING_ALLOCS=pta peq
 | 
|---|
 | 106 | define enrichOperationsAllocs
 | 
|---|
| [e0350e0] | 107 | $(call hyphCross3,$(filter peq pta,$(OPERATIONS)),$1,$(ALLOCS)) $(call hyphCross3,$(filter-out peq pta,$(OPERATIONS)),$1,na)
 | 
|---|
| [08ed947] | 108 | endef
 | 
|---|
| [fefd77a] | 109 | 
 | 
|---|
| [08ed947] | 110 | CFA_PERFPROGS=$(call hyphCross,perfexp-cfa,$(call enrichOperationsAllocs,$(CFA_APIS)))
 | 
|---|
 | 111 | STL_PERFPROGS=$(call hyphCross,perfexp-stl,$(call enrichOperationsAllocs,$(STL_APIS)))
 | 
|---|
 | 112 | BUHR94_PERFPROGS=$(call hyphCross,perfexp-buhr94,$(call enrichOperationsAllocs,$(BUHR94_APIS)))
 | 
|---|
| [fefd77a] | 113 | 
 | 
|---|
| [08ed947] | 114 | PERFPROGS = $(CFA_PERFPROGS) $(STL_PERFPROGS) $(BUHR94_PERFPROGS)
 | 
|---|
| [01db301] | 115 | 
 | 
|---|
| [08ed947] | 116 | all : $(PERFPROGS)
 | 
|---|
| [01db301] | 117 | 
 | 
|---|
| [08ed947] | 118 | PP_SPLIT := $(shell echo "${PERFPROGS}" | sed -e 's/ /\\n/g')
 | 
|---|
 | 119 | echoPerfProgs:
 | 
|---|
 | 120 |         echo -e '$(PP_SPLIT)'
 | 
|---|
 | 121 | 
 | 
|---|
| [e0350e0] | 122 | perfexp-%.o: API=$(call ucBnHyphProj,$@,2)
 | 
|---|
 | 123 | perfexp-%.o: OPERATION=$(call ucBnHyphProj,$@,3)
 | 
|---|
 | 124 | perfexp-%.o: CFA_APILEVEL=$(call ucBnHyphProj,$@,4)
 | 
|---|
 | 125 | perfexp-%.o: CFA_SHARING=$(call ucBnHyphProj,$@,5)
 | 
|---|
 | 126 | perfexp-%.o: ALLOC=$(call ucBnHyphProj,$@,6)
 | 
|---|
| [08ed947] | 127 | perfexp-%.o: SCENARIO_SWITCH=-DIMPL_$(API)_$(CFA_APILEVEL)_$(CFA_SHARING) -DOP_$(OPERATION) -DALLOC_$(ALLOC)
 | 
|---|
 | 128 | 
 | 
|---|
 | 129 | perfexp-cfa-%.o: CMD=$(CFA) -c $(PERFFLAGS_CFA) $< -o $@ $(SCENARIO_SWITCH)
 | 
|---|
 | 130 | perfexp-stl-%.o: CMD=$(CXX) -c -xc++ $(PERFFLAGS_CXX) $< -o $@ $(SCENARIO_SWITCH)
 | 
|---|
 | 131 | perfexp-buhr94-%.o: CMD=$(CXX) -xc++ -c $(PERFFLAGS_CXX) $< -o $@ $(SCENARIO_SWITCH)
 | 
|---|
 | 132 | 
 | 
|---|
 | 133 | perfexp-cfa-peq-%.o: prog.cfa $(LIBCFA)
 | 
|---|
 | 134 |         $(CMD)
 | 
|---|
 | 135 | perfexp-cfa-pta-%.o: prog.cfa $(LIBCFA)
 | 
|---|
 | 136 |         $(CMD)
 | 
|---|
 | 137 | perfexp-cfa-pbv-%.o: prog-passbyval.cfa $(LIBCFA)
 | 
|---|
 | 138 |         $(CMD)
 | 
|---|
 | 139 | perfexp-cfa-pb%.o: prog-passbyX.cfa $(LIBCFA)
 | 
|---|
 | 140 |         $(CMD)
 | 
|---|
 | 141 | perfexp-cfa-pfi-%.o: prog-find.cfa $(LIBCFA)
 | 
|---|
 | 142 |         $(CMD)
 | 
|---|
 | 143 | perfexp-cfa-pall-%.o: prog-allocn.cfa $(LIBCFA)
 | 
|---|
 | 144 |         $(CMD)
 | 
|---|
 | 145 | perfexp-cfa-pno-%.o: prog-normalize.cfa $(LIBCFA)
 | 
|---|
 | 146 |         $(CMD)
 | 
|---|
 | 147 | perfexp-stl-peq-%.o: prog.cfa
 | 
|---|
 | 148 |         $(CMD)
 | 
|---|
 | 149 | perfexp-stl-pta-%.o: prog.cfa
 | 
|---|
 | 150 |         $(CMD)
 | 
|---|
 | 151 | perfexp-stl-pbv-%.o: prog-passbyval.cfa
 | 
|---|
 | 152 |         $(CMD)
 | 
|---|
 | 153 | perfexp-stl-pfi-%.o: prog-find.cfa
 | 
|---|
 | 154 |         $(CMD)
 | 
|---|
 | 155 | perfexp-stl-pall-%.o: prog-allocn.cfa
 | 
|---|
 | 156 |         $(CMD)
 | 
|---|
 | 157 | perfexp-stl-pno-%.o: prog-normalize.cfa
 | 
|---|
 | 158 |         $(CMD)
 | 
|---|
 | 159 | perfexp-buhr94-peq-%.o: prog.cfa buhr94-string.o buhr94-VbyteSM.o
 | 
|---|
 | 160 |         $(CMD)
 | 
|---|
 | 161 | perfexp-buhr94-pta-%.o: prog.cfa buhr94-string.o buhr94-VbyteSM.o
 | 
|---|
 | 162 |         $(CMD)
 | 
|---|
 | 163 | perfexp-buhr94-pta-%.o: prog-passbyval.cfa buhr94-string.o buhr94-VbyteSM.o
 | 
|---|
 | 164 |         $(CMD)
 | 
|---|
 | 165 | perfexp-buhr94-pall-%.o: prog-allocn.cfa buhr94-string.o buhr94-VbyteSM.o
 | 
|---|
 | 166 |         $(CMD)
 | 
|---|
 | 167 | perfexp-buhr94-pno-%.o: prog-normalize.cfa buhr94-string.o buhr94-VbyteSM.o
 | 
|---|
 | 168 |         $(CMD)
 | 
|---|
 | 169 | 
 | 
|---|
 | 170 | # one of the pbx cases also needs to link with not_string_res.o (handling manually)
 | 
|---|
 | 171 | perfexp-cfa-%: perfexp-cfa-%.o $(LIBCFA)
 | 
|---|
 | 172 |         $(CFA) $(PERFFLAGS_CFA) $< -o $@  
 | 
|---|
 | 173 | perfexp-stl-%: perfexp-stl-%.o $(LIBCFA)
 | 
|---|
 | 174 |         $(CFA) $(PERFFLAGS_CFA) $< /lib/x86_64-linux-gnu/libstdc++.so.6 -o $@
 | 
|---|
 | 175 | perfexp-buhr94-% : perfexp-buhr94-%.o buhr94-string.o buhr94-VbyteSM.o
 | 
|---|
 | 176 |         $(CXX) $(PERFFLAGS_CXX) $^ -o $@
 | 
|---|
| [01db301] | 177 | 
 | 
|---|
 | 178 | buhr94-string.o:
 | 
|---|
 | 179 |         $(CXX) -xc++ -c $(PERFFLAGS_CXX) ~/usys1/sm/string/StringSharing/src/string.cc -o $@
 | 
|---|
 | 180 | 
 | 
|---|
 | 181 | buhr94-VbyteSM.o:
 | 
|---|
 | 182 |         $(CXX) -xc++ -c $(PERFFLAGS_CXX) ~/usys1/sm/string/StringSharing/src/VbyteSM.cc -o $@
 | 
|---|
 | 183 | 
 | 
|---|
 | 184 | clean:
 | 
|---|
 | 185 |         rm -f *.o perfexp*
 | 
|---|
 | 186 | 
 | 
|---|
 | 187 | MEASURE = $(PERFPROGS)
 | 
|---|
| [e0350e0] | 188 | 
 | 
|---|
 | 189 | CORPUS_MEANLEN_MODE?=auto #manual
 | 
|---|
 | 190 | CORPUS_MEANLEN_START?=1
 | 
|---|
 | 191 | CORPUS_MEANLEN_END?=500
 | 
|---|
 | 192 | CORPUS_MEANLEN_STEPS_PER_DOUBLE?=1
 | 
|---|
 | 193 | CORPUS_MEANLEN_MANVALS?=20 50 100 200 500
 | 
|---|
 | 194 | COPRUS_NSTRSS?=100
 | 
|---|
 | 195 | CORPUS_RELSCALES?=1.0
 | 
|---|
 | 196 | CORPUS_SEEDS?=9876
 | 
|---|
 | 197 | CORPUS_OFFSET_INSTRS?=t0
 | 
|---|
 | 198 | 
 | 
|---|
 | 199 | CORPUS_MEANLENS_AUTO=${shell python3 gen-size-steps.py ${CORPUS_MEANLEN_START} ${CORPUS_MEANLEN_END} ${CORPUS_MEANLEN_STEPS_PER_DOUBLE}}
 | 
|---|
 | 200 | CORPUS_MEANLENS=\
 | 
|---|
 | 201 |         $(if $(filter auto,$(CORPUS_MEANLEN_MODE)),$(CORPUS_MEANLENS_AUTO), \
 | 
|---|
 | 202 |         $(if $(filter manual,$(CORPUS_MEANLEN_MODE)),$(CORPUS_MEANLEN_MANVALS), \
 | 
|---|
 | 203 |         ERROR))
 | 
|---|
 | 204 | CORPUS_SERIES_IDS=$(call delCross3,+,$(CORPUS_RELSCALES),$(CORPUS_SEEDS),$(CORPUS_OFFSET_INSTRS))
 | 
|---|
 | 205 | CORPUS_SLUGS=$(call hyphCross4,corpus,$(COPRUS_NSTRSS),$(CORPUS_MEANLENS),$(CORPUS_SERIES_IDS))
 | 
|---|
 | 206 | CORPORI=$(call delCross,.,$(CORPUS_SLUGS),txt)
 | 
|---|
 | 207 | 
 | 
|---|
 | 208 | # function to interpret an offset instruction for a given mean-length,
 | 
|---|
 | 209 | # producing the pair of arguments for locn and offset
 | 
|---|
 | 210 | #
 | 
|---|
 | 211 | # An offset instruction is an opcode and natural-number argument.
 | 
|---|
 | 212 | # The opcode is either (t)ake or (l)eave.
 | 
|---|
 | 213 | # The argument is how much length to take from / leave behind.
 | 
|---|
 | 214 | # The resulting amount is deducted from the mean-length and returned in offset.
 | 
|---|
 | 215 | # The remaining mean-length is returned in locn.
 | 
|---|
 | 216 | #
 | 
|---|
 | 217 | # $(call interpOffsetInstr,20,l1) = 1 19 (i.e. constant-length 20)
 | 
|---|
 | 218 | # $(call interpOffsetInstr,20,l5) = 5 15
 | 
|---|
 | 219 | # $(call interpOffsetInstr,20,t5) = 15 5
 | 
|---|
 | 220 | # $(call interpOffsetInstr,20,t0) = 20 0 (i.e. full variability)
 | 
|---|
 | 221 | define interpOffsetInstr
 | 
|---|
 | 222 | $(strip
 | 
|---|
 | 223 |         $(eval qty := $(subst t,,$(subst l,,$2)))
 | 
|---|
 | 224 |         $(if $(filter t%,$2), $(shell expr $1 - $(qty)) $(qty),
 | 
|---|
 | 225 |         $(if $(filter l%,$2), $(qty) $(shell expr $1 - $(qty)),
 | 
|---|
 | 226 |         ERROR))
 | 
|---|
 | 227 | )
 | 
|---|
 | 228 | endef
 | 
|---|
 | 229 | 
 | 
|---|
 | 230 | corpori: $(CORPORI)
 | 
|---|
 | 231 | 
 | 
|---|
 | 232 | make-corpus: make-corpus.cfa
 | 
|---|
 | 233 |         $(CFA) $< -o $@
 | 
|---|
 | 234 | 
 | 
|---|
 | 235 | corpus-%.txt: COPRUS_NSTRS=$(call bnHyphProj,$@,2)
 | 
|---|
 | 236 | corpus-%.txt: CORPUS_MEANLEN=$(call bnHyphProj,$@,3)
 | 
|---|
 | 237 | corpus-%.txt: CORPUS_SERIES_ID=$(call bnHyphProj,$@,4)
 | 
|---|
 | 238 | corpus-%.txt: CORPUS_RELSCALE=$(call proj,$(CORPUS_SERIES_ID),+,1)
 | 
|---|
 | 239 | corpus-%.txt: CORPUS_SEED=$(call proj,$(CORPUS_SERIES_ID),+,2)
 | 
|---|
 | 240 | corpus-%.txt: CORPUS_OFFSET_INSTR=$(call proj,$(CORPUS_SERIES_ID),+,3)
 | 
|---|
 | 241 | corpus-%.txt: make-corpus
 | 
|---|
 | 242 |         $(eval CORPUS_OFFSET_INTERPD := $(call interpOffsetInstr,$(CORPUS_MEANLEN),$(CORPUS_OFFSET_INSTR)))
 | 
|---|
 | 243 |         $(eval CORPUS_LOCN := $(word 1,$(CORPUS_OFFSET_INTERPD)))
 | 
|---|
 | 244 |         $(eval CORPUS_OFFSET := $(word 2,$(CORPUS_OFFSET_INTERPD)))
 | 
|---|
 | 245 |         ./$< $(COPRUS_NSTRS) $(CORPUS_LOCN) $(CORPUS_RELSCALE) $(CORPUS_SEED) $(CORPUS_OFFSET) > $@
 | 
|---|
| [01db301] | 246 | 
 | 
|---|
| [7d02d35] | 247 | RUN_TASKSET_CPULIST=6
 | 
|---|
 | 248 | 
 | 
|---|
| [e0350e0] | 249 | # both ?= and :=
 | 
|---|
 | 250 | ifeq ($(origin MEASUREMENT_TOFILE), undefined)
 | 
|---|
 | 251 | MEASUREMENT_TOFILE:=measurement-$(shell date '+%F--%H-%M-%S').output
 | 
|---|
 | 252 | endif
 | 
|---|
 | 253 | 
 | 
|---|
| [7d02d35] | 254 | # General timing
 | 
|---|
| [e0350e0] | 255 | # Output file gets concatenation of program outputs (one line per run)
 | 
|---|
 | 256 | measurement: $(MEASURE) corpori
 | 
|---|
 | 257 |         @echo "running $(words $(MEASURE)) programs:" $(MEASURE)
 | 
|---|
 | 258 |         @echo "... on $(words $(CORPORI)) corpori:" $(CORPORI)
 | 
|---|
 | 259 |         @echo "... for $(shell expr $(words $(MEASURE)) "*" $(words $(CORPORI))) rows into:" $(MEASUREMENT_TOFILE)
 | 
|---|
 | 260 |         @for prog in $(MEASURE) ; do \
 | 
|---|
| [01db301] | 261 |             for corpus in $(CORPORI) ; do \
 | 
|---|
 | 262 |                         corpusbody=`cat $$corpus` ; \
 | 
|---|
| [7d02d35] | 263 |                         resulttext=`taskset --cpu-list $(RUN_TASKSET_CPULIST) ./$$prog 100 10 $$corpusbody` ; \
 | 
|---|
| [e0350e0] | 264 |                         echo $$prog,$$corpus,$$resulttext  >>  $(MEASUREMENT_TOFILE) ; \
 | 
|---|
| [7d02d35] | 265 |                         echo $$prog,$$corpus,$$resulttext  ; \
 | 
|---|
| [01db301] | 266 |                 done ; \
 | 
|---|
| [fefd77a] | 267 |         done
 | 
|---|
| [08ed947] | 268 | 
 | 
|---|
| [e0350e0] | 269 | CFA_EXPANSIONS?=0.02 0.05 0.1 0.2 0.4 0.5 0.9 0.98
 | 
|---|
| [08ed947] | 270 | 
 | 
|---|
| [7d02d35] | 271 | # Special-case timing with extra IV for CFA_EXPANSIONS
 | 
|---|
 | 272 | # Output file gets concatenation of program outputs (one line per run)
 | 
|---|
| [e0350e0] | 273 | measurement2: $(MEASURE) corpori
 | 
|---|
 | 274 |         @echo "running $(words $(MEASURE)) programs:" $(MEASURE)
 | 
|---|
 | 275 |         @echo "... on $(words $(CORPORI)) corpori:" $(CORPORI)
 | 
|---|
 | 276 |         @echo "... with $(words $(CFA_EXPANSIONS)) expansions:" $(CFA_EXPANSIONS)
 | 
|---|
 | 277 |         @echo "... for $(shell expr $(words $(MEASURE)) "*" $(words $(CORPORI)) "*" $(words $(CFA_EXPANSIONS))) rows into:" $(MEASUREMENT_TOFILE)
 | 
|---|
 | 278 |         @for prog in $(MEASURE) ; do \
 | 
|---|
| [08ed947] | 279 |             for corpus in $(CORPORI) ; do \
 | 
|---|
 | 280 |                         for expansion in $(CFA_EXPANSIONS) ; do \
 | 
|---|
 | 281 |                                 corpusbody=`cat $$corpus` ; \
 | 
|---|
| [e0350e0] | 282 |                                 printed=`taskset --cpu-list $(RUN_TASKSET_CPULIST) ./$$prog 1000 1.006 $$expansion 10 $$corpusbody` ; \
 | 
|---|
 | 283 |                                 echo $$prog,$$corpus,$$expansion,$$printed  >>  $(MEASUREMENT_TOFILE) ; \
 | 
|---|
| [08ed947] | 284 |                                 echo $$prog,$$corpus,$$expansion,$$printed  ; \
 | 
|---|
 | 285 |                         done ; \
 | 
|---|
 | 286 |                 done ; \
 | 
|---|
 | 287 |         done
 | 
|---|
 | 288 | 
 | 
|---|
| [7d02d35] | 289 | # Space, with the IV for CFA_EXPANSIONS
 | 
|---|
| [e0350e0] | 290 | # Runs Mubeen's malloc interceptor to get malloc-request stats
 | 
|---|
| [7d02d35] | 291 | # Output file gets concatenation of the interceptor's output (one line per run); program's output ignorred
 | 
|---|
 | 292 | # Expect and ignore crashes; they're during shutdown, after everything we care about is over
 | 
|---|
| [e0350e0] | 293 | measurement3: $(MEASURE) corpori
 | 
|---|
 | 294 |         @echo "running $(words $(MEASURE)) programs:" $(MEASURE)
 | 
|---|
 | 295 |         @echo "... on $(words $(CORPORI)) corpori:" $(CORPORI)
 | 
|---|
 | 296 |         @echo "... with $(words $(CFA_EXPANSIONS)) expansions:" $(CFA_EXPANSIONS)
 | 
|---|
 | 297 |         @echo "... for $(shell expr $(words $(MEASURE)) "*" $(words $(CORPORI))) rows into:" $(MEASUREMENT_TOFILE)
 | 
|---|
 | 298 |         @for prog in $(MEASURE) ; do \
 | 
|---|
| [7d02d35] | 299 |             for corpus in $(CORPORI) ; do \
 | 
|---|
 | 300 |                         for expansion in $(CFA_EXPANSIONS) ; do \
 | 
|---|
 | 301 |                                 corpusbody=`cat $$corpus` ; \
 | 
|---|
 | 302 |                                 LD_PRELOAD=~/plg2/mubeen-stat-shim/malloc/mallocWrappers.so ./$$prog 1000 1.006 $$expansion 10 $$corpusbody ; \
 | 
|---|
 | 303 |                                 printed=`tail -n 1 preload_dump.txt` ; \
 | 
|---|
| [e0350e0] | 304 |                                 echo $$prog $$corpus $$expansion $$printed  >>  $(MEASUREMENT_TOFILE) ; \
 | 
|---|
| [7d02d35] | 305 |                                 echo $$prog $$corpus $$expansion $$printed  ; \
 | 
|---|
 | 306 |                                 rm preload_dump.txt ; \
 | 
|---|
 | 307 |                         done ; \
 | 
|---|
 | 308 |                 done ; \
 | 
|---|
 | 309 |         done
 | 
|---|
 | 310 | 
 | 
|---|
 | 311 | # Time attribution, with the IV for CFA_EXPANSIONS
 | 
|---|
 | 312 | # Runs the SUT under perf, then crunches the perf result
 | 
|---|
 | 313 | # Output file gets concatenation of perf summaries (several lines per run); program's output ignorred
 | 
|---|
 | 314 | # Expect and ignore output "addr2line: DWARF error: section .debug_info is larger than its filesize!"
 | 
|---|
| [e0350e0] | 315 | measurement4: $(MEASURE) corpori
 | 
|---|
 | 316 |         @echo "running $(words $(MEASURE)) programs:" $(MEASURE)
 | 
|---|
 | 317 |         @echo "... on $(words $(CORPORI)) corpori:" $(CORPORI)
 | 
|---|
 | 318 |         @echo "... with $(words $(CFA_EXPANSIONS)) expansions:" $(CFA_EXPANSIONS)
 | 
|---|
 | 319 |         @echo "... for $(shell expr $(words $(MEASURE)) "*" $(words $(CORPORI))) rows into:" $(MEASUREMENT_TOFILE)
 | 
|---|
 | 320 |         @RUNID=`date '+%F--%H-%M-%S'` ; \
 | 
|---|
| [08ed947] | 321 |         for prog in $(MEASURE) ; do \
 | 
|---|
 | 322 |             for corpus in $(CORPORI) ; do \
 | 
|---|
 | 323 |                         for expansion in $(CFA_EXPANSIONS) ; do \
 | 
|---|
| [7d02d35] | 324 |                                 SLUG=measurement--$$prog--$$corpus--$$expansion--$$RUNID ; \
 | 
|---|
| [08ed947] | 325 |                                 corpusbody=`cat $$corpus` ; \
 | 
|---|
| [7d02d35] | 326 |                                 perf record --call-graph dwarf -m16M ./$$prog 1000 1.006 $$expansion 10 $$corpusbody ; \
 | 
|---|
 | 327 |                                 mv perf.data $$SLUG.data ; \
 | 
|---|
 | 328 |                                 perf script -i $$SLUG.data > $$SLUG.perf ; \
 | 
|---|
 | 329 |                                 ~/flamegraph/FlameGraph/stackcollapse-perf.pl $$SLUG.perf > $$SLUG.folded ; \
 | 
|---|
 | 330 |                                 ~/flamegraph/FlameGraph/flamegraph.pl $$SLUG.folded > $$SLUG.svg ; \
 | 
|---|
| [e0350e0] | 331 |                                 python3 process-allocn-attrib.py $$SLUG.folded | xargs -L1 echo $$prog $$corpus $$expansion >> $(MEASUREMENT_TOFILE) ; \
 | 
|---|
| [08ed947] | 332 |                         done ; \
 | 
|---|
 | 333 |                 done ; \
 | 
|---|
 | 334 |         done
 | 
|---|
| [e0350e0] | 335 | 
 | 
|---|
 | 336 | 
 | 
|---|
 | 337 | #
 | 
|---|
 | 338 | # Experiment-specific "summary" targets
 | 
|---|
 | 339 | #
 | 
|---|
 | 340 | 
 | 
|---|
 | 341 | # These all use recursive make invocations, after setting the scoping variables.
 | 
|---|
 | 342 | # Recursive invocation necessary to recompute dependencies like corpori -> $(CORPORI).
 | 
|---|
 | 343 | # In the top-level make, the extent of the dependency is computed upfront, using
 | 
|---|
 | 344 | # default values, overridden by CLI-provided values.
 | 
|---|
 | 345 | # Setting the value per-target makes it available to other targets' bodies, but it
 | 
|---|
 | 346 | # does not affect the previously-computed dependencies.
 | 
|---|
 | 347 | # Exporting the values and working through a child make has the child intialize its
 | 
|---|
 | 348 | # dependencies using the summary-target-provided values.
 | 
|---|
 | 349 | # For that to work, the exported variable default values given above must use ?=.
 | 
|---|
 | 350 | 
 | 
|---|
 | 351 | .PHONY: result-append-pbv.csv result-allocate-speed-%.csv result-allocate-speed-cfa.csv
 | 
|---|
 | 352 | 
 | 
|---|
 | 353 | export OPERATIONS
 | 
|---|
 | 354 | export ALLOCS
 | 
|---|
 | 355 | export CFA_APILEVELS
 | 
|---|
 | 356 | export CFA_SHARINGS
 | 
|---|
 | 357 | export PLATFORMS
 | 
|---|
 | 358 | export CFA_EXPANSIONS
 | 
|---|
 | 359 | 
 | 
|---|
 | 360 | export CORPUS_MEANLEN_MODE
 | 
|---|
 | 361 | export CORPUS_MEANLEN_START
 | 
|---|
 | 362 | export CORPUS_MEANLEN_END
 | 
|---|
 | 363 | export CORPUS_MEANLEN_STEPS_PER_DOUBLE
 | 
|---|
 | 364 | export CORPUS_MEANLEN_MANVALS
 | 
|---|
 | 365 | export COPRUS_NSTRSS
 | 
|---|
 | 366 | export CORPUS_RELSCALES
 | 
|---|
 | 367 | export CORPUS_SEEDS
 | 
|---|
 | 368 | export CORPUS_OFFSET_INSTRS
 | 
|---|
 | 369 | 
 | 
|---|
 | 370 | 
 | 
|---|
 | 371 | export MEASUREMENT_TOFILE
 | 
|---|
 | 372 | 
 | 
|---|
 | 373 | result-ANY:
 | 
|---|
 | 374 |         $(MAKE) $(SUBTARGET)
 | 
|---|
 | 375 | 
 | 
|---|
 | 376 | result-append-pbv.csv: CFA_APILEVELS=ll
 | 
|---|
 | 377 | result-append-pbv.csv: OPERATIONS=pta peq pbv
 | 
|---|
 | 378 | result-append-pbv.csv: CORPUS_OFFSET_INSTRS=t0 l1
 | 
|---|
 | 379 | result-append-pbv.csv: CORPUS_MEANLEN_STEPS_PER_DOUBLE=4
 | 
|---|
 | 380 | result-append-pbv.csv: CORPUS_SEEDS=501 502
 | 
|---|
 | 381 | result-append-pbv.csv: SUBTARGET=measurement
 | 
|---|
 | 382 | result-append-pbv.csv: result-ANY
 | 
|---|
 | 383 |         cp $(MEASUREMENT_TOFILE) $@
 | 
|---|
 | 384 | 
 | 
|---|
 | 385 | result-allocate-ANY: OPERATIONS=pall
 | 
|---|
 | 386 | result-allocate-ANY: CORPUS_OFFSET_INSTRS=l15
 | 
|---|
 | 387 | result-allocate-ANY: CORPUS_MEANLEN_MODE=manual
 | 
|---|
 | 388 | result-allocate-ANY: CFA_SHARINGS=share
 | 
|---|
 | 389 | result-allocate-ANY: CORPUS_SEEDS=101 102 103 104 105
 | 
|---|
 | 390 | result-allocate-ANY: CFA_APILEVELS=ll
 | 
|---|
 | 391 | result-allocate-ANY: result-ANY
 | 
|---|
 | 392 | 
 | 
|---|
 | 393 | result-allocate-ANY-cfa: PLATFORMS=cfa
 | 
|---|
 | 394 | result-allocate-ANY-cfa: result-allocate-ANY
 | 
|---|
 | 395 | 
 | 
|---|
 | 396 | result-allocate-ANY-stl: PLATFORMS=stl
 | 
|---|
 | 397 | result-allocate-ANY-stl: CFA_EXPANSIONS=-1.0
 | 
|---|
 | 398 | result-allocate-ANY-stl: result-allocate-ANY
 | 
|---|
 | 399 | 
 | 
|---|
 | 400 | 
 | 
|---|
 | 401 | 
 | 
|---|
 | 402 | 
 | 
|---|
 | 403 | 
 | 
|---|
 | 404 | 
 | 
|---|
 | 405 | result-allocate-speed-cfa.csv: SUBTARGET=measurement2
 | 
|---|
 | 406 | result-allocate-speed-cfa.csv: result-allocate-ANY-cfa
 | 
|---|
 | 407 |         cp $(MEASUREMENT_TOFILE) $@
 | 
|---|
 | 408 | 
 | 
|---|
 | 409 | result-allocate-speed-stl.csv: SUBTARGET=measurement2
 | 
|---|
 | 410 | result-allocate-speed-stl.csv: result-allocate-ANY-stl
 | 
|---|
 | 411 |         cp $(MEASUREMENT_TOFILE) $@
 | 
|---|
 | 412 | 
 | 
|---|
 | 413 | # result-allocate-space-cfa.ssv: SUBTARGET=measurement3
 | 
|---|
 | 414 | # result-allocate-space-cfa.ssv: result-allocate-ANY-cfa
 | 
|---|
 | 415 | #       cp $(MEASUREMENT_TOFILE) $@
 | 
|---|
 | 416 | 
 | 
|---|
 | 417 | # result-allocate-space-stl.ssv: SUBTARGET=measurement3
 | 
|---|
 | 418 | # result-allocate-space-stl.ssv: result-allocate-ANY-stl
 | 
|---|
 | 419 | #       cp $(MEASUREMENT_TOFILE) $@
 | 
|---|
 | 420 | 
 | 
|---|
 | 421 | # result-allocate-attrib-cfa.ssv: SUBTARGET=measurement4
 | 
|---|
 | 422 | # result-allocate-attrib-cfa.ssv: result-allocate-ANY-cfa
 | 
|---|
 | 423 | #       cp $(MEASUREMENT_TOFILE) $@
 | 
|---|
 | 424 | 
 | 
|---|
 | 425 | # result-allocate-attrib-stl.ssv: SUBTARGET=measurement4
 | 
|---|
 | 426 | # result-allocate-attrib-stl.ssv: result-allocate-ANY-stl
 | 
|---|
 | 427 | #       cp $(MEASUREMENT_TOFILE) $@
 | 
|---|
 | 428 | 
 | 
|---|
 | 429 | 
 | 
|---|
 | 430 | 
 | 
|---|
 | 431 | 
 | 
|---|
 | 432 | 
 | 
|---|
 | 433 | 
 | 
|---|
 | 434 | 
 | 
|---|
 | 435 | # result-allocate-speed-%.csv: SUBTARGET=measurement2
 | 
|---|
 | 436 | # result-allocate-speed-%.csv: result-allocate-ANY-%
 | 
|---|
 | 437 | #       cp $(MEASUREMENT_TOFILE) $@
 | 
|---|
 | 438 | 
 | 
|---|
 | 439 | result-allocate-space-%.ssv: SUBTARGET=measurement3
 | 
|---|
 | 440 | result-allocate-space-%.ssv: result-allocate-ANY-%
 | 
|---|
 | 441 |         cp $(MEASUREMENT_TOFILE) $@
 | 
|---|
 | 442 | 
 | 
|---|
 | 443 | result-allocate-attrib-%.ssv: SUBTARGET=measurement4
 | 
|---|
 | 444 | result-allocate-attrib-%.ssv: result-allocate-ANY-%
 | 
|---|
 | 445 |         cp $(MEASUREMENT_TOFILE) $@
 | 
|---|
 | 446 | 
 | 
|---|
 | 447 | 
 | 
|---|
 | 448 | 
 | 
|---|
 | 449 | 
 | 
|---|
 | 450 | 
 | 
|---|
 | 451 | 
 | 
|---|
 | 452 | # .PHONY result-append-pbv.csv result-allocate-ANY-cfa result-allocate-speed-stl.csv
 | 
|---|
 | 453 | # result-allocate-space-cfa.csv
 | 
|---|
 | 454 | # result-allocate-space-stl.csv
 | 
|---|
 | 455 | # result-allocate-attrib-cfa.csv
 | 
|---|
 | 456 | # result-allocate-attrib-stl.csv
 | 
|---|