-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
150 lines (114 loc) · 5.05 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
PLOT_FILE := bench.png
.PHONY : opt bench clean install prof test debug benchprof threadscope $(PLOT_FILE) BenchmarkP.prof intbench Tests TestsHPC TestsP
.PHONY : Benchmark BenchmarkP TrieBench Benchlog
GHC_BIN := ghc-7.0.1
FAST_DIR := out/fast
OPTIMIZED_DIR := out/opt
GHC_OPTS := -Wall -fno-warn-name-shadowing -fno-warn-orphans -rtsopts $(EXTRA_OPTS)
FAST_GHC_OPTS := -O0 -ddump-minimal-imports -odir $(FAST_DIR) $(GHC_OPTS)
DEBUG_GHC_OPTS := -prof -hisuf p_hi -auto-all -rtsopts -osuf p_o $(FAST_GHC_OPTS) $(GHC_OPTS)
LLVM_OPTS := -O3 -loop-reduce -loop-unroll \
-std-compile-opts -loop-unroll -partialspecialization -tailduplicate -S -stats
OPTIMIZED_GHC_OPTS := -O2 -fno-spec-constr-count -fno-spec-constr-threshold \
-fllvm $(addprefix -optlo, $(LLVM_OPTS)) \
-fmax-worker-args=100 -odir $(OPTIMIZED_DIR) $(GHC_OPTS)
THREADSCOPE_OPTS := $(OPTIMIZED_GHC_OPTS) $(GHC_OPTS) -eventlog
PROFILING_OPTS := -prof -hisuf p_hi -auto-all -rtsopts -osuf p_o $(OPTIMIZED_GHC_OPTS) $(GHC_OPTS)
HP2PS_OPTS := -c -s -m12 -d
RTS_OPTS := -H256M -A32M -s -M1G
PROGRESSION_PREFIXES := ""
PROGRESSION_GROUP := normal-bench
bs :
rm $(OPTIMIZED_DIR)/Data/TrieMap/Representation/Instances/*.o
$(GHC_BIN) $(OPTIMIZED_GHC_OPTS) Data.TrieMap.Representation.Instances.ByteString -keep-tmp-files -v
fast :
$(GHC_BIN) $(FAST_GHC_OPTS) Data.TrieMap Data.TrieSet
debug:
$(GHC_BIN) $(DEBUG_GHC_OPTS) Data.TrieMap Data.TrieSet
opt :
$(GHC_BIN) $(OPTIMIZED_GHC_OPTS) Data.TrieMap Data.TrieSet
prof :
$(GHC_BIN) $(PROFILING_OPTS) Data.TrieMap Data.TrieSet
install : test
cabal install --enable-documentation
test : Tests
./Tests
testdbg :: TestsP
./TestsP +RTS -xc
bench : SAMPLES = 30
bench : $(PLOT_FILE)
intbench : SAMPLES = 30
intbench : bench-IntBench-Trie.csv bench-IntBench-Set.csv bench-IntBench-IntSet.csv
./IntBench-Trie --mode=graph --group=$(PROGRESSION_GROUP) --compare="IntBench-Trie,IntBench-Set,IntBench-IntSet" --plot=intbench.png \
--plot-log-y
bench-IntBench-Trie.csv : IntBench-Trie
./$< +RTS $(RTS_OPTS) -RTS --name="$<" $(BENCH_OPTS)
bench-IntBench-Set.csv : IntBench-Set
./$< +RTS $(RTS_OPTS) -RTS --name="$<" $(BENCH_OPTS)
bench-IntBench-IntSet.csv : IntBench-IntSet
./$< +RTS $(RTS_OPTS) -RTS --name="$<" $(BENCH_OPTS)
IntBench-Trie : opt IntBench/Trie.hs IntBench/Base.hs
$(GHC_BIN) $(OPTIMIZED_GHC_OPTS) -w IntBench.Trie -main-is IntBench.Trie -o IntBench-Trie
IntBench-Set : IntBench/Set.hs IntBench/Base.hs
$(GHC_BIN) $(OPTIMIZED_GHC_OPTS) -w IntBench.Set -main-is IntBench.Set -o IntBench-Set
IntBench-IntSet : IntBench/IntSet.hs IntBench/Base.hs
$(GHC_BIN) $(OPTIMIZED_GHC_OPTS) -w IntBench.IntSet -main-is IntBench.IntSet -o IntBench-IntSet
BENCH_OPTS = --mode=run --group=$(PROGRESSION_GROUP) --prefixes=$(PROGRESSION_PREFIXES) \
--compare="" -- -s $(SAMPLES)
bench.png : bench-TrieBench.csv bench-SetBench.csv
./TrieBench --mode=graph --group=$(PROGRESSION_GROUP) --compare="TrieBench,SetBench" --plot=$@ \
--plot-log-y
benchbs.png : SAMPLES = 30
benchbs.png : bench-TrieBench.csv bench-SetBench.csv bench-BSTrieBench.csv
./TrieBench --mode=graph --group=$(PROGRESSION_GROUP) --compare="TrieBench,SetBench,BSTrieBench" --plot=$@ \
--plot-log-y
bench-TrieBench.csv : TrieBench
./TrieBench +RTS $(RTS_OPTS) -RTS --name="TrieBench" $(BENCH_OPTS)
bench-SetBench.csv : SetBench
./SetBench +RTS $(RTS_OPTS) -RTS --name="SetBench" $(BENCH_OPTS)
bench-BSTrieBench.csv : BSTrieBench
./BSTrieBench +RTS $(RTS_OPTS) -RTS --name="BSTrieBench" $(BENCH_OPTS)
benchprof : BenchmarkP.prof BenchmarkP.ps
less BenchmarkP.prof
threadscope: Benchlog.eventlog
threadscope Benchlog.eventlog
BenchmarkP.ps : BenchmarkP.hp
hp2ps $(HP2PS_OPTS) $<
BenchmarkP.hp : BenchmarkP.prof
BenchmarkP.prof : SAMPLES = 5
BenchmarkP.prof : BenchmarkP
./BenchmarkP +RTS -P -hd $(RTS_OPTS) -RTS --name="BenchmarkP" $(BENCH_OPTS)
Benchlog.eventlog : SAMPLES = 10
Benchlog.eventlog : Benchlog
./Benchlog +RTS $(RTS_OPTS) -ls -RTS $(TRIEBENCH_OPTS)
Tests : fast
$(GHC_BIN) $(FAST_GHC_OPTS) Data.TrieMap.Tests -o Tests -main-is Data.TrieMap.Tests
hpc : TestsHPC.tix
hpc markup --destdir=hpc TestsHPC.tix
TestsHPC.tix : TestsHPC
./TestsHPC
TestsHPC :
$(GHC_BIN) $(FAST_GHC_OPTS) -fhpc Data.TrieMap.Tests -o TestsHPC -main-is Data.TrieMap.Tests
rm -f TestsHPC.tix
TestsP : fast debug
$(GHC_BIN) $(DEBUG_GHC_OPTS) Tests -o TestsP -main-is Tests.main
BenchmarkP : prof
$(GHC_BIN) $(PROFILING_OPTS) -w TrieBench -o BenchmarkP -main-is TrieBench.main
Benchmark : opt
$(GHC_BIN) $(OPTIMIZED_GHC_OPTS) -w TrieBench -o Benchmark -main-is TrieBench.main
TrieBench : TrieBench.hs opt
$(GHC_BIN) $(OPTIMIZED_GHC_OPTS) -w $< -o $@ -main-is TrieBench.main
SetBench : SetBench.hs
$(GHC_BIN) $(OPTIMIZED_GHC_OPTS) -w $< -o $@ -main-is SetBench.main
BSTrieBench : BSTrieBench.hs
$(GHC_BIN) $(OPTIMIZED_GHC_OPTS) -w $< -o $@ -main-is BSTrieBench.main
Benchlog : opt
$(GHC_BIN) $(THREADSCOPE_OPTS) -w TrieBench -o Benchlog -main-is TrieBench.main
clean:
rm -f *.imports
rm -rf out/
rm -f SetBench TrieBench BenchmarkP Tests
rm -f bench-SetBench.csv bench-TrieBench.csv bench.csv bench.png
rm -f *.o *.hi
rm -rf hpc/
rm -f TestsHPC.tix