Changeset 1eea589f
- Timestamp:
- Jul 27, 2025, 2:48:31 PM (7 weeks ago)
- Branches:
- master
- Children:
- b9d1242
- Parents:
- da10157 (diff), 7806f91 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 69 added
- 2 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/mike_brooks_MMath/benchmarks/list/Makefile
rda10157 r1eea589f 9 9 # make results-latest.csv OP_MOVEMENTS=stack OP_POLARITIES=insfirst OP_ACCESSORS=allhead RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=thorough 10 10 # cp results-latest.csv results-sizing.csv 11 # make results-latest.csv OP_MOVEMENTS=queue OP_POLARITIES=inslast OP_ACCESSORS=remelem RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=thorough 12 # cp results-latest.csv results-sizing-b.csv 13 # make results-latest.csv RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=moderate FX_SOLUTIONS='lq-tailq lq-list cfa-cfa upp-upp' 14 # cp results-latest.csv results-intrsv-cube.csv 11 15 12 16 CFA = cfa 17 CC = gcc-11 13 18 CXX = g++-11 14 19 UXX = ~/u++/u++-7.0.0/bin/u++ … … 18 23 RUN_NUM_REPS=3 19 24 RUN_DATA_SIZE_MODE=none 20 RUN_DURATION_SEC =525 RUN_DURATION_SEC?=5 21 26 RUN_TASKSET_CPULIST=6 22 27 … … 25 30 PERFFLAGS_CC = -DNDEBUG -O3 26 31 else ifeq "$(MODE)" "correctness" 27 PERFFLAGS_CFA = -O0 -g - debug32 PERFFLAGS_CFA = -O0 -g -nodebug -D__CFA_DEBUG__ # shortcut for not also building debug cfa 28 33 PERFFLAGS_CC = -O0 -g 29 34 else … … 66 71 OP_POLARITIES=insfirst inslast 67 72 OP_ACCESSORS=allhead inselem remelem 68 FX_SOLUTIONS=lq-tailq lq-list cfa-cfa upp-upp cpp-stlref 73 RUN_INTERLEAVE_PCTS=0 74 75 76 FX_SOLUTIONS=lq-tailq lq-list cfa-cfa cfa-mandHead cfa-noListed cfa-noIter cfa-likeLq cfa-strip upp-upp cpp-stlref 69 77 70 78 OPS=$(call cross3,-,$(OP_MOVEMENTS),$(OP_POLARITIES),$(OP_ACCESSORS)) … … 124 132 $(COMPILER) $(EXTRA_COMP_FLAGS) -c $< $(OP_DEFINES) -include op-$(OP).h -include fx-$(FX).h -o $@ -MMD 125 133 126 sayhi: 127 echo $(PERFPROGS) 128 129 130 ifeq "$(RUN_DATA_SIZE_MODE)" "common5" 131 RUN_DATA_SIZES=\ 134 135 # troubleshooting, e.g. `make echo_DEMOS` runs `echo $(DEMOS)` 136 echo_% : 137 @echo '$($(@:echo_%=%))' 138 139 140 141 142 # ifeq "$(RUN_DATA_SIZE_MODE)" "common5" 143 # RUN_DATA_SIZES=\ 144 # 7-1000000 \ 145 # 71-100000 \ 146 # 809-10000 \ 147 # 9051-1000 \ 148 # 72421-100 149 # else ifeq "$(RUN_DATA_SIZE_MODE)" "thorough" 150 # RUN_DATA_SIZES=\ 151 # 1-1000000 \ 152 # 2-1000000 \ 153 # 3-1000000 \ 154 # 5-1000000 \ 155 # 7-1000000 \ 156 # 11-100000 \ 157 # 13-100000 \ 158 # 19-100000 \ 159 # 29-100000 \ 160 # 37-100000 \ 161 # 53-100000 \ 162 # 71-100000 \ 163 # 101-10000 \ 164 # 149-10000 \ 165 # 211-10000 \ 166 # 283-10000 \ 167 # 401-10000 \ 168 # 569-10000 \ 169 # 809-10000 \ 170 # 1151-1000 \ 171 # 1601-1000 \ 172 # 2267-1000 \ 173 # 3203-1000 \ 174 # 4547-1000 \ 175 # 6473-1000 \ 176 # 9051-1000 \ 177 # 12809-100 \ 178 # 18119-100 \ 179 # 25601-100 \ 180 # 36209-100 \ 181 # 51203-100 \ 182 # 72421-100 \ 183 # 102407-10 \ 184 # 144817-10 \ 185 # 204803-10 \ 186 # 289637-10 \ 187 # 409609-10 \ 188 # 579263-10 \ 189 # 819229-10 \ 190 # 1158613-1 \ 191 # 1638431-1 \ 192 # 2317057-1 \ 193 # 3276803-1 \ 194 # 4634111-1 \ 195 # 6553621-1 \ 196 # 9268211-1 197 # else ifeq "$(RUN_DATA_SIZE_MODE)" "bignquick" 198 # RUN_DATA_SIZES=\ 199 # 3-1000000 \ 200 # 29-100000 \ 201 # 283-10000 \ 202 # 3203-1000 \ 203 # 25601-100 \ 204 # 289637-10 \ 205 # 1000000-1 \ 206 # 3276803-1 \ 207 # 10000000-1 208 # else ifeq "$(RUN_DATA_SIZE_MODE)" "bignthorough" 209 # RUN_DATA_SIZES=\ 210 # 1-1000000 \ 211 # 3-1000000 \ 212 # 7-1000000 \ 213 # 13-100000 \ 214 # 29-100000 \ 215 # 53-100000 \ 216 # 101-10000 \ 217 # 211-10000 \ 218 # 401-10000 \ 219 # 809-10000 \ 220 # 1601-1000 \ 221 # 3203-1000 \ 222 # 6473-1000 \ 223 # 12809-100 \ 224 # 25601-100 \ 225 # 51203-100 \ 226 # 102407-10 \ 227 # 204803-10 \ 228 # 409609-10 \ 229 # 819229-10 \ 230 # 1638431-1 \ 231 # 3276803-1 \ 232 # 6553621-1 \ 233 # 12809000-1 \ 234 # 25601000-1 \ 235 # 51203000-1 \ 236 # 102407000-1 \ 237 # 204803000-1 \ 238 # 409609000-1 239 # else ifeq "$(RUN_DATA_SIZE_MODE)" "moderate" 240 # RUN_DATA_SIZES=\ 241 # 1-1000000 \ 242 # 3-1000000 \ 243 # 7-1000000 \ 244 # 13-100000 \ 245 # 29-100000 \ 246 # 53-100000 \ 247 # 101-10000 \ 248 # 211-10000 \ 249 # 401-10000 \ 250 # 1601-1000 \ 251 # 6473-1000 \ 252 # 25601-100 253 # else ifeq "$(RUN_DATA_SIZE_MODE)" "sweetspot" 254 # RUN_DATA_SIZES=\ 255 # 1-1000000 \ 256 # 2-1000000 \ 257 # 3-1000000 \ 258 # 5-1000000 \ 259 # 7-1000000 \ 260 # 11-100000 \ 261 # 13-100000 \ 262 # 19-100000 \ 263 # 29-100000 \ 264 # 37-100000 \ 265 # 53-100000 \ 266 # 71-100000 \ 267 # 101-10000 \ 268 # 149-10000 269 # else ifeq "$(RUN_DATA_SIZE_MODE)" "manual" 270 # ifeq "$(RUN_DATA_SIZES)" "" 271 # $(error RUN_DATA_SIZE_MODE is manual but RUN_DATA_SIZES not given) 272 # endif 273 # else ifeq "$(RUN_DATA_SIZE_MODE)" "none" 274 # # Assume user manages RUN_ARGS; empty RUN_ARGS just means run with compiled-in defaults 275 # RUN_DATA_SIZES=none 276 # else 277 # $(error Bad RUN_DATA_SIZE_MODE ($(RUN_DATA_SIZE_MODE)); should be common5, thorough or manual) 278 # endif 279 280 281 ifeq "$(RUN_DATA_SIZE_MODE)" "manual" 282 ifeq "$(RUN_DATA_SIZES)" "" 283 $(error RUN_DATA_SIZE_MODE is manual but RUN_DATA_SIZES not given) 284 endif 285 endif 286 287 RUN_DATA_SIZES = \ 288 $(if $(filter $(RUN_DATA_SIZE_MODE),common5), \ 132 289 7-1000000 \ 133 290 71-100000 \ 134 291 809-10000 \ 135 292 9051-1000 \ 136 72421-100 137 else ifeq "$(RUN_DATA_SIZE_MODE)" "thorough" 138 RUN_DATA_SIZES=\ 293 72421-100 \ 294 , $(if $(filter $(RUN_DATA_SIZE_MODE),thorough), \ 295 1-1000000 \ 296 2-1000000 \ 297 3-1000000 \ 298 5-1000000 \ 139 299 7-1000000 \ 140 300 11-100000 \ … … 178 338 4634111-1 \ 179 339 6553621-1 \ 180 9268211-1 181 else ifeq "$(RUN_DATA_SIZE_MODE)" "manual" 182 ifeq "$(RUN_DATA_SIZES)" "" 183 $(error RUN_DATA_SIZE_MODE is manual but RUN_DATA_SIZES not given) 184 endif 185 else ifeq "$(RUN_DATA_SIZE_MODE)" "none" 186 # Assume user manages RUN_ARGS; empty RUN_ARGS just means run with compiled-in defaults 187 RUN_DATA_SIZES=none 188 else 189 $(error Bad RUN_DATA_SIZE_MODE ($(RUN_DATA_SIZE_MODE)); should be common5, thorough or manual) 190 endif 340 9268211-1 \ 341 , $(if $(filter $(RUN_DATA_SIZE_MODE),bignquick), \ 342 3-1000000 \ 343 29-100000 \ 344 283-10000 \ 345 3203-1000 \ 346 25601-100 \ 347 289637-10 \ 348 1000000-1 \ 349 3276803-1 \ 350 10000000-1 \ 351 , $(if $(filter $(RUN_DATA_SIZE_MODE),bignthorough), \ 352 1-1000000 \ 353 3-1000000 \ 354 7-1000000 \ 355 13-100000 \ 356 29-100000 \ 357 53-100000 \ 358 101-10000 \ 359 211-10000 \ 360 401-10000 \ 361 809-10000 \ 362 1601-1000 \ 363 3203-1000 \ 364 6473-1000 \ 365 12809-100 \ 366 25601-100 \ 367 51203-100 \ 368 102407-10 \ 369 204803-10 \ 370 409609-10 \ 371 819229-10 \ 372 1638431-1 \ 373 3276803-1 \ 374 6553621-1 \ 375 12809000-1 \ 376 25601000-1 \ 377 51203000-1 \ 378 102407000-1 \ 379 204803000-1 \ 380 409609000-1 \ 381 , $(if $(filter $(RUN_DATA_SIZE_MODE),moderate), \ 382 1-1000000 \ 383 3-1000000 \ 384 7-1000000 \ 385 13-100000 \ 386 29-100000 \ 387 53-100000 \ 388 101-10000 \ 389 211-10000 \ 390 401-10000 \ 391 1601-1000 \ 392 6473-1000 \ 393 25601-100 \ 394 , $(if $(filter $(RUN_DATA_SIZE_MODE),sweetspot), \ 395 1-1000000 \ 396 2-1000000 \ 397 3-1000000 \ 398 5-1000000 \ 399 7-1000000 \ 400 11-100000 \ 401 13-100000 \ 402 19-100000 \ 403 29-100000 \ 404 37-100000 \ 405 53-100000 \ 406 71-100000 \ 407 101-10000 \ 408 149-10000 \ 409 , $(if $(filter $(RUN_DATA_SIZE_MODE),none), \ 410 , $(error Bad RUN_DATA_SIZE_MODE ($(RUN_DATA_SIZE_MODE)); see list of accepted values in Makefile's RUN_DATA_SIZES defimition) \ 411 ))))))) 191 412 192 413 RUN_REP_IDS=$(shell echo {1..$(RUN_NUM_REPS)}) # 1 2 3 193 RUN_REP_EXTS=$(call cross3,,run,$(RUN_REP_IDS),.1csv) # run1.1csv run2.1cav run3.1csv 194 195 RUN_LAUNCHES=$(call cross,--,$(RUN_DATA_SIZES),$(RUN_REP_EXTS)) 196 414 RUN_REP_EXTS=$(call cross3,,run,$(RUN_REP_IDS),.1csv) # run1.1csv run2.1csv run3.1csv 415 416 RUN_LAUNCHES=$(call cross3,--,$(RUN_DATA_SIZES),$(RUN_INTERLEAVE_PCTS),$(RUN_REP_EXTS)) 197 417 198 418 … … 207 427 %.1csv : NUMNODES=$(call proj,-,$(SIZING),1) 208 428 %.1csv : CHECKDONE=$(call proj,-,$(SIZING),2) 209 %.1csv : REP_ID=$(subst run,,$(call proj,--,$(LAUNCH),2)) 210 %.1csv : RUN_ARGS=$(if $(filter none,$(SIZING)),,$(RUN_DURATION_SEC) $(CHECKDONE) $(NUMNODES) -1 $(REP_ID)) # use REP_ID as seed 429 %.1csv : RUN_INTERLEAVE_PCT=$(call proj,--,$(LAUNCH),2) 430 %.1csv : RUN_INTERLEAVE_FRAC=$(shell echo "scale=2; $(RUN_INTERLEAVE_PCT) / 100" | bc) 431 %.1csv : REP_ID=$(subst run,,$(call proj,--,$(LAUNCH),3)) 432 %.1csv : SEED=$(REP_ID) 433 %.1csv : RUN_ARGS=$(if $(filter none,$(SIZING)),,$(RUN_DURATION_SEC) $(CHECKDONE) $(NUMNODES) -1 $(SEED) $(RUN_INTERLEAVE_FRAC)) # use REP_ID as seed 211 434 %.1csv : REP_TIME=$(shell date '+%F %H:%M:%S') 212 435 %.1csv : perfprogs FORCE 213 taskset --cpu-list $(RUN_TASKSET_CPULIST) ./perfexp--$(CORE) $(RUN_ARGS) | xargs -n 1 printf '%s,%s,%s,%s\n' "$(REP_TIME)" "$(REP_ID)" "$(RUN_ARGS)" | tee $@436 taskset --cpu-list $(RUN_TASKSET_CPULIST) ./perfexp--$(CORE) $(RUN_ARGS) | xargs -n 1 printf '%s,%s,%s,%s\n' "$(REP_TIME)" "$(REP_ID)" "$(RUN_ARGS)" | tee -a $(RESULT) 214 437 215 438 216 439 BATCHTIME=$(shell date '+%F--%H-%M-%S') 217 218 results--$(BATCHTIME).csv : $(RESULT1S_SHUFD) 219 cat $^ | tee $@ 220 rm $^ 221 222 results-latest.csv : results--$(BATCHTIME).csv 440 RESULT=results--$(BATCHTIME).csv 441 442 sub_make=$(MAKE) --no-print-directory $(1); cat $(1) >> $(2); rm $(1); 443 444 445 export RESULT1S_SHUFD # used by sh loop in $(RESULT) recipe 446 export RUN_DURATION_SEC # used by sub make; occurs free in %.1csv's variable bindings (not extracted from target name) 447 448 449 NTESTS=$(words $(RESULT1S_SHUFD)) 450 RUNDUR = $(shell expr $(NTESTS) \* $(RUN_DURATION_SEC)) 451 ETA = $(shell date -d "+$(RUNDUR) seconds" +"%H:%M:%S") 452 453 $(RESULT) : 454 @echo running $(NTESTS) tests, eta $(ETA) 455 for r in $$RESULT1S_SHUFD; do $(MAKE) --no-print-directory RESULT=$(RESULT) $$r; done 456 457 results-latest.csv : $(RESULT) 223 458 rm -f $@ 224 459 ln -s $< $@ … … 237 472 238 473 -include *.d 474 475 results-general.csv: FORCE 476 $(MAKE) results-latest.csv RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=sweetspot OP_ACCESSORS=remelem RUN_INTERLEAVE_PCTS='0 50' FX_SOLUTIONS='lq-tailq lq-list cfa-cfa cfa-mandHead' 477 cat results-latest.csv >> $@ 478 $(MAKE) results-latest.csv RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=sweetspot OP_ACCESSORS='allhead inselem' RUN_INTERLEAVE_PCTS='0' FX_SOLUTIONS='lq-tailq lq-list cfa-cfa cfa-mandHead' 479 cat results-latest.csv >> $@ 480 $(MAKE) results-latest.csv RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=sweetspot OP_ACCESSORS=remelem RUN_INTERLEAVE_PCTS='0 50' FX_SOLUTIONS='cfa-noListed cfa-noIter cfa-likeLq' 481 cat results-latest.csv >> $@ 482 $(MAKE) results-latest.csv RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=sweetspot OP_ACCESSORS='allhead inselem' RUN_INTERLEAVE_PCTS='0' FX_SOLUTIONS='cfa-noListed cfa-noIter cfa-likeLq' 483 cat results-latest.csv >> $@ 484 $(MAKE) results-latest.csv RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=sweetspot OP_ACCESSORS=remelem RUN_INTERLEAVE_PCTS='0 50' FX_SOLUTIONS='cfa-strip upp-upp cpp-stlref' 485 cat results-latest.csv >> $@ 486 $(MAKE) results-latest.csv RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=sweetspot OP_ACCESSORS='allhead inselem' RUN_INTERLEAVE_PCTS='0' FX_SOLUTIONS='cfa-strip upp-upp cpp-stlref' 487 cat results-latest.csv >> $@ 488 489 results-zoomout-noshuf.csv: FORCE 490 @echo Do we need to make for tiny user iters? If so: 491 @echo make clean 492 @echo make perfprogs CFA=$$cfa EXTRA_COMP_FLAGS=-DTINY_USER_ITEMS -j8 493 make results-latest.csv RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=bignthorough OPS=stack-insfirst-allhead FX_SOLUTIONS='lq-tailq cfa-cfa upp-upp cpp-stlref cfa-strip' SEED=-1 494 cp results-latest.csv $@ 495 496 results-zoomout-shuf.csv: FORCE 497 @echo Do we need to make for tiny user iters? If so: 498 @echo make clean 499 @echo make perfprogs CFA=$$cfa EXTRA_COMP_FLAGS=-DTINY_USER_ITEMS -j8 500 make results-latest.csv RUN_DURATION_SEC=5 RUN_NUM_REPS=5 RUN_DATA_SIZE_MODE=bignthorough OPS=stack-insfirst-allhead FX_SOLUTIONS='lq-tailq cfa-cfa upp-upp cpp-stlref cfa-strip' 501 cp results-latest.csv $@ 502 503 thesis: results-general.csv results-zoomout-noshuf.csv results-zoomout-shuf.csv 504 505 # matches peter's "random" 506 results-smoketest.csv: RUN_DATA_SIZE_MODE=bignquick 507 results-smoketest.csv: RUN_NUM_REPS=1 508 results-smoketest.csv: RUN_DURATION_SEC=1 509 results-smoketest.csv: OP_MOVEMENTS=stack 510 results-smoketest.csv: OP_POLARITIES=insfirst 511 results-smoketest.csv: OP_ACCESSORS=allhead 512 results-smoketest.csv: $(RESULT) 513 mv $< $@ -
doc/theses/mike_brooks_MMath/benchmarks/list/driver.c
rda10157 r1eea589f 6 6 #include "observation.h" 7 7 8 #ifdef TINY_USER_ITEMS 9 #define UDATA_T char 10 #define UDATA_LEN 1 11 #define UDATA_USE_POS 0 12 #else 13 #define UDATA_T int 14 #define UDATA_LEN 64 15 #define UDATA_USE_POS 17 16 #endif 17 8 18 typedef struct B_UserItem 9 19 BFX_EXTRUSION_DECL(B_UserItem) 10 20 { 11 21 BFX_INTRUSION(B_UserItem) 12 int userdata[64];22 UDATA_T userdata[ UDATA_LEN ]; 13 23 } 14 24 B_UserItem; … … 18 28 #if defined(NDEBUG) || (defined(__cforall) && !defined(__CFA_DEBUG__)) 19 29 enum { DefaultNumNodes = 1000, DefaultExperimentDurSec = 1, DefaultCheckDonePeriod = 1000, DefaultExperimentDurOpCount = -1, DefaultSeed = 5 }; 30 const double DefaultInterleaveFrac = 0.0; 20 31 #define TRACE(tp) 21 32 #else 22 33 enum { DefaultNumNodes = 10, DefaultExperimentDurSec = 1, DefaultCheckDonePeriod = 2, DefaultExperimentDurOpCount = 20, DefaultSeed = 5 }; 34 const double DefaultInterleaveFrac = 0.5; 23 35 static const char * tp_filter 24 36 // = ""; … … 39 51 static BFX_LIST_HEAD_T(B_UserItem) lst; 40 52 41 42 53 MAYBE_EXTERN_C ( 43 54 … … 45 56 volatile unsigned int bobs_prog_inserting = 0; 46 57 volatile unsigned int bobs_prog_removing = 0; 58 volatile unsigned int bobs_prog_removing_end = 0; 47 59 volatile unsigned int bobs_prog_rollover_flag = 0; 60 // bobs_prog_rem_pos (defined after BOP_REMPROGEND_IS_REMNO_BASED) 48 61 49 62 void bobs_seek(unsigned int i) { … … 68 81 int bobs_getCurrentVal() { 69 82 B_UserItem * curUI = BFX_DEREF_POS(B_UserItem, lst, observedItem); 70 return curUI->userdata[ 17];83 return curUI->userdata[ UDATA_USE_POS ]; 71 84 } 72 85 … … 75 88 ) 76 89 90 91 // Remove progress end (number) is based (upon) remove-number 92 // True when an OP's REMELEM used remNo to choose which element to remove 93 // False otherwise; notably including when REMELEM just bases upon first/last 94 // Default to false. 95 #ifndef BOP_REMPROGEND_IS_REMNO_BASED 96 #define BOP_REMPROGEND_IS_REMNO_BASED false 97 #endif 98 MAYBE_EXTERN_C ( 99 volatile unsigned int const * bobs_prog_rem_pos 100 = BOP_REMPROGEND_IS_REMNO_BASED ? & bobs_prog_removing_end : & bobs_prog_removing; 101 ) 102 77 103 unsigned int uDefaultPreemption() { 78 104 return 0; … … 81 107 int main(int argc, const char *argv[]) { 82 108 83 const char * usage_args = "[ExperimentDurSec [CheckDonePeriod [NumNodes [ExperimentDurOpCount [Seed ]]]]]";84 const int static_arg_posns = 5;109 const char * usage_args = "[ExperimentDurSec [CheckDonePeriod [NumNodes [ExperimentDurOpCount [Seed [InterleaveFrac]]]]]]"; 110 const int static_arg_posns = 6; 85 111 86 112 unsigned int ExperimentDurSec = DefaultExperimentDurSec; … … 89 115 size_t ExperimentDurOpCount = DefaultExperimentDurOpCount; 90 116 unsigned int Seed = DefaultSeed; 117 double InterleaveFrac = DefaultInterleaveFrac; 91 118 92 119 switch (((argc - 1) < static_arg_posns) ? (argc - 1) : static_arg_posns) { 120 case 6: InterleaveFrac = atof(argv[6]); 93 121 case 5: Seed = atoi(argv[5]); 94 122 case 4: ExperimentDurOpCount = atol(argv[4]); … … 98 126 } 99 127 128 // printf("ExperimentDurSec=%d, CheckDonePeriod=%d, NumNodes=%d, ExperimentDurOpCount=%zd, Seed=%d,\n", 129 // ExperimentDurSec, CheckDonePeriod, NumNodes, ExperimentDurOpCount, Seed ); 130 100 131 if (ExperimentDurSec == 0 || CheckDonePeriod == 0 || NumNodes == 0 || ExperimentDurOpCount == 0 || Seed == 0 ) { 101 132 printf("usage: %s %s\n", argv[0], usage_args); … … 110 141 #endif 111 142 143 // Shuffling makes listed items' physical order in memory different from their order within to the list. 144 // Affects insertion: next item to insert picked through insertOrdShuf. 112 145 #ifdef DISABLE_SHUFFLING_INDIRECTION 113 146 #define INSERTPOS(insertNum) insertNum … … 138 171 #endif 139 172 173 // Interleaving affects the list position where an element-oriented operation occurs: at an end vs. in the middle. 174 // Perterbs the sequence of logical insert/remove numbers presented to the OP cartridge, e.g. from [0 1 2 3 4 5 6] 175 // to [3 0 4 1 5 2 6], which is [mid end mid end mid end solo], for a perfect-alternation interleave; except that the 176 // end/mid interleave is atually selected randomly. 177 #ifdef DISABLE_INTERLEAVING 178 #define nextInterleave 0 179 printf("interleave key %x\n", 0); 180 #else 181 const unsigned int INTRL_KEYLEN = 64; 182 unsigned char interleaveKey[INTRL_KEYLEN]; 183 unsigned char nextInterleavePos = 0; 184 { 185 unsigned int numOnes = INTRL_KEYLEN * InterleaveFrac; 186 unsigned int numZeros = INTRL_KEYLEN - numOnes; 187 // generate randomly drawn 0/1 188 memset( interleaveKey , 0, numZeros ); // zeros then ones 189 memset( interleaveKey+numZeros, 1, numOnes ); 190 for (unsigned int i = 0; i < 64; i++) { // shuffle it 191 unsigned int nodesRemaining = 64 - i; 192 unsigned int swapWith = i + rand() % nodesRemaining; 193 unsigned char tempValue = interleaveKey[swapWith]; 194 interleaveKey[swapWith] = interleaveKey[i]; 195 interleaveKey[i] = tempValue; 196 } 197 #define nextInterleave (interleaveKey[nextInterleavePos = (nextInterleavePos + 1) % 64]) 198 } 199 { 200 unsigned int z = 0, o = 0; 201 for ( int i = 0; i < INTRL_KEYLEN; i++ ) { 202 if (interleaveKey[i]) o++; 203 else z++; 204 } 205 // printf("Interleaving with %u in middle and %u at end\n", o, z); 206 } 207 // printf("interleave key begins %016llx\n", *(unsigned long long*)interleaveKey); 208 // printf("interleave key begins %016llx\n", *(unsigned long long*)(interleaveKey+8)); 209 // printf("sample interleave value %d\n", nextInterleave); 210 // printf("sample interleave value %d\n", nextInterleave); 211 // printf("sample interleave value %d\n", nextInterleave); 212 // printf("sample interleave value %d\n", nextInterleave); 213 // printf("sample interleave value %d\n", nextInterleave); 214 // printf("sample interleave value %d\n", nextInterleave); 215 // printf("sample interleave value %d\n", nextInterleave); 216 // printf("sample interleave value %d\n", nextInterleave); 217 // printf("sample interleave value %d\n", nextInterleave); 218 // printf("sample interleave value %d\n", nextInterleave); 219 // printf("sample interleave value %d\n", nextInterleave); 220 // printf("sample interleave value %d\n", nextInterleave); 221 #endif 222 140 223 ui = (B_UserItem*) malloc( (size_t)NumNodes * (size_t)sizeof(B_UserItem) ); 141 224 if (!ui) { … … 152 235 memset(listedItems, 0, (size_t)NumNodes * (size_t)sizeof(BFX_LISTED_ELEM_T(B_UserItem))); 153 236 154 // Fill with demo data237 // Construct and fill with demo data 155 238 for (unsigned int i = 0; i < NumNodes; i++) { 156 239 B_UserItem * curUI = & ui[INSERTPOS(i)]; 157 curUI->userdata[17] = i; 240 #ifdef __cforall 241 (*curUI){}; 242 #endif 243 curUI->userdata[ UDATA_USE_POS ] = i; 158 244 } 159 245 … … 166 252 // lst lvalue of the list head being added to / removed from 167 253 // iters array of ADD return values, in logical-insert order; on ADD, is valid at [0..insNo) 168 // insNo counter of the ADD calls (logical insert number)169 // remNo counter of the REM calls (logical remove number)254 // insNo interleave-perterbed counter of the ADD calls (logical insert number) 255 // remNo interleave-perterbed counter of the REM calls (logical remove number) 170 256 // item lvalue of the item being added 171 257 // Logical insert number 0 and remove number n-1 are given with a distinguished hook. … … 186 272 double elapsed_sec = 0; 187 273 clock_t start = clock(); 274 275 const unsigned int numMiddleNodes = (NumNodes-1) * InterleaveFrac; 276 const unsigned int numEndNodes = NumNodes - numMiddleNodes - 1; 277 278 // printf("Running with %u in the middle and %u at end\n", numMiddleNodes, numEndNodes); 279 280 const unsigned int removeBase[] = {0, numEndNodes}; 281 const unsigned int removeLimit[] = {numEndNodes, numMiddleNodes}; 188 282 189 283 size_t privateOpsCompleted = 0; … … 191 285 while (elapsed_sec <= (double) ExperimentDurSec && privateOpsCompleted < ExperimentDurOpCount) { 192 286 for ( int t = 0; t < CheckDonePeriod; t += 1 ) { 193 TRACE('a') 287 TRACE('a') // insert special first 194 288 listedItems[0] = 195 289 BOP_INIT(lst, listedItems, 0, ui[INSERTPOS(0)]); 196 TRACE('b') 290 TRACE('b') // insert general 197 291 for ( int privateCurInsert = 1; 198 292 (bobs_prog_inserting = privateCurInsert, privateCurInsert < NumNodes); … … 204 298 TRACE('+') 205 299 } 206 TRACE('c') 207 for ( int privateCurRemove = 1; 208 (bobs_prog_removing = privateCurRemove, privateCurRemove < NumNodes); 209 privateCurRemove += 1 300 TRACE('c') // remove general 301 int removeProgress[] = { 0, 0 }; 302 for ( int flip = 0; 303 (bobs_prog_removing = removeProgress[0] + removeProgress[1] + 1, 304 bobs_prog_removing_end = removeProgress[0] + 1, 305 flip = nextInterleave, 306 removeProgress[0] < removeLimit[0] && removeProgress[1] < removeLimit[1] ); 307 removeProgress[flip] += 1 210 308 ) { 211 309 TRACE('-') 212 BOP_REMOVE( lst, listedItems, privateCurRemove-1);310 BOP_REMOVE( lst, listedItems, removeBase[flip]+removeProgress[flip] ); 213 311 TRACE('+') 214 312 } 215 TRACE('D') 313 TRACE('X') // remove imbalanced 314 // most work done under general; it stops when either flip-side's work finishes 315 // now drain any any stragglers so both flip-sides' work finishes 316 for ( int flip = 0; flip < 2; flip ++ ) { 317 for ( ; (bobs_prog_removing = removeProgress[0] + removeProgress[1] + 1, 318 bobs_prog_removing_end = removeProgress[0] + 1, 319 removeProgress[flip] < removeLimit[flip] ) 320 ; removeProgress[flip] += 1 321 ) { 322 TRACE('-') 323 BOP_REMOVE( lst, listedItems, removeBase[flip]+removeProgress[flip] ); 324 TRACE('+') 325 } 326 } 327 TRACE('D') // remove special last 216 328 BOP_TEARDOWN(lst, listedItems, NumNodes-1); 217 329 TRACE('d') … … 222 334 TRACE('e') 223 335 bobs_prog_inserting = 0; 224 bobs_prog_removing = 0; 336 bobs_prog_removing = 0; 337 bobs_prog_removing_end = 0; 225 338 bobs_ops_completed = privateOpsCompleted; 226 339 TRACE('f') … … 245 358 free(ui); 246 359 free(listedItems); 360 #ifndef DISABLE_SHUFFLING_INDIRECTION 247 361 free(insertOrdShuf); 362 #endif 248 363 } -
doc/theses/mike_brooks_MMath/benchmarks/list/fx-cfa-cfa.h
rda10157 r1eea589f 1 #include <containers/list.hfa> 2 3 #define BFX_INTRUSION(S) inline dlink(S); 4 #define BFX_EXTRUSION_DECL(S) 5 #define BFX_EXTRUSION_FOLLOWUP(S) P9_EMBEDDED( S, dlink(S) ) 6 #define BFX_LIST_HEAD_T(S) dlist(S) 7 #define BFX_LISTED_ELEM_T(S) S* 8 9 #define BFX_INSERT_FIRST(S, lst, item) (insert_first (lst, item), (S*)&(item)) 10 #define BFX_INSERT_LAST(S, lst, item) (insert_last (lst, item), (S*)&(item)) 11 #define BFX_INSERT_BEFORE(S, lst, item, refIter) (insert_before(*refIter, item), (S*)&(item)) 12 #define BFX_INSERT_AFTER(S, lst, item, refIter) (insert_after (*refIter, item), (S*)&(item)) 13 #define BFX_REMOVE_FIRST(S, lst) remove( first( lst ) ) 14 #define BFX_REMOVE_LAST(S, lst) remove( last( lst ) ) 15 #define BFX_REMOVE_HERE(S, lst, refIter) remove(*refIter) 16 #define BFX_INIT(S, lst) 17 18 #define BFX_GET_AFTER(S, lst, iter) (&next( *iter)) 19 #define BFX_GET_BEFORE(S, lst, iter) (&prev( *iter )) 20 #define BFX_IS_VALID_POS(S, lst, iter) ((iter)!=NULL) 21 #define BFX_DEREF_POS(S, lst, iter) (iter) 1 #include "libcfa-fork-list.hfa" // same folder: latest and greatest 2 #include "fx-cfa-GENERAL.h" -
doc/theses/mike_brooks_MMath/benchmarks/list/fx-lq-list.h
rda10157 r1eea589f 2 2 #include <assert.h> 3 3 #include <stddef.h> 4 #include <stdbool.h> 4 5 5 6 #define HEADNAME_(S) S ## Head … … 15 16 #define BFX_INSERT_BEFORE(S, lst, item, refIter) ({LIST_INSERT_BEFORE(refIter, &item, xx); &item;}) 16 17 #define BFX_INSERT_AFTER(S, lst, item, refIter) ({LIST_INSERT_AFTER(refIter, &item, xx); &item;}) 17 #define BFX_REMOVE_FIRST(S, lst) LIST_REMOVE( LIST_FIRST( &lst ), xx)18 #define BFX_REMOVE_FIRST(S, lst) ({ S * first = LIST_FIRST( &lst ); LIST_REMOVE( first, xx ); }) 18 19 #define BFX_REMOVE_LAST(S, lst) assert(false&&"unimplemented REMOVE_LAST on lq-list") 19 20 #define BFX_REMOVE_HERE(S, lst, refIter) LIST_REMOVE( refIter, xx ) -
doc/theses/mike_brooks_MMath/benchmarks/list/fx-lq-tailq.h
rda10157 r1eea589f 1 1 #include <sys/queue.h> 2 #include <stdbool.h> 2 3 3 4 #define HEADNAME_(S) S ## Head -
doc/theses/mike_brooks_MMath/benchmarks/list/observation.c
rda10157 r1eea589f 61 61 printSuccs(leash - 1); 62 62 } 63 static void explore(int here ) {63 static void explore(int here, unsigned int leash) { 64 64 bobs_seek(here); 65 65 if (!bobs_hasCurrent()) { … … 68 68 } 69 69 bobs_movePrev(); 70 printPreds( 2);70 printPreds(leash); 71 71 72 72 bobs_seek(here); … … 75 75 76 76 bobs_moveNext(); 77 printSuccs( 2);77 printSuccs(leash); 78 78 } 79 79 static void exploreRange(int validFrom, int validTo) { … … 95 95 } 96 96 97 explore(listFirstmost); 97 printf(" v%d..%d ", listFirstmost, listLastmost); 98 99 explore(listFirstmost, 6); 98 100 printf(" ..."); 99 if (gapsize > 5) {100 explore(midpoint);101 printf(" ...");102 }103 explore(listLastmost );101 // if (gapsize > 5) { 102 // explore(midpoint); 103 // printf(" ..."); 104 // } 105 explore(listLastmost, 6); 104 106 } 105 107 … … 108 110 printf("%8zd + ? (rolling over)\n", bobs_ops_completed); 109 111 } else { 110 printf("%8zd + %6d/2 + %6d/2 ", bobs_ops_completed, bobs_prog_inserting, bobs_prog_removing);112 printf("%8zd + %6d/2 + %6d/2, %6d@e %6d_u", bobs_ops_completed, bobs_prog_inserting, bobs_prog_removing, bobs_prog_removing_end, *bobs_prog_rem_pos); 111 113 112 114 int validFrom, validTo; … … 114 116 case stack: 115 117 validFrom = 0; 116 validTo = MIN((signed)bobs_prog_inserting-1, (signed)NumNodes - (signed) bobs_prog_removing- 1);118 validTo = MIN((signed)bobs_prog_inserting-1, (signed)NumNodes - (signed)*bobs_prog_rem_pos - 1); 117 119 break; 118 120 case queue: 119 validFrom = (signed) bobs_prog_removing;121 validFrom = (signed)*bobs_prog_rem_pos; 120 122 validTo = (signed)bobs_prog_inserting-1; 121 123 break; -
doc/theses/mike_brooks_MMath/benchmarks/list/observation.h
rda10157 r1eea589f 18 18 extern volatile unsigned int bobs_prog_inserting; 19 19 extern volatile unsigned int bobs_prog_removing; 20 extern volatile unsigned int bobs_prog_removing_end; 20 21 extern volatile unsigned int bobs_prog_rollover_flag; 22 extern volatile unsigned int const * bobs_prog_rem_pos; 21 23 22 24 // observation.c defines -
doc/theses/mike_brooks_MMath/benchmarks/list/op-queue-insfirst-remelem.h
rda10157 r1eea589f 7 7 #define BOP_INSERT(lst, iters, insNo, item) BFX_INSERT_FIRST(B_UserItem, lst, (item)) 8 8 #define BOP_REMOVE(lst, iters, remNo) BFX_REMOVE_HERE(B_UserItem, lst, iters[(remNo)]) 9 10 #define BOP_REMPROGEND_IS_REMNO_BASED true -
doc/theses/mike_brooks_MMath/benchmarks/list/op-queue-inslast-remelem.h
rda10157 r1eea589f 7 7 #define BOP_INSERT(lst, iters, insNo, item) BFX_INSERT_LAST(B_UserItem, lst, (item)) 8 8 #define BOP_REMOVE(lst, iters, remNo) BFX_REMOVE_HERE(B_UserItem, lst, iters[(remNo)]) 9 10 #define BOP_REMPROGEND_IS_REMNO_BASED true -
doc/theses/mike_brooks_MMath/benchmarks/list/op-stack-insfirst-remelem.h
rda10157 r1eea589f 7 7 #define BOP_INSERT(lst, iters, insNo, item) BFX_INSERT_FIRST(B_UserItem, lst, (item)) 8 8 #define BOP_REMOVE(lst, iters, remNo) BFX_REMOVE_HERE(B_UserItem, lst, iters[NumNodes-(remNo)-1]) 9 10 #define BOP_REMPROGEND_IS_REMNO_BASED true -
doc/theses/mike_brooks_MMath/benchmarks/list/op-stack-inslast-remelem.h
rda10157 r1eea589f 7 7 #define BOP_INSERT(lst, iters, insNo, item) BFX_INSERT_LAST(B_UserItem, lst, (item)) 8 8 #define BOP_REMOVE(lst, iters, remNo) BFX_REMOVE_HERE(B_UserItem, lst, iters[NumNodes-(remNo)-1]) 9 10 #define BOP_REMPROGEND_IS_REMNO_BASED true -
libcfa/src/collections/list.hfa
rda10157 r1eea589f 80 80 // part), by failing fast. 81 81 82 #if defined( __x86_64 ) 83 // Preferred case: tag in the most-significant bit. Dereference has been shown to segfault consistently. 84 // Maintenance should list more architectures as "ok" here, to let them use the preferred case, when valid. 85 #define ORIGIN_TAG_BITNO ( 8 * sizeof( size_t ) - 1 ) 86 #else 87 // Fallback case: tag in the least-significant bit. Dereference will often give an alignment error, but may not, 88 // e.g. if accessing a char-typed member. 32-bit x86 uses the most- significant bit for real room on the heap. 89 #define ORIGIN_TAG_BITNO 0 82 #ifdef __EXPERIMENTAL_DISABLE_OTAG__ // Perf experimention alt mode 83 84 // With origin tagging disabled, iteration never reports "no more elements." 85 // In this mode, the list API is buggy. 86 // This mode is used to quantify the cost of the normal tagging scheme. 87 88 #define ORIGIN_TAG_SET(p) (p) 89 #define ORIGIN_TAG_CLEAR(p) (p) 90 #define ORIGIN_TAG_QUERY(p) 0 91 #define ORIGIN_TAG_ASGN(p, v) (p) 92 #define ORIGIN_TAG_EITHER(p, v) (p) 93 #define ORIGIN_TAG_NEQ(v1, v2) 0 94 95 #else // Normal 96 97 #if defined( __x86_64 ) 98 // Preferred case: tag in the most-significant bit. Dereference 99 // has been shown to segfault consistently. Maintenance should 100 // list more architectures as "ok" here, to let them use the 101 // preferred case, when valid. 102 #define ORIGIN_TAG_BITNO ( 8 * sizeof( size_t ) - 1 ) 103 #else 104 // Fallback case: tag in the least-significant bit. Dereference 105 // will often give an alignment error, but may not, e.g. if 106 // accessing a char-typed member. 32-bit x86 uses the most- 107 // significant bit for real room on the heap. 108 #define ORIGIN_TAG_BITNO 0 109 #endif 110 111 #define ORIGIN_TAG_MASK (((size_t)1) << ORIGIN_TAG_BITNO) 112 113 #define ORIGIN_TAG_SET(p) ((p) | ORIGIN_TAG_MASK) 114 #define ORIGIN_TAG_CLEAR(p) ((p) & ~ORIGIN_TAG_MASK) 115 #define ORIGIN_TAG_QUERY(p) ((p) & ORIGIN_TAG_MASK) 116 117 #define ORIGIN_TAG_ASGN(p, v) ( \ 118 verify( ! ORIGIN_TAG_QUERY(p) && "p had no tagbit" ), \ 119 ORIGIN_TAG_EITHER((p), (v)) \ 120 ) 121 122 #define ORIGIN_TAG_EITHER(p, v) ( \ 123 verify( ! ORIGIN_TAG_CLEAR(v) && "v is a pure tagbit" ), \ 124 ( (p) | (v) ) \ 125 ) 126 127 #define ORIGIN_TAG_NEQ(v1, v2) ( \ 128 verify( ! ORIGIN_TAG_CLEAR(v1) && "v1 is a pure tagbit" ), \ 129 verify( ! ORIGIN_TAG_CLEAR(v2) && "v2 is a pure tagbit" ), \ 130 ( (v1) ^ (v2) ) \ 131 ) 132 90 133 #endif 91 #define ORIGIN_TAG_MASK (((size_t)1) << ORIGIN_TAG_BITNO) 92 93 #define ORIGIN_TAG_SET( p ) ((p) | ORIGIN_TAG_MASK) 94 #define ORIGIN_TAG_CLEAR( p ) ((p) & ~ORIGIN_TAG_MASK) 95 #define ORIGIN_TAG_QUERY( p ) ((p) & ORIGIN_TAG_MASK) 134 135 136 137 #ifdef __EXPERIMENTAL_LOOSE_SINGLES__ // Perf experimention alt mode 138 139 // In loose-singles mode, the ability to answer an "is listed" query is disabled, as is "to insert an element, 140 // it must not be listed already" checking. The user must know separately whether an element is listed. 141 // Other than inserting it, any list-api action on an unlisted element is undefined. Notably, list iteration 142 // starting from an unlisted element is not defined to respond "no more elements," and may instead continue 143 // iterating from a formerly occupied list position. This mode matches LQ usage. 144 145 #define NOLOOSE(...) 146 #define LOOSEONLY(...) __VA_ARGS__ 147 148 #else // Normal 149 150 #define NOLOOSE(...) __VA_ARGS__ 151 #define LOOSEONLY(...) 152 153 #endif 154 155 156 157 96 158 97 159 forall( tE & ) { … … 102 164 103 165 static inline void ?{}( dlink( tE ) & this ) { 166 NOLOOSE( 104 167 this.next = this.prev = 0p; 168 ) 105 169 } 106 170 … … 129 193 static inline forall( tE &, tLinks & | embedded( tE, tLinks, dlink( tE ) ) ) { 130 194 bool isListed( tE & node ) { 195 NOLOOSE( 131 196 verify( &node != 0p ); 132 197 dlink( tE ) & node_links = node`inner; 133 198 return (node_links.prev != 0p) || (node_links.next != 0p); 199 ) 200 LOOSEONLY( 201 verify(false && "isListed is undefined"); 202 return true; 203 ) 134 204 } 135 205 … … 157 227 158 228 dlink( tE ) & linkToInsert = node`inner; 159 229 NOLOOSE( 160 230 verify( linkToInsert.next == 0p ); 161 231 verify( linkToInsert.prev == 0p ); 232 ) 162 233 163 234 tE & list_pos_elem = *(tE *)ORIGIN_TAG_CLEAR( (size_t)&before ); … … 180 251 181 252 dlink( tE ) & linkToInsert = node`inner; 182 253 NOLOOSE( 183 254 verify( linkToInsert.prev == 0p ); 184 255 verify( linkToInsert.next == 0p ); 256 ) 185 257 186 258 tE & list_pos_elem = *(tE *)ORIGIN_TAG_CLEAR( (size_t)&after ); … … 211 283 before_links.next = &after_raw; 212 284 after_links.prev = &before_raw; 285 286 NOLOOSE( 213 287 asm( "" : : : "memory" ); 214 288 list_pos_links.prev = 0p; 215 289 list_pos_links.next = 0p; 216 290 asm( "" : : : "memory" ); 291 ) 217 292 return node; 218 293 } -
libcfa/src/stdhdr/assert.h
rda10157 r1eea589f 38 38 #define warnf( expr, fmt, ... ) ({ static bool check_once##__LINE__ = false; if( false == check_once##__LINE__ && false == (expr)) { check_once##__LINE__ = true; __assert_warn_f(__VSTRINGIFY__(expr), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, ## __VA_ARGS__ ); } }) 39 39 #else 40 #define verify(x) 41 #define verifyf(x, ...) 42 #define verifyfail(...) 43 #define warnf( expr, fmt, ... ) 40 #define verify(x) 0 41 #define verifyf(x, ...) 0 42 #define verifyfail(...) 0 43 #define warnf( expr, fmt, ... ) 0 44 44 #endif 45 45
Note:
See TracChangeset
for help on using the changeset viewer.