-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
214 lines (178 loc) · 6.34 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
#
# Elemental: A framework for distributed memory dense linear algebra.
#
# Copyright 2009-2010 Jack Poulson
#
srcdir = src
incdir = include
testdir = test
libdir = lib
bindir = bin
library = libelemental.a
#WITHOUT_COMPLEX =
# Compile flags:
# WITHOUT_COMPLEX: if defined, no complex datatypes are implemented
# FUNDERSCORE: if defined, all BLAS/LAPACK wrappers assume underscores
# POOL_MEMORY: if defined, Memory class only accumulates until destruction
# RELEASE: if defined, callstack is not maintained and debug checks are off
CXX = mpicxx
#CXXFLAGS = -DFUNDERSCORE -I$(incdir)
CXXFLAGS = -DWITHOUT_COMPLEX -DFUNDERSCORE -I$(incdir)
CXXFLAGS_DEBUG = -g -Wall $(CXXFLAGS)
CXXFLAGS_RELEASE = -O3 -Wall -DRELEASE $(CXXFLAGS)
#LDFLAGS = -llapack -lblas -L/usr/lib
LDFLAGS = -mkl -L/usr/lib
AR = ar
ARFLAGS = rc
################################################################################
# Only developers should edit past this point. #
################################################################################
# Source/object organization
coredir = core
corefiles = Environment.cpp \
Grid.cpp \
Matrix.cpp \
DistMatrix/MC_MR.cpp \
DistMatrix/MC_Star.cpp \
DistMatrix/MR_MC.cpp \
DistMatrix/MR_Star.cpp \
DistMatrix/Star_MC.cpp \
DistMatrix/Star_MR.cpp \
DistMatrix/Star_Star.cpp \
DistMatrix/Star_VC.cpp \
DistMatrix/Star_VR.cpp \
DistMatrix/VC_Star.cpp \
DistMatrix/VR_Star.cpp \
coresrc = $(addprefix $(coredir)/,$(corefiles))
blasdir = BLAS
blasfiles = Level2/Gemv/Gemv.cpp \
Level2/Gemv/GemvN.cpp \
Level2/Ger/Ger.cpp \
Level3/Gemm/Gemm.cpp \
Level3/Gemm/GemmNN.cpp \
blassrc = $(addprefix $(blasdir)/,$(blasfiles))
lapackdir = LAPACK
lapackfiles = #Chol/Chol.cpp \
#Chol/CholL.cpp \
#Chol/CholU.cpp \
lapacksrc = $(addprefix $(lapackdir)/,$(lapackfiles))
# The entire list of source files relative to $(srcdir)
src = $(coresrc) $(blassrc) $(lapacksrc)
includefiles = Elemental.h \
ElementalBLAS.h \
ElementalBLAS_Internal.h \
ElementalDistMatrix.h \
ElementalDistMatrix_MC_MR.h \
ElementalDistMatrix_MC_Star.h \
ElementalDistMatrix_MR_MC.h \
ElementalDistMatrix_MR_Star.h \
ElementalDistMatrix_Star_MC.h \
ElementalDistMatrix_Star_MR.h \
ElementalDistMatrix_Star_Star.h \
ElementalDistMatrix_Star_VC.h \
ElementalDistMatrix_Star_VR.h \
ElementalDistMatrix_VC_Star.h \
ElementalDistMatrix_VR_Star.h \
ElementalEnvironment.h \
ElementalGrid.h \
ElementalMemory.h \
ElementalMatrix.h \
ElementalPartitioning.h \
ElementalRandom.h \
ElementalTypes.h \
wrappers/BLAS.h \
wrappers/MPI.h \
includes = $(addprefix $(incdir)/,$(includefiles)) \
$(srcdir)/$(coredir)/DistMatrix/DistMatrixMacros.h
################################################################################
# make #
################################################################################
libdir_debug = $(libdir)/debug
libdir_release = $(libdir)/release
obj_debug = $(addprefix $(libdir_debug)/,$(src:.cpp=.o))
obj_release = $(addprefix $(libdir_release)/,$(src:.cpp=.o))
library_debug = $(libdir_debug)/$(library)
library_release = $(libdir_release)/$(library)
# This is the default target
.PHONY : lib
lib: release debug
.PHONY : debug
debug: $(library_debug)
.PHONY : release
release: $(library_release)
$(library_debug): $(obj_debug)
@echo "[ debug ] Creating $@"
@$(AR) $(ARFLAGS) $@ $^
$(library_release): $(obj_release)
@echo "[release] Creating $@"
@$(AR) $(ARFLAGS) $@ $^
# Object files must depend upon headers because we inline functions
$(libdir_debug)/%.o: $(srcdir)/%.cpp $(includes)
@mkdir -p $(dir $@)
@echo "[ debug ] Compiling $<"
@$(CXX) $(CXXFLAGS_DEBUG) -c -o $@ $<
$(libdir_release)/%.o: $(srcdir)/%.cpp $(includes)
@mkdir -p $(dir $@)
@echo "[release] Compiling $<"
@$(CXX) $(CXXFLAGS_RELEASE) -c -o $@ $<
################################################################################
# make test #
################################################################################
bindir_debug = $(bindir)/debug
bindir_release = $(bindir)/release
tests = DistMatrix \
BLAS/Gemm \
BLAS/Gemv \
BLAS/Ger \
#BLAS/Hemm \
#BLAS/Her2k \
#BLAS/Herk \
#BLAS/Symm \
#BLAS/Symv \
#BLAS/Syr2k \
#BLAS/Syrk \
#BLAS/Trmm \
#BLAS/Trsm \
#LAPACK/Chol \
#LAPACK/LU \
#LAPACK/Tridiag \
#LAPACK/Trinv
testobjs = $(addsuffix .o, $(tests))
tests_debug = $(addprefix $(bindir_debug)/, $(tests))
testobjs_debug = $(addprefix $(bindir_debug)/, $(testobjs))
tests_release = $(addprefix $(bindir_release)/, $(tests))
.PHONY : test
test: test-release test-debug
.PHONY : test-debug
test-debug: $(tests_debug) $(testobjs_debug)
.PHONY : test-release
test-release: $(tests_release)
$(bindir_debug)/%: $(bindir_debug)/%.o $(library_debug)
@echo "[ debug ] Creating $@"
@$(CXX) -o $@ $^ $(LDFLAGS)
$(bindir_release)/%: $(bindir_release)/%.o $(library_release)
@echo "[release] Creating $@"
@$(CXX) -o $@ $^ $(LDFLAGS)
$(bindir_debug)/%.o: $(testdir)/%.cpp $(includes)
@mkdir -p $(dir $@)
@echo "[ debug ] Compiling $<"
@$(CXX) $(CXXFLAGS_DEBUG) -c -o $@ $<
$(bindir_release)/%.o: $(testdir)/%.cpp $(includes)
@mkdir -p $(dir $@)
@echo "[release] Compiling $<"
@$(CXX) $(CXXFLAGS_RELEASE) -c -o $@ $<
################################################################################
# make clean #
################################################################################
.PHONY : clean
clean:
@rm -Rf lib/
@rm -Rf bin/
.PHONY : clean-debug
clean-debug:
@rm -Rf lib/debug
@rm -Rf bin/debug
.PHONY : clean-release
clean-release:
@rm -Rf lib/release
@rm -Rf bin/release