[01db301] | 1 | |
---|
| 2 | CFABUILD = ~/cfa2/build-perf |
---|
| 3 | LIBCFA = $(CFABUILD)/libcfa/*/src/.libs/libcfa.so |
---|
| 4 | |
---|
| 5 | CFA = $(CFABUILD)/driver/cfa |
---|
| 6 | PERFFLAGS_CFA = -nodebug -O2 |
---|
[08ed947] | 7 | PERFFLAGS_CXX = -DNDEBUG -O2 -Wl,--no-as-needed -ldl |
---|
[01db301] | 8 | |
---|
| 9 | |
---|
[fefd77a] | 10 | # function: convert to upper case |
---|
[97d58dc] | 11 | define uc |
---|
| 12 | $(shell echo $(1) | tr '[:lower:]' '[:upper:]') |
---|
| 13 | endef |
---|
[01db301] | 14 | |
---|
[fefd77a] | 15 | # function: project numbered element of filename named by hyphen-delimited tuple |
---|
| 16 | # (call hyphProj,q-w-e-r.txt,1) is Q |
---|
| 17 | define ucHyphProj |
---|
| 18 | $(call uc,$(word $(2),$(subst -, ,$(basename $(1))))) |
---|
| 19 | endef |
---|
| 20 | |
---|
| 21 | # function: cross two lists, adding hyphen delimiters |
---|
| 22 | # (call hyphCross,a b c,1 2) is a-1 a-2 b-1 b-2 c-1 c-2 |
---|
| 23 | define hyphCross |
---|
| 24 | $(foreach x,$(1),$(foreach xs,$(2),$(x)-$(xs))) |
---|
| 25 | endef |
---|
| 26 | |
---|
| 27 | define hyphCross3 |
---|
| 28 | $(call hyphCross,$(1),$(call hyphCross,$(2),$(3))) |
---|
| 29 | endef |
---|
| 30 | |
---|
| 31 | define hyphCross4 |
---|
| 32 | $(call hyphCross,$(1),$(call hyphCross3,$(2),$(3),$(4))) |
---|
| 33 | endef |
---|
| 34 | |
---|
| 35 | define hyphCross5 |
---|
| 36 | $(call hyphCross,$(1),$(call hyphCross4,$(2),$(3),$(4),$(5))) |
---|
| 37 | endef |
---|
| 38 | |
---|
[08ed947] | 39 | OPERATIONS=pta peq pbv pall pno |
---|
[fefd77a] | 40 | ALLOCS=reuse fresh |
---|
| 41 | CFA_APILEVELS=hl ll |
---|
| 42 | CFA_SHARINGS=share noshare |
---|
| 43 | PLATFORMS=cfa stl buhr94 |
---|
| 44 | |
---|
| 45 | ifneq ($(filter cfa,$(PLATFORMS)),) |
---|
[08ed947] | 46 | CFA_APIS=$(call hyphCross,$(CFA_APILEVELS),$(CFA_SHARINGS)) |
---|
[fefd77a] | 47 | endif |
---|
| 48 | |
---|
| 49 | ifneq ($(filter stl,$(PLATFORMS)),) |
---|
[08ed947] | 50 | STL_APIS=na-na |
---|
[fefd77a] | 51 | endif |
---|
| 52 | |
---|
| 53 | ifneq ($(filter buhr94,$(PLATFORMS)),) |
---|
[08ed947] | 54 | BUHR94_APIS=na-na |
---|
[fefd77a] | 55 | endif |
---|
| 56 | |
---|
[08ed947] | 57 | APIS = $(CFA_APIS) $(STL_APIS) $(BUHR94_APIS) |
---|
[fefd77a] | 58 | |
---|
[08ed947] | 59 | OPERATIONS_USING_ALLOCS=pta peq |
---|
| 60 | define enrichOperationsAllocs |
---|
| 61 | $(call hyphCross3,$(filter peq pta,$(OPERATIONS)),$(1),$(ALLOCS)) $(call hyphCross3,$(filter-out peq pta,$(OPERATIONS)),$(1),na) |
---|
| 62 | endef |
---|
[fefd77a] | 63 | |
---|
[08ed947] | 64 | CFA_PERFPROGS=$(call hyphCross,perfexp-cfa,$(call enrichOperationsAllocs,$(CFA_APIS))) |
---|
| 65 | STL_PERFPROGS=$(call hyphCross,perfexp-stl,$(call enrichOperationsAllocs,$(STL_APIS))) |
---|
| 66 | BUHR94_PERFPROGS=$(call hyphCross,perfexp-buhr94,$(call enrichOperationsAllocs,$(BUHR94_APIS))) |
---|
[fefd77a] | 67 | |
---|
[08ed947] | 68 | PERFPROGS = $(CFA_PERFPROGS) $(STL_PERFPROGS) $(BUHR94_PERFPROGS) |
---|
[01db301] | 69 | |
---|
[08ed947] | 70 | all : $(PERFPROGS) |
---|
[01db301] | 71 | |
---|
[08ed947] | 72 | PP_SPLIT := $(shell echo "${PERFPROGS}" | sed -e 's/ /\\n/g') |
---|
| 73 | echoPerfProgs: |
---|
| 74 | echo -e '$(PP_SPLIT)' |
---|
| 75 | |
---|
| 76 | perfexp-%.o: API=$(call ucHyphProj,$@,2) |
---|
| 77 | perfexp-%.o: OPERATION=$(call ucHyphProj,$@,3) |
---|
| 78 | perfexp-%.o: CFA_APILEVEL=$(call ucHyphProj,$@,4) |
---|
| 79 | perfexp-%.o: CFA_SHARING=$(call ucHyphProj,$@,5) |
---|
| 80 | perfexp-%.o: ALLOC=$(call ucHyphProj,$@,6) |
---|
| 81 | perfexp-%.o: SCENARIO_SWITCH=-DIMPL_$(API)_$(CFA_APILEVEL)_$(CFA_SHARING) -DOP_$(OPERATION) -DALLOC_$(ALLOC) |
---|
| 82 | |
---|
| 83 | perfexp-cfa-%.o: CMD=$(CFA) -c $(PERFFLAGS_CFA) $< -o $@ $(SCENARIO_SWITCH) |
---|
| 84 | perfexp-stl-%.o: CMD=$(CXX) -c -xc++ $(PERFFLAGS_CXX) $< -o $@ $(SCENARIO_SWITCH) |
---|
| 85 | perfexp-buhr94-%.o: CMD=$(CXX) -xc++ -c $(PERFFLAGS_CXX) $< -o $@ $(SCENARIO_SWITCH) |
---|
| 86 | |
---|
| 87 | perfexp-cfa-peq-%.o: prog.cfa $(LIBCFA) |
---|
| 88 | $(CMD) |
---|
| 89 | perfexp-cfa-pta-%.o: prog.cfa $(LIBCFA) |
---|
| 90 | $(CMD) |
---|
| 91 | perfexp-cfa-pbv-%.o: prog-passbyval.cfa $(LIBCFA) |
---|
| 92 | $(CMD) |
---|
| 93 | perfexp-cfa-pb%.o: prog-passbyX.cfa $(LIBCFA) |
---|
| 94 | $(CMD) |
---|
| 95 | perfexp-cfa-pfi-%.o: prog-find.cfa $(LIBCFA) |
---|
| 96 | $(CMD) |
---|
| 97 | perfexp-cfa-pall-%.o: prog-allocn.cfa $(LIBCFA) |
---|
| 98 | $(CMD) |
---|
| 99 | perfexp-cfa-pno-%.o: prog-normalize.cfa $(LIBCFA) |
---|
| 100 | $(CMD) |
---|
| 101 | perfexp-stl-peq-%.o: prog.cfa |
---|
| 102 | $(CMD) |
---|
| 103 | perfexp-stl-pta-%.o: prog.cfa |
---|
| 104 | $(CMD) |
---|
| 105 | perfexp-stl-pbv-%.o: prog-passbyval.cfa |
---|
| 106 | $(CMD) |
---|
| 107 | perfexp-stl-pfi-%.o: prog-find.cfa |
---|
| 108 | $(CMD) |
---|
| 109 | perfexp-stl-pall-%.o: prog-allocn.cfa |
---|
| 110 | $(CMD) |
---|
| 111 | perfexp-stl-pno-%.o: prog-normalize.cfa |
---|
| 112 | $(CMD) |
---|
| 113 | perfexp-buhr94-peq-%.o: prog.cfa buhr94-string.o buhr94-VbyteSM.o |
---|
| 114 | $(CMD) |
---|
| 115 | perfexp-buhr94-pta-%.o: prog.cfa buhr94-string.o buhr94-VbyteSM.o |
---|
| 116 | $(CMD) |
---|
| 117 | perfexp-buhr94-pta-%.o: prog-passbyval.cfa buhr94-string.o buhr94-VbyteSM.o |
---|
| 118 | $(CMD) |
---|
| 119 | perfexp-buhr94-pall-%.o: prog-allocn.cfa buhr94-string.o buhr94-VbyteSM.o |
---|
| 120 | $(CMD) |
---|
| 121 | perfexp-buhr94-pno-%.o: prog-normalize.cfa buhr94-string.o buhr94-VbyteSM.o |
---|
| 122 | $(CMD) |
---|
| 123 | |
---|
| 124 | # one of the pbx cases also needs to link with not_string_res.o (handling manually) |
---|
| 125 | perfexp-cfa-%: perfexp-cfa-%.o $(LIBCFA) |
---|
| 126 | $(CFA) $(PERFFLAGS_CFA) $< -o $@ |
---|
| 127 | perfexp-stl-%: perfexp-stl-%.o $(LIBCFA) |
---|
| 128 | $(CFA) $(PERFFLAGS_CFA) $< /lib/x86_64-linux-gnu/libstdc++.so.6 -o $@ |
---|
| 129 | perfexp-buhr94-% : perfexp-buhr94-%.o buhr94-string.o buhr94-VbyteSM.o |
---|
| 130 | $(CXX) $(PERFFLAGS_CXX) $^ -o $@ |
---|
[01db301] | 131 | |
---|
| 132 | buhr94-string.o: |
---|
| 133 | $(CXX) -xc++ -c $(PERFFLAGS_CXX) ~/usys1/sm/string/StringSharing/src/string.cc -o $@ |
---|
| 134 | |
---|
| 135 | buhr94-VbyteSM.o: |
---|
| 136 | $(CXX) -xc++ -c $(PERFFLAGS_CXX) ~/usys1/sm/string/StringSharing/src/VbyteSM.cc -o $@ |
---|
| 137 | |
---|
| 138 | clean: |
---|
| 139 | rm -f *.o perfexp* |
---|
| 140 | |
---|
| 141 | MEASURE = $(PERFPROGS) |
---|
[4d0eb1c] | 142 | CORPORI = corpus-100-*-1.txt |
---|
[01db301] | 143 | |
---|
[4d0eb1c] | 144 | measurement: $(MEASURE) |
---|
[01db301] | 145 | tofile=measurement-`date '+%F--%H-%M-%S'`.csv ; \ |
---|
| 146 | echo $$tofile ; \ |
---|
| 147 | for prog in $(MEASURE) ; do \ |
---|
| 148 | for corpus in $(CORPORI) ; do \ |
---|
| 149 | corpusbody=`cat $$corpus` ; \ |
---|
[4d0eb1c] | 150 | printed=`./$$prog 100 10 $$corpusbody` ; \ |
---|
[01db301] | 151 | echo $$prog,$$corpus,$$printed >> $$tofile ; \ |
---|
[fefd77a] | 152 | echo $$prog,$$corpus,$$printed ; \ |
---|
[01db301] | 153 | done ; \ |
---|
[fefd77a] | 154 | done |
---|
[08ed947] | 155 | # printed=`./$$prog 10000 - 10 $$corpusbody` ; \ |
---|
| 156 | |
---|
| 157 | CFA_EXPANSIONS=0.02 0.05 0.1 0.2 0.5 0.9 |
---|
| 158 | |
---|
| 159 | measurement2: $(MEASURE) |
---|
| 160 | tofile=measurement-`date '+%F--%H-%M-%S'`.csv ; \ |
---|
| 161 | for prog in $(MEASURE) ; do \ |
---|
| 162 | for corpus in $(CORPORI) ; do \ |
---|
| 163 | for expansion in $(CFA_EXPANSIONS) ; do \ |
---|
| 164 | corpusbody= ; \ |
---|
| 165 | echo ./$$prog 1000 1.006 $$expansion 10 \`cat $$corpus\` ; \ |
---|
| 166 | done ; \ |
---|
| 167 | done ; \ |
---|
| 168 | done ; \ |
---|
| 169 | echo $$tofile ; \ |
---|
| 170 | for prog in $(MEASURE) ; do \ |
---|
| 171 | for corpus in $(CORPORI) ; do \ |
---|
| 172 | for expansion in $(CFA_EXPANSIONS) ; do \ |
---|
| 173 | corpusbody=`cat $$corpus` ; \ |
---|
| 174 | printed=`./$$prog 1000 1.006 $$expansion 10 $$corpusbody` ; \ |
---|
| 175 | echo $$prog,$$corpus,$$expansion,$$printed >> $$tofile ; \ |
---|
| 176 | echo $$prog,$$corpus,$$expansion,$$printed ; \ |
---|
| 177 | done ; \ |
---|
| 178 | done ; \ |
---|
| 179 | done |
---|
| 180 | |
---|
| 181 | measurement3: $(MEASURE) |
---|
| 182 | for prog in $(MEASURE) ; do \ |
---|
| 183 | for corpus in $(CORPORI) ; do \ |
---|
| 184 | for expansion in $(CFA_EXPANSIONS) ; do \ |
---|
| 185 | corpusbody=`cat $$corpus` ; \ |
---|
| 186 | LD_PRELOAD=~/plg2/mubeen-stat-shim/malloc/mallocWrappers.so ./$$prog 1000 1.006 $$expansion 1 $$corpusbody ; \ |
---|
| 187 | mv preload_dump.txt preload_dump--qrun1--$$corpus--expansion-$$expansion.txt ; \ |
---|
| 188 | done ; \ |
---|
| 189 | done ; \ |
---|
| 190 | done |
---|