/
Makefile
237 lines (173 loc) · 7.89 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# WARNING: This Makefile is largely redundant with the .cabal file and will be deleted at some point.
# It has some crufty shortcuts used by the developers.
#====================================================================================================
all: runtime
#all: runtime trans
ifeq (,$(GHC))
GHC= ghc
endif
#====================================================================================================
# FIrst, some entrypoints that help build the runtime
#====================================================================================================
# PARGHCOPTS=-feager-blackholing
default:
# This target builds CnC as precompiled modules:
# Pick default schedulers as well:
$(GHC) --make -c -cpp Intel/CncUtil.hs
$(GHC) --make -c -cpp -DCNC_SCHEDULER=2 Intel/CncPure.hs
$(GHC) --make -c -cpp -DCNC_SCHEDULER=5 Intel/Cnc.hs
runtime:
runhaskell ./Setup.hs configure
runhaskell ./Setup.hs build
@echo
# TEMP [2010.10.06] Disabling doc build
# $(MAKE) setup_doc
# $(MAKE) setup_test
setup_doc:
@echo ================================================================================
@echo Building Documentation
@echo ================================================================================
runhaskell ./Setup.hs haddock
setup_test:
@echo
@echo ================================================================================
@echo Running Test executable in the cabal distribution package
@echo ================================================================================
runhaskell ./Setup.hs test
interact:
ghci -cpp -DCNC_SCHEDULER=2 Intel/CncPure.hs
interactIO:
ghci -cpp -DCNC_SCHEDULER=5 Intel/Cnc.hs
test:
THREADS=1 ./run_all_tests.sh
longtest:
TRIALS=3 NONSTRICT=1 LONGRUN=1 THREADSETTINGS=="0 1 2 3 4 8" ./run_all_examples.sh &> /dev/stdout | tee all_tests.log
# TRIALS=3 NONSTRICT=1 LONGRUN=1 THREADSETTINGS=="0 1 2 3 4 8" ./run_all_examples.sh &> /dev/stdout | tee all_tests.log
# LONGRUN=1 THREADSETTINGS="0 1 2 3 4 8" ./run_all_tests.sh &> /dev/stdout | tee all_tests.log
# TRIALS=3 NONSTRICT=1 LONGRUN=1 THREADSETTINGS="0 1 2 3 4 6 7 8 10 11 12 16 20 24 28 32 36 38 42 46 47 48 " ./run_all_FROMPACKED.sh &> /dev/stdout | tee all_tests.log
distro: pkg
pkg:
./build_distro.sh
wc:
cloc --by-file $(FILES)
wc $(FILES)
DOCBASE=html_doc
doc:
mkdir -p $(DOCBASE)/url/Intel/
ls Intel/*.hs | xargs -i HsColour -html {} -ohtml_doc/url/{}
haddock --source-base=url/ --source-module=url/%F -o html_doc -html --optghc -cpp Intel/Cnc.hs Intel/CncPure.hs
distclean: clean
rm -rf distro_20*
# DO NOT DELETE: Beginning of Haskell dependencies
Intel/CncUtil.o : Intel/CncUtil.hs
Intel/Cnc3.o : Intel/Cnc3.hs
Intel/Cnc3.o : Intel/CncUtil.hi
examples/test_parfor.o : examples/test_parfor.hs
examples/test_parfor.o : Intel/Cnc3.hi
# DO NOT DELETE: End of Haskell dependencies
#====================================================================================================
cleanrun:
rm -f uname.txt cpuinfo issue all_tests*.log results.dat
mvrun:
mkdir -p last_run
cp uname.txt cpuinfo issue all_tests*.log results.dat last_run/
UNAME=$(shell uname -n )
BENCHPACK="benchpack_$(UNAME)"
# Make a separate directory for running benchmarks.
benchpack:
mkdir -p "$(BENCHPACK)/examples/"
mkdir -p "$(BENCHPACK)/Intel/"
cp -a *big_run*.sh default_opt_settings.sh ntimes ntimes_minmedmax ntimes_binsearch.sh binsearch_throughput timeout.sh timeout.hs \
benchlist*.txt install_environment_vars.sh runcnc run_all_shared.sh run_all_examples.sh haskell_cnc.h "$(BENCHPACK)/"
cp -a Intel/*.hs "$(BENCHPACK)/Intel/"
cp -a examples/*.hs "$(BENCHPACK)/examples/"
cp -a examples/*.dat "$(BENCHPACK)/examples/"
# upload datasets
upload:
unison-2.32 upload_hcnc_datasets -batch -ui text
ssh fort.ffh.us '(cd public_html/haskell-cnc/datasets/; tar czvf benchmarks.tgz benchmarks/)'
#fakescale:
# ls datasets_NEW/*.dat | xargs -i ./sim_hypothetical_scalable_gc {}
#====================================================================================================
#====================================================================================================
# Below is the (entirely separate) makefile for the translator.
#====================================================================================================
HSOURCE=SrcLoc.hs Main.hs GatherGraph.hs AST.hs Codegen/CppOld.hs Codegen/Haskell.hs \
CncGraph.hs CncViz.hs TraceVacuum.hs Curses.hs Util.hs \
Passes/ReadHarch.hs Passes/ReadCnC.hs Passes/TypeDefs.hs
ifeq (,$(BUILDDIR))
BUILDDIR= ./build/
endif
#BUILDDIR= ./
HCNCNAME=cnc
$(BUILDDIR):
mkdir $(BUILDDIR)
# This is for use in the context of a complete Intel CnC distribution.
install:
rm -f Intel/Cnc/Spec/Version.hs
# $(MAKE) Intel/Cnc/Spec/Version.hs $(HCNCNAME).stripped
# cp $(BUILDDIR)/$(HCNCNAME).stripped `which $(HCNCNAME)`
$(MAKE) Intel/Cnc/Spec/Version.hs release
if [ -e ../../distro/ ]; then mkdir -p ../../distro/bin/$(CNC_ARCH_PLATFORM)/; fi
if [ -e ../../distro/ ]; then cp $(BUILDDIR)/$(HCNCNAME).release ../../distro/bin/$(CNC_ARCH_PLATFORM)/cnc; fi
trans_inplace:
GHCFLAGS="$(GHCFLAGS) -c" BUILDDIR=./ $(MAKE) ./$(HCNCNAME)
trans:
@echo
@echo ================================================================================
@echo Building Translator.
@echo ================================================================================
$(MAKE) $(BUILDDIR)/$(HCNCNAME)
Intel/Cnc/Spec/Version.hs:
runhaskell extract_version.hs
#release: $(BUILDDIR)/$(HCNCNAME).release
# $(BUILDDIR)/$(HCNCNAME).release:
release:
GHCFLAGS="-rtsopts -O2" $(MAKE) $(BUILDDIR)/$(HCNCNAME).stripped
@echo Packing executable with UPX:
rm -f $(BUILDDIR)/$(HCNCNAME).release
upx $(BUILDDIR)/$(HCNCNAME).stripped -o $(BUILDDIR)/$(HCNCNAME).release
$(BUILDDIR)/$(HCNCNAME).stripped: viz
@echo Stripping executable to reduce size.
strip $(BUILDDIR)/$(HCNCNAME) -o $(BUILDDIR)/$(HCNCNAME).stripped
$(BUILDDIR)/$(HCNCNAME): $(BUILDDIR) preproc buildtrans
buildtrans:
$(GHC) $(GHCFLAGS) --make Intel/Cnc/Spec/Main.hs -odir $(BUILDDIR) -o $(BUILDDIR)/$(HCNCNAME) -fwarn-unused-imports
viz: $(BUILDDIR) $(BUILDDIR) preproc
# $(GHC) $(GHCFLAGS) -c Intel/Cnc/Spec/CncLexer.hs
$(GHC) -odir $(BUILDDIR) -c Intel/Cnc/Spec/CncLexer.hs
$(GHC) $(GHCFLAGS) -DCNCVIZ --make Intel/Cnc/Spec/Main.hs -odir $(BUILDDIR) -o $(BUILDDIR)/$(HCNCNAME)
preproc: Intel/Cnc/Spec/CncLexer.hs Intel/Cnc/Spec/CncGrammar.hs
Intel/Cnc/Spec/CncLexer.hs: Intel/Cnc/Spec/CncLexer.x
alex Intel/Cnc/Spec/CncLexer.x
Intel/Cnc/Spec/CncGrammar.y: Intel/Cnc/Spec/CncGrammar.y.pp
cpp -P -CC $^ $@
# gcc -x c -E $^ -o $@
Intel/Cnc/Spec/CncGrammar.hs: Intel/Cnc/Spec/CncGrammar.y
happy Intel/Cnc/Spec/CncGrammar.y
wctrans:
(cd Intel/Cnc/Spec/; ln -f -s CncLexer.x CncLexer.temp.hs)
(cd Intel/Cnc/Spec/; ln -f -s CncGrammar.y.pp CncGrammar.temp.hs)
(cd Intel/Cnc/Spec/; cloc-1.08.pl --by-file CncLexer.temp.hs CncGrammar.temp.hs $(HSOURCE))
#====================================================================================================
clean: cleanruntime cleantrans cleantests
runhaskell ./Setup.hs clean
cleanruntime:
rm -f ./Intel/*.o ./Intel/*.hi Intel/*~
rm -f ./Intel/Cnc/*.o Intel/Cnc/*.hi
rm -f $(BUILDDIR)/Intel/*.o $(BUILDDIR)/Intel/*.hi
rm -f $(BUILDDIR)/Intel/Cnc/*.o $(BUILDDIR)/Intel/Cnc/*.hi
rm -f *.aux little*.log
(cd examples; $(MAKE) clean)
cleantrans:
rm -rf $(BUILDDIR)/$(HCNCNAME) $(BUILDDIR)/$(HCNCNAME).*
(cd $(BUILDDIR)/Intel/Cnc/Spec; find -name "*.o" | xargs -i rm {} )
(cd $(BUILDDIR)/Intel/Cnc/Spec; find -name "*.hi" | xargs -i rm {} )
(cd ./Intel/Cnc/Spec; find -name "*.o" | xargs -i rm {} )
(cd ./Intel/Cnc/Spec; find -name "*.hi" | xargs -i rm {} )
cleantests:
(cd tests_spec; $(MAKE) clean)
#====================================================================================================
# cd graphPartitioner; $(MAKE)
# Prevent odd make builtin rules re: cnc.sh
.SUFFIXES: