- Timestamp:
- Jun 4, 2025, 1:43:34 PM (6 months ago)
- Branches:
- master
- Children:
- f858ca5
- Parents:
- c8bdbaf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/mike_brooks_MMath/benchmarks/string/Makefile
rc8bdbaf re0350e0 10 10 # make measurement4 CFA_APILEVELS=ll OPERATIONS='pall' PLATFORMS=stl CFA_EXPANSIONS=-1.0 CORPORI='corpus-1-*-1.txt' # allocate-attrib-stl 11 11 12 CFABUILD = ~/cfa2/build-perf 13 LIBCFA = $(CFABUILD)/libcfa/*/src/.libs/libcfa.so 14 15 CFA = $(CFABUILD)/driver/cfa 12 LIBCFA = $(cfabuild)/libcfa/*/src/.libs/libcfa.so 13 14 CFA = $(cfabuild)/driver/cfa 16 15 PERFFLAGS_CFA = -nodebug -O2 17 16 PERFFLAGS_CXX = -DNDEBUG -O2 -Wl,--no-as-needed -ldl … … 20 19 # function: convert to upper case 21 20 define uc 22 $(shell echo $(1) | tr '[:lower:]' '[:upper:]') 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)) 23 29 endef 24 30 25 31 # function: project numbered element of filename named by hyphen-delimited tuple 26 # (call hyphProj,q-w-e-r.txt,1) is Q 27 define ucHyphProj 28 $(call uc,$(word $(2),$(subst -, ,$(basename $(1))))) 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)) 29 65 endef 30 66 … … 32 68 # (call hyphCross,a b c,1 2) is a-1 a-2 b-1 b-2 c-1 c-2 33 69 define hyphCross 34 $( foreach x,$(1),$(foreach xs,$(2),$(x)-$(xs)))70 $(call delCross,-,$1,$2) 35 71 endef 36 72 37 73 define hyphCross3 38 $(call hyphCross,$(1),$(call hyphCross,$(2),$(3)))74 $(call delCross3,-,$1,$2,$3) 39 75 endef 40 76 41 77 define hyphCross4 42 $(call hyphCross,$(1),$(call hyphCross3,$(2),$(3),$(4)))78 $(call delCross4,-,$1,$2,$3,$4) 43 79 endef 44 80 45 81 define hyphCross5 46 $(call hyphCross,$(1),$(call hyphCross4,$(2),$(3),$(4),$(5)))47 endef 48 49 OPERATIONS =pta peq pbv pall #pno50 ALLOCS =reuse fresh51 CFA_APILEVELS =hl ll52 CFA_SHARINGS =share noshare53 PLATFORMS =cfa stl #buhr9482 $(call delCross5,-,$1,$2,$3,$4,$5) 83 endef 84 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 54 90 55 91 ifneq ($(filter cfa,$(PLATFORMS)),) … … 69 105 OPERATIONS_USING_ALLOCS=pta peq 70 106 define enrichOperationsAllocs 71 $(call hyphCross3,$(filter peq pta,$(OPERATIONS)),$ (1),$(ALLOCS)) $(call hyphCross3,$(filter-out peq pta,$(OPERATIONS)),$(1),na)107 $(call hyphCross3,$(filter peq pta,$(OPERATIONS)),$1,$(ALLOCS)) $(call hyphCross3,$(filter-out peq pta,$(OPERATIONS)),$1,na) 72 108 endef 73 109 … … 84 120 echo -e '$(PP_SPLIT)' 85 121 86 perfexp-%.o: API=$(call uc HyphProj,$@,2)87 perfexp-%.o: OPERATION=$(call uc HyphProj,$@,3)88 perfexp-%.o: CFA_APILEVEL=$(call uc HyphProj,$@,4)89 perfexp-%.o: CFA_SHARING=$(call uc HyphProj,$@,5)90 perfexp-%.o: ALLOC=$(call uc HyphProj,$@,6)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) 91 127 perfexp-%.o: SCENARIO_SWITCH=-DIMPL_$(API)_$(CFA_APILEVEL)_$(CFA_SHARING) -DOP_$(OPERATION) -DALLOC_$(ALLOC) 92 128 … … 150 186 151 187 MEASURE = $(PERFPROGS) 152 CORPORI = corpus-100-*-1.txt 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) > $@ 153 246 154 247 RUN_TASKSET_CPULIST=6 155 248 249 # both ?= and := 250 ifeq ($(origin MEASUREMENT_TOFILE), undefined) 251 MEASUREMENT_TOFILE:=measurement-$(shell date '+%F--%H-%M-%S').output 252 endif 253 156 254 # General timing 157 # Output file gets concatenation of program outputs 158 measurement: $(MEASURE) 159 tofile=measurement-`date '+%F--%H-%M-%S'`.csv ; \ 160 echo $$tofile ; \ 161 for prog in $(MEASURE) ; do \ 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 \ 162 261 for corpus in $(CORPORI) ; do \ 163 262 corpusbody=`cat $$corpus` ; \ 164 263 resulttext=`taskset --cpu-list $(RUN_TASKSET_CPULIST) ./$$prog 100 10 $$corpusbody` ; \ 165 echo $$prog,$$corpus,$$resulttext >> $ $tofile; \264 echo $$prog,$$corpus,$$resulttext >> $(MEASUREMENT_TOFILE) ; \ 166 265 echo $$prog,$$corpus,$$resulttext ; \ 167 266 done ; \ 168 267 done 169 268 170 CFA_EXPANSIONS =0.02 0.05 0.1 0.2 0.4 0.5 0.9 0.98269 CFA_EXPANSIONS?=0.02 0.05 0.1 0.2 0.4 0.5 0.9 0.98 171 270 172 271 # Special-case timing with extra IV for CFA_EXPANSIONS 173 272 # Output file gets concatenation of program outputs (one line per run) 174 measurement2: $(MEASURE) 175 tofile=measurement-`date '+%F--%H-%M-%S'`.csv ; \ 176 for prog in $(MEASURE) ; do \ 177 for corpus in $(CORPORI) ; do \ 178 for expansion in $(CFA_EXPANSIONS) ; do \ 179 corpusbody= ; \ 180 echo ./$$prog 1000 1.006 $$expansion 10 \`cat $$corpus\` ; \ 181 done ; \ 182 done ; \ 183 done ; \ 184 echo $$tofile ; \ 185 for prog in $(MEASURE) ; do \ 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 \ 186 279 for corpus in $(CORPORI) ; do \ 187 280 for expansion in $(CFA_EXPANSIONS) ; do \ 188 281 corpusbody=`cat $$corpus` ; \ 189 printed=` ./$$prog 1000 1.006 $$expansion 10 $$corpusbody` ; \190 echo $$prog,$$corpus,$$expansion,$$printed >> $ $tofile; \282 printed=`taskset --cpu-list $(RUN_TASKSET_CPULIST) ./$$prog 1000 1.006 $$expansion 10 $$corpusbody` ; \ 283 echo $$prog,$$corpus,$$expansion,$$printed >> $(MEASUREMENT_TOFILE) ; \ 191 284 echo $$prog,$$corpus,$$expansion,$$printed ; \ 192 285 done ; \ … … 195 288 196 289 # Space, with the IV for CFA_EXPANSIONS 197 # Runs Mubeen's malloc interceptor to get malloc-request stat e290 # Runs Mubeen's malloc interceptor to get malloc-request stats 198 291 # Output file gets concatenation of the interceptor's output (one line per run); program's output ignorred 199 292 # Expect and ignore crashes; they're during shutdown, after everything we care about is over 200 measurement3: $(MEASURE) 201 tofile=measurement-`date '+%F--%H-%M-%S'`.ssv ; \ 202 for prog in $(MEASURE) ; do \ 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 \ 203 299 for corpus in $(CORPORI) ; do \ 204 300 for expansion in $(CFA_EXPANSIONS) ; do \ … … 206 302 LD_PRELOAD=~/plg2/mubeen-stat-shim/malloc/mallocWrappers.so ./$$prog 1000 1.006 $$expansion 10 $$corpusbody ; \ 207 303 printed=`tail -n 1 preload_dump.txt` ; \ 208 echo $$prog $$corpus $$expansion $$printed >> $ $tofile; \304 echo $$prog $$corpus $$expansion $$printed >> $(MEASUREMENT_TOFILE) ; \ 209 305 echo $$prog $$corpus $$expansion $$printed ; \ 210 306 rm preload_dump.txt ; \ … … 217 313 # Output file gets concatenation of perf summaries (several lines per run); program's output ignorred 218 314 # Expect and ignore output "addr2line: DWARF error: section .debug_info is larger than its filesize!" 219 measurement4: $(MEASURE) 220 RUNID=`date '+%F--%H-%M-%S'` ; \ 221 tofile=measurement-$$RUNID.ssv ; \ 222 echo $$tofile ; \ 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'` ; \ 223 321 for prog in $(MEASURE) ; do \ 224 322 for corpus in $(CORPORI) ; do \ … … 231 329 ~/flamegraph/FlameGraph/stackcollapse-perf.pl $$SLUG.perf > $$SLUG.folded ; \ 232 330 ~/flamegraph/FlameGraph/flamegraph.pl $$SLUG.folded > $$SLUG.svg ; \ 233 python3 process-allocn-attrib.py $$SLUG.folded | xargs -L1 echo $$prog $$corpus $$expansion >> $ $tofile; \331 python3 process-allocn-attrib.py $$SLUG.folded | xargs -L1 echo $$prog $$corpus $$expansion >> $(MEASUREMENT_TOFILE) ; \ 234 332 done ; \ 235 333 done ; \ 236 334 done 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
Note:
See TracChangeset
for help on using the changeset viewer.