forked from N-BodyShop/changa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
302 lines (248 loc) · 11.7 KB
/
Makefile.in
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
### Build information
# ChaNGa source directory
SOURCE_DIR=@srcdir@
# Directory from which `configure` was called.
BUILD_DIR=@builddir@
# Flags that can be passed during compilation
#FLAG_PRINT = -DCOSMO_PRINT=1 #enable really verbose prints
#FLAG_PRINT = -DCOSMO_PRINT_BK=2 #enable verbose book-keeping prints
#FLAG_STATISTICS = -DCOSMO_STATS=1 # enable statistics collection
#FLAG_DEBUG = -DCOSMO_DEBUG=2 # enable debugging information
#CACHE_TREE = -DCACHE_TREE # enable processor tree inside the cache
INTERLIST = -DINTERLIST_VER=2 # enable interaction lists
ifneq (,@ENABLE_CUDA@)
# Include `configure`-generated CUDA config information
include cuda.mk
endif
HEXADECAPOLE = @HEXADECAPOLE@ # use hexadecapole gravity expansions
FLAG_SSE = @FLAG_SSE@
FLAG_AVX = @FLAG_AVX@
FLAG_CHANGESOFT = @FLAG_CHANGESOFT@
FLAG_BIGKEYS = @FLAG_BIGKEYS@
FLAG_DTADJUST = @FLAG_DTADJUST@
KERNEL_FLAGS = @KERNEL_FLAGS@
FLAG_COOLING = @FLAG_COOLING@
FLAG_DIFFUSION = @FLAG_DIFFUSION@
FLAG_RTFORCE = @FLAG_RTFORCE@
FLAG_DIFFHARMONIC = @FLAG_DIFFHARMONIC@
FLAG_FEEDBACKDIFFLIMIT = @FLAG_FEEDBACKDIFFLIMIT@
FLAG_CULLENALPHA = @FLAG_CULLENALPHA@
FLAG_VSIGVISC = @FLAG_VSIGVISC@
FLAG_DAMPING = @FLAG_DAMPING@
OPTS = @OPTS@ # compiler options
### GPU_LOCAL_TREE_WALK
GPU_LOCAL_TREE_WALK = @GPU_LOCAL_TREE_WALK@
# optional CUDA flags:
# memory:
# -DHAPI_USE_CUDAMALLOCHOST
# -DHAPI_MEMPOOL
#
# verbosity, debugging:
# -DCUDA_DM_PRINT_TREES
# -DCUDA_PRINT_TRANSFERRED_INTERACTIONS
# -DCUDA_PRINT_TRANSFER_BACK_PARTICLES
# -DCUDA_NOTIFY_DATA_TRANSFER_DONE
# -DCUDA_VERBOSE_KERNEL_ENQUEUE
# -DCUDA_NO_KERNELS
# -DCUDA_NO_ACC_UPDATES
#
# print errors returned by CUDA calls:
# -DCUDA_PRINT_ERRORS
#
# for performance monitoring via projections/stats
# -DCUDA_STATS
# -DHAPI_TRACE
# -DHAPI_INSTRUMENT_WRS: to instrument time taken for each phase of a request.
# prints average transfer, kernel and cleanup times for
# various kinds of request.
#
# N.B. the CUDA build NO LONGER REQUIRES `HEXADECAPOLE' to be disabled.
ifneq ($(ENABLE_CUDA),)
CUDA = -DINTERLIST_VER=2 -DCUDA -DHAPI_USE_CUDAMALLOCHOST -DSPCUDA -DCUDA_2D_TB_KERNEL -DHAPI_MEMPOOL #-DCUDA_STATS #-DHAPI_INSTRUMENT_WRS -DCUDA_2D_FLAT
endif
# useful refactor flag combinations:
# -DCHANGA_REFACTOR_WALKCHECK
# -DCHANGA_REFACTOR_WALKCHECK_INTERLIST
# -DCHANGA_REFACTOR_INTERLIST_REALLY_VERBOSE
# -DCHANGA_REFACTOR_MEMCHECK
# -DCHANGA_REFACTOR_INTERLIST_PRINT_LIST_STATE -DCHANGA_REFACTOR_PRINT_INTERACTIONS
#
# Check walk correctness and trace walk for TEST_BUCKET on TEST_TP:
# -DCHANGA_REFACTOR_WALKCHECK_INTERLIST -DCHANGA_REFACTOR_INTERLIST_PRINT_LIST_STATE
# -DCHANGA_PRINT_INTERACTION_COUNTS
# -DCHECK_WALK_COMPLETIONS
#FLAG_REFACTOR =
# Flags for tree building. Use one or the other:
# -DMERGE_REMOTE_REQUESTS : merges remote requests before sending; local trees built after requests sent
# -DSPLIT_PHASE_TREE_BUILD : no merging of remote requests on PE; local trees built after requests sent
# debug with -DPRINT_MERGED_TREE
FLAG_TREE_BUILD = -DMERGE_REMOTE_REQUESTS
#MULTISTEP_LOADBALANCING_VERBOSE = -DCOSMO_MCLB=2 -DMCLBMSV
#ORB3DLB_LOADBALANCING_VERBOSE = -DORB3DLBV
DEFINE_FLAGS = $(FLAG_PRINT) $(FLAG_STATISTICS) $(FLAG_DEBUG) $(CACHE_TREE) \
$(INTERLIST) $(HEXADECAPOLE) $(FLAG_COOLING) $(FLAG_BIGKEYS) \
$(FLAG_DIFFUSION) $(FLAG_RTFORCE) \
$(FLAG_DIFFHARMONIC) $(FLAG_FEEDBACKDIFFLIMIT) \
$(FLAG_CULLENALPHA) $(FLAG_VSIGVISC) \
$(FLAG_DTADJUST) $(FLAG_REFACTOR) \
$(MULTISTEP_LOADBALANCING_VERBOSE) \
$(ORB3DLB_LOADBALANCING_VERBOSE) $(CUDA) \
-DREDUCTION_HELPER $(FLAG_TREE_BUILD) \
$(FLAG_DIFFHARMONIC) $(FLAG_FEEDBACKDIFFLIMIT) \
$(FLAG_SSE) $(FLAG_AVX) @FLAG_FLOAT@ \
$(FLAG_CHANGESOFT) $(FLAG_DAMPING) \
$(KERNEL_FLAGS) $(GPU_LOCAL_TREE_WALK)
CHARM_PATH = @CHARM_PATH@
STRUCTURES_PATH = $(SOURCE_DIR)/../utility/structures
CHARM_LDB_PATH = $(CHARM_PATH)/src/ck-ldb
CHARM_UTIL_PATH = $(CHARM_PATH)/src/util
CHARM_LIB_PATH = $(CHARM_PATH)/lib
METIS_SRC_PATH = $(CHARM_PATH)/src/libs/ck-libs/parmetis/METISLib
CACHE_LIB_PATH = $(CHARM_PATH)/tmp/libs/ck-libs/cache
THREADSAFE_HT_PATH = $(CACHE_LIB_PATH)/threadsafe_hashtable
ifneq (,$(ENABLE_CUDA))
NVIDIA_CUDA_SDK = $(CUDA_SDK_DIR)
NVCC_FLAGS = -c -std=c++11 -use_fast_math --ptxas-options=-v #-deviceemu -device-debug
ifdef CUDA_LEVEL
# Set target CUDA compute capability with the -arch= and -code= `nvcc` flags.
#
# Those looking for a less-naive way of specifying the target compute
# capability -- for example, one that supports devices of several different
# compute capabilities -- are encouraged to read the nVidia CUDA Compiler
# documentation starting at this link:
# <http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#virtual-architecture-feature-list>
NVCC_FLAGS += -arch=compute_$(CUDA_LEVEL) -code=sm_$(CUDA_LEVEL)
endif
NVCC_INC = -I$(CUDA_DIR)/include -I$(NVIDIA_CUDA_SDK)/common/inc -I$(CHARM_PATH)/tmp/hybridAPI -I$(CHARM_PATH)/src/arch/cuda/hybridAPI
# add $(NVCC_LIBS) to LDLIBS when compiling for cuda
NVCC_LIBS = -lcudart -lGL
endif
# add -module Orb3dLB here for load balancing during singlestepped runs
INCLUDE_FLAGS += -I$(STRUCTURES_PATH) -I.. -I$(CACHE_LIB_PATH) -I$(THREADSAFE_HT_PATH) -I$(SOURCE_DIR) -I$(BUILD_DIR) -I$(CHARM_UTIL_PATH)
CPPFLAGS += $(INCLUDE_FLAGS) $(DEFINE_FLAGS) @CPPFLAGS@
CXXFLAGS += $(OPTS) $(CPPFLAGS)
LDFLAGS += $(OPTS) -L. -L../libs @LDFLAGS@ -language charm++ -module CkCache \
-module CkIO -module CkMulticast -module RefineLB \
-module RefineCommLB -module GreedyLB -module GreedyCommLB \
-module OrbLB -module RotateLB -module MultistepLB \
-module MultistepLB_notopo -module MultistepNodeLB_notopo \
-module MultistepOrbLB -module Orb3dLB -module Orb3dLB_notopo \
-module HierarchOrbLB -module liveViz -module CkLoop \
-balancer MultistepLB_notopo \
#-tracemode projections -memory charmdebug -memory paranoid
XDR_DIR = ../rpc
XDR_OBJS = $(XDR_DIR)/xdr.o $(XDR_DIR)/xdr_float.o $(XDR_DIR)/xdr_mem.o $(XDR_DIR)/xdr_stdio.o
LDLIBS += $(STRUCTURES_PATH)/libTipsy.a @LIBS@
CHARMC = $(CHARM_PATH)/bin/charmc
CXX = $(CHARMC)
CC = $(CXX)
AR = @AR@
CXX_DEPEND = $(CXX) -M -MM -MG $(CXXFLAGS)
CFLAGS = $(OPTS) $(DEFINE_FLAGS) -I$(SOURCE_DIR) -I$(BUILD_DIR) @CFLAGS@ @CPPFLAGS@
# Orb3dLB.{o,C} below
OBJECTS = Reductions.o DataManager.o TreePiece.o IntraNodeLBManager.o Sorter.o \
param.o GenericTreeNode.o ParallelGravity.o Ewald.o \
InOutput.o cosmo.o romberg.o runge.o dumpframe.o dffuncs.o \
moments.o MultistepLB.o Orb3dLB.o Orb3dLB_notopo.o HierarchOrbLB.o \
MultistepLB_notopo.o MultistepNodeLB_notopo.o MultistepOrbLB.o PETreeMerger.o \
TreeWalk.o Compute.o CacheInterface.o smooth.o Sph.o starform.o \
feedback.o imf.o supernova.o supernovaia.o starlifetime.o \
sinks.o \
cha_commitid.o externalGravity.o \
@OBJECTS_COOLING@
SRSC = Reductions.cpp DataManager.cpp Sorter.cpp TreePiece.cpp IntraNodeLBManager.cpp \
param.c GenericTreeNode.cpp ParallelGravity.cpp Ewald.cpp \
InOutput.cpp cosmo.c romberg.c runge.c dumpframe.cpp dffuncs.cpp \
moments.c MultistepLB.cpp Orb3dLB.cpp Orb3dLB_notopo.cpp HierarchOrbLB.cpp starform.cpp \
MultistepLB_notopo.cpp MultistepNodeLB_notopo.cpp MultistepOrbLB.cpp PETreeMerger.cpp \
TreeWalk.cpp Compute.cpp CacheInterface.cpp smooth.cpp Sph.cpp externalGravity.cpp \
starform.cpp feedback.cpp imf.cpp supernova.cpp supernovaia.cpp starlifetime.cpp \
sinks.cpp
ifneq (,$(ENABLE_CUDA))
CXXFLAGS += $(NVCC_INC)
OBJECTS += HostCUDA.o
SRSC += HostCUDA.cu
LDLIBS += $(NVCC_LIBS)
NVCC_FLAGS += $(INCLUDE_FLAGS) $(DEFINE_FLAGS)
LDFLAGS += -L$(NVIDIA_CUDA_SDK)/lib -L$(CUDA_DIR)/lib64
endif
TARGET = ChaNGa
VERSION = 1.0
all: $(TARGET)
# Make's built-in database doesn't provide pattern rules for out-of-source
# builds, so we provide them here.
%.o: $(SOURCE_DIR)/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o: $(SOURCE_DIR)/%.c
$(CC) $(CFLAGS) -c -o $@ $<
$(TARGET): $(OBJECTS) $(STRUCTURES_PATH)/libTipsy.a libmoduleMultistepLB.a libmoduleOrb3dLB.a libmoduleOrb3dLB_notopo.a libmoduleHierarchOrbLB.a libmoduleMultistepLB_notopo.a libmoduleMultistepNodeLB_notopo.a libmoduleMultistepOrbLB.a
$(CHARMC) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(LDLIBS)
$(TARGET).prj: $(OBJECTS) $(STRUCTURES_PATH)/libTipsy.a libmoduleMultistepLB.a libmoduleOrb3dLB.a libmoduleOrb3dLB_notopo.a libmoduleHierarchOrbLB.a libmoduleMultistepLB_notopo.a libmoduleMultistepNodeLB_notopo.a libmoduleMultistepOrbLB.a
$(CHARMC) -o $(TARGET).prj $(LDFLAGS) $(OBJECTS) $(LDLIBS) -tracemode projections
$(TARGET).%: $(TARGET)
mv $(TARGET) $@
mv charmrun charmrun.$*
VERSION: VERSION.new
$(SOURCE_DIR)/commitid.sh
cha_commitid.c: VERSION
echo "extern const char * const Cha_CommitID;" > $@
echo "const char * const Cha_CommitID = \"`cat $<`\";" >> $@
cha_commitid.o: CC=$(CHARMC)
$(STRUCTURES_PATH)/libTipsy.a:
cd $(STRUCTURES_PATH); $(MAKE) libTipsy.a
libmoduleMultistepLB.a: MultistepLB.o
$(CHARMC) -o libmoduleMultistepLB.a MultistepLB.o
libmoduleMultistepOrbLB.a: MultistepOrbLB.o
$(CHARMC) -o libmoduleMultistepOrbLB.a MultistepOrbLB.o
libmoduleMultistepLB_notopo.a: MultistepLB_notopo.o
$(CHARMC) -o libmoduleMultistepLB_notopo.a MultistepLB_notopo.o
libmoduleMultistepNodeLB_notopo.a: MultistepNodeLB_notopo.o
$(CHARMC) -o libmoduleMultistepNodeLB_notopo.a MultistepNodeLB_notopo.o
libmoduleOrb3dLB.a: Orb3dLB.o
$(CHARMC) -o libmoduleOrb3dLB.a Orb3dLB.o
libmoduleOrb3dLB_notopo.a: Orb3dLB_notopo.o
$(CHARMC) -o libmoduleOrb3dLB_notopo.a Orb3dLB_notopo.o
libmoduleHierarchOrbLB.a: HierarchOrbLB.o
$(CHARMC) -o libmoduleHierarchOrbLB.a HierarchOrbLB.o
%.ci.stamp: $(SOURCE_DIR)/%.ci
$(CHARMC) -E $(DEFINE_FLAGS) $<
touch $@
%.decl.h %.def.h: %.ci.stamp
@true
HostCUDA.o: $(SOURCE_DIR)/HostCUDA.cu $(SOURCE_DIR)/HostCUDA.h
$(NVCC) $(NVCC_FLAGS) $(NVCC_INC) $<
Makefile: $(SOURCE_DIR)/Makefile.in
@echo 'Makefile.in changed; re-running `configure`'
@$(BUILD_DIR)/config.status
%.o: Makefile
docs:
doxygen $(SOURCE_DIR)/Doxyfile
DIRS = teststep
test: $(TARGET)
for d in $(DIRS); do \
(cd $$d && $(MAKE) test OPTS='$(OPTS)' || exit 1) || exit 1; \
done
dist:
mkdir $(TARGET)-$(VERSION)
cp Makefile $(TARGET).doxygen *.h *.cpp *.ci $(TARGET)-$(VERSION)/
tar zcf $(TARGET)-$(VERSION).tar.gz $(TARGET)-$(VERSION)
rm -Rf $(TARGET)-$(VERSION)
clean:
rm -f core* $(OBJECTS) *~ $(TARGET) *.decl.h *.def.h *.ci.stamp charmrun conv-host
rm -f *.o *.a
cd $(STRUCTURES_PATH); $(MAKE) clean
ref-clean:
rm -f $(TARGET) Compute.o TreeWalk.o
dist-clean: clean
@ $(RM) *.a config.status config.log cuda.mk Makefile.dep
depends: $(SOURCE_DIR)/Makefile.dep
$(BUILD_DIR)/Makefile.dep:
FULLPATHS=""; for file in $(SRSC); do FULLPATHS="$(SOURCE_DIR)/$$file $$FULLPATHS"; done; \
$(CXX_DEPEND) $$FULLPATHS | while read i;do echo $$i| awk -F' ' '{for (i=1;i<NF;++i) print $$i" \\"}';echo;done|grep -v "$(CHARM_PATH)/bin" | grep -v "hashtable_mt.h" > $@
# depend:
# $(CXX_DEPEND) $(SRSC) > Makefile.dep
# The following line is a script usable to regenerate the dependace file,
# without the inclusion of charm headers.
# $CHARM_DIR/bin/charmc -M -MM -MG -O3 -I../utility/structures -I../ParallelGravity -Wall -DCOSMO_STATS=1 -DCOSMO_DEBUG=2 -DINTERLIST_VER=2 -DHEXADECAPOLE -DCACHE_TREE -DCOOLING_NONE Reductions.cpp DataManager.cpp Sorter.cpp TreePiece.cpp param.cpp GenericTreeNode.cpp ParallelGravity.cpp Ewald.cpp InOutput.cpp cosmo.cpp romberg.cpp runge.cpp dumpframe.cpp dffuncs.cpp moments.cpp MultistepLB.cpp Orb3dLB.cpp TreeWalk.cpp Compute.cpp | while read i;do echo $i| awk -F' ' '{for (i=1;i<NF;++i) print $i" \\"}';echo;done|grep -v "charm/bin" > Makefile.dep
.PHONY: all docs dist clean depend test VERSION.new
-include $(BUILD_DIR)/Makefile.dep