-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathmakefile
338 lines (263 loc) · 9.78 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
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
#===================================================================
#
# Makefile for VAMPIRE
#
#===================================================================
# Specify compiler for MPI compilation with openmpi
export OMPI_CXX=g++ -std=c++0x
#export OMPI_CXX=icc
#export OMPI_CXX=pathCC
# Specify compiler for MPI compilation with mpich
#export MPICH_CXX=g++
#export MPICH_CXX=bgxlc++
# Compilers
ICC=icc -std=c++0x -DCOMP='"Intel C++ Compiler"'
GCC=g++ -std=c++0x -DCOMP='"GNU C++ Compiler"'
LLVM=g++ -DCOMP='"LLVM C++ Compiler"'
PCC=pathCC -DCOMP='"Pathscale C++ Compiler"'
IBM=bgxlc++ -DCOMP='"IBM XLC++ Compiler"'
MPICC=mpicxx -DMPICF
MPIICC=mpiicpc -DMPICF
CCC_CFLAGS=-I./hdr -I./src/qvoronoi -O0
CCC_LDFLAGS=-I./hdr -I./src/qvoronoi -O0
export LANG=C
export LC_ALL=C
# LIBS
LIBS=
CUDALIBS=-L/usr/local/cuda/lib64/ -lcuda -lcudart
# Debug Flags
ICC_DBCFLAGS= -O0 -C -I./hdr -I./src/qvoronoi
ICC_DBLFLAGS= -C -I./hdr -I./src/qvoronoi
GCC_DBCFLAGS= -g -pg -fprofile-arcs -ftest-coverage -Wall -Wextra -O0 -fbounds-check -pedantic -std=c++0x -Wno-long-long -I./hdr -I./src/qvoronoi
GCC_DBLFLAGS= -g -pg -fprofile-arcs -ftest-coverage -lstdc++ -std=c++0x -fbounds-check -I./hdr -I./src/qvoronoi
PCC_DBCFLAGS= -O0 -I./hdr -I./src/qvoronoi
PCC_DBLFLAGS= -O0 -I./hdr -I./src/qvoronoi
IBM_DBCFLAGS= -O0 -Wall -pedantic -Wextra -I./hdr -I./src/qvoronoi
IBM_DBLFLAGS= -O0 -Wall -pedantic -Wextra -I./hdr -I./src/qvoronoi
LLVM_DBCFLAGS= -Wall -Wextra -O0 -pedantic -std=c++11 -Wno-long-long -I./hdr -I./src/qvoronoi
LLVM_DBLFLAGS= -Wall -Wextra -O0 -lstdc++ -I./hdr -I./src/qvoronoi
# Performance Flags
ICC_CFLAGS= -O3 -axCORE-AVX2 -fno-alias -align -falign-functions -I./hdr -I./src/qvoronoi
ICC_LDFLAGS= -I./hdr -I./src/qvoronoi -axCORE-AVX2
#ICC_CFLAGS= -O3 -xT -ipo -static -fno-alias -align -falign-functions -vec-report -I./hdr
#ICC_LDFLAGS= -lstdc++ -ipo -I./hdr -xT -vec-report
LLVM_CFLAGS= -Wall -pedantic -O3 -mtune=native -funroll-loops -I./hdr -I./src/qvoronoi
LLVM_LDFLAGS= -lstdc++ -I./hdr -I./src/qvoronoi
GCC_CFLAGS=-O3 -mtune=native -funroll-all-loops -fexpensive-optimizations -funroll-loops -I./hdr -I./src/qvoronoi -std=c++0x
GCC_LDFLAGS= -lstdc++ -I./hdr -I./src/qvoronoi
PCC_CFLAGS=-O2 -march=barcelona -ipa -I./hdr -I./src/qvoronoi
PCC_LDFLAGS= -I./hdr -I./src/qvoronoi -O2 -march=barcelona -ipa
IBM_CFLAGS=-O5 -qarch=450 -qtune=450 -I./hdr -I./src/qvoronoi
IBM_LDFLAGS= -lstdc++ -I./hdr -I./src/qvoronoi -O5 -qarch=450 -qtune=450
CRAY_CFLAGS= -O3 -hfp3 -I./hdr -I./src/qvoronoi
CRAY_LDFLAGS= -I./hdr -I./src/qvoronoi
# Save git commit in simple function
GHASH:=$(shell git rev-parse HEAD)
# special options for certain files
OPTIONS=
# Objects
OBJECTS= \
obj/data/atoms.o \
obj/data/category.o \
obj/data/grains.o \
obj/random/mtrand.o \
obj/random/random.o \
obj/simulate/energy.o \
obj/simulate/fields.o \
obj/simulate/LLB.o \
obj/simulate/LLGHeun.o \
obj/simulate/LLGMidpoint.o \
obj/simulate/sim.o \
obj/simulate/standard_programs.o \
obj/spintorque/data.o \
obj/spintorque/field.o \
obj/spintorque/initialise.o \
obj/spintorque/interface.o \
obj/spintorque/magnetization.o \
obj/spintorque/matrix.o \
obj/spintorque/output.o \
obj/spintorque/spinaccumulation.o \
obj/utility/checkpoint.o \
obj/utility/errors.o \
obj/utility/statistics.o \
obj/utility/units.o \
obj/utility/vmath.o\
obj/qvoronoi/geom.o\
obj/qvoronoi/geom2.o\
obj/qvoronoi/global.o\
obj/qvoronoi/io.o\
obj/qvoronoi/libqhull.o\
obj/qvoronoi/mem.o\
obj/qvoronoi/merge.o\
obj/qvoronoi/poly.o\
obj/qvoronoi/poly2.o\
obj/qvoronoi/qhrandom.o\
obj/qvoronoi/qset.o\
obj/qvoronoi/qvoronoi.o\
obj/qvoronoi/rboxlib.o\
obj/qvoronoi/stat.o\
obj/qvoronoi/user.o\
obj/qvoronoi/usermem.o\
obj/qvoronoi/userprintf.o\
obj/qvoronoi/userprintf_rbox.o\
# Include supplementary makefiles
include src/anisotropy/makefile
include src/cells/makefile
include src/create/makefile
include src/config/makefile
include src/constants/makefile
include src/dipole/makefile
include src/exchange/makefile
include src/gpu/makefile
include src/ltmp/makefile
include src/main/makefile
include src/montecarlo/makefile
include src/mpi/makefile
include src/neighbours/makefile
include src/program/makefile
include src/simulate/makefile
include src/statistics/makefile
include src/unitcell/makefile
include src/vio/makefile
# Cuda must be last for some odd reason
include src/cuda/makefile
include src/opencl/makefile
ICC_OBJECTS=$(OBJECTS:.o=_i.o)
LLVM_OBJECTS=$(OBJECTS:.o=_llvm.o)
IBM_OBJECTS=$(OBJECTS:.o=_ibm.o)
ICCDB_OBJECTS=$(OBJECTS:.o=_idb.o)
GCCDB_OBJECTS=$(OBJECTS:.o=_gdb.o)
PCCDB_OBJECTS=$(OBJECTS:.o=_pdb.o)
IBMDB_OBJECTS=$(OBJECTS:.o=_ibmdb.o)
LLVMDB_OBJECTS=$(OBJECTS:.o=_llvmdb.o)
MPI_OBJECTS=$(OBJECTS:.o=_mpi.o)
MPI_ICC_OBJECTS=$(OBJECTS:.o=_i_mpi.o)
MPI_LLVM_OBJECTS=$(OBJECTS:.o=_llvm_mpi.o)
MPI_PCC_OBJECTS=$(OBJECTS:.o=_p_mpi.o)
MPI_IBM_OBJECTS=$(OBJECTS:.o=_ibm_mpi.o)
MPI_CRAY_OBJECTS=$(OBJECTS:.o=_cray_mpi.o)
MPI_ICCDB_OBJECTS=$(OBJECTS:.o=_idb_mpi.o)
MPI_GCCDB_OBJECTS=$(OBJECTS:.o=_gdb_mpi.o)
MPI_PCCDB_OBJECTS=$(OBJECTS:.o=_pdb_mpi.o)
MPI_IBMDB_OBJECTS=$(OBJECTS:.o=_ibmdb_mpi.o)
MPI_CRAYDB_OBJECTS=$(OBJECTS:.o=_craydb_mpi.o)
MPI_ARCHER_OBJECTS=$(OBJECTS:.o=_archer_mpi.o)
CLEXECUTABLE=vampire-opencl
CUDAEXECUTABLE=vampire-cuda
EXECUTABLE=vampire-serial
PEXECUTABLE=vampire-parallel
# Set default make target in GNU make > v3.81
.DEFAULT_GOAL := all
# make serial and parallel versions and utilities
all: serial parallel vdc
# Serial Targets
serial: $(OBJECTS)
$(GCC) $(GCC_LDFLAGS) $(LIBS) $(OBJECTS) -o $(EXECUTABLE)
$(OBJECTS): obj/%.o: src/%.cpp
$(GCC) -c -o $@ $(GCC_CFLAGS) $(OPTIONS) $<
serial-intel: $(ICC_OBJECTS)
$(ICC) $(ICC_LDFLAGS) $(LIBS) $(ICC_OBJECTS) -o $(EXECUTABLE)-intel
$(ICC_OBJECTS): obj/%_i.o: src/%.cpp
$(ICC) -c -o $@ $(ICC_CFLAGS) $(OPTIONS) $<
serial-llvm: $(LLVM_OBJECTS)
$(LLVM) $(LLVM_LDFLAGS) $(LIBS) $(LLVM_OBJECTS) -o $(EXECUTABLE)
$(LLVM_OBJECTS): obj/%_llvm.o: src/%.cpp
$(LLVM) -c -o $@ $(LLVM_CFLAGS) $(OPTIONS) $<
serial-ibm: $(IBM_OBJECTS)
$(IBM) $(IBM_LDFLAGS) $(IBM_OBJECTS) -o $(EXECUTABLE)
$(IBM_OBJECTS): obj/%_ibm.o: src/%.cpp
$(IBM) -c -o $@ $(IBM_CFLAGS) $(OPTIONS) $<
serial-debug: $(GCCDB_OBJECTS)
$(GCC) $(GCC_DBLFLAGS) $(LIBS) $(GCCDB_OBJECTS) -o $(EXECUTABLE)-debug
$(GCCDB_OBJECTS): obj/%_gdb.o: src/%.cpp
$(GCC) -c -o $@ $(GCC_DBCFLAGS) $(OPTIONS) $<
serial-llvm-debug: $(LLVMDB_OBJECTS)
$(LLVM) $(LLVM_DBLFLAGS) $(LIBS) $(LLVMDB_OBJECTS) -o $(EXECUTABLE)
$(LLVMDB_OBJECTS): obj/%_llvmdb.o: src/%.cpp
$(LLVM) -c -o $@ $(LLVM_DBCFLAGS) $(OPTIONS) $<
intel-debug: $(ICCDB_OBJECTS)
$(ICC) $(ICC_DBLFLAGS) $(LIBS) $(ICCDB_OBJECTS) -o $(EXECUTABLE)-intel-debug
$(ICCDB_OBJECTS): obj/%_idb.o: src/%.cpp
$(ICC) -c -o $@ $(ICC_DBCFLAGS) $(OPTIONS) $<
pathscale-debug: $(ICCDB_OBJECTS)
$(PCC) $(PCC_DBLFLAGS) $(LIBS) $(PCCDB_OBJECTS) -o $(EXECUTABLE)
$(PCCDB_OBJECTS): obj/%_pdb.o: src/%.cpp
$(PCC) -c -o $@ $(PCC_DBCFLAGS) $(OPTIONS) $<
#ibm-debug: $(ICCDB_OBJECTS)
# $(PCC) $(PCC_DBLFLAGS) $(PCCDB_OBJECTS) -o $(EXECUTABLE)
#$(IBMDB_OBJECTS): obj/%_pdb.o: src/%.cpp
# $(PCC) -c -o $@ $(PCC_DBCFLAGS) $<
# MPI Targets
parallel: $(MPI_OBJECTS)
$(MPICC) $(GCC_LDFLAGS) $(LIBS) $(MPI_OBJECTS) -o $(PEXECUTABLE)
$(MPI_OBJECTS): obj/%_mpi.o: src/%.cpp
$(MPICC) -c -o $@ $(GCC_CFLAGS) $(OPTIONS) $<
parallel-intel: $(MPI_ICC_OBJECTS)
$(MPIICC) $(ICC_LDFLAGS) $(LIBS) $(MPI_ICC_OBJECTS) -o $(PEXECUTABLE)-intel
$(MPI_ICC_OBJECTS): obj/%_i_mpi.o: src/%.cpp
$(MPIICC) -c -o $@ $(ICC_CFLAGS) $<
parallel-cray: $(MPI_CRAY_OBJECTS)
$(MPICC) $(CRAY_LDFLAGS) $(LIBS) $(MPI_CRAY_OBJECTS) -o $(PEXECUTABLE)
$(MPI_CRAY_OBJECTS): obj/%_cray_mpi.o: src/%.cpp
$(MPICC) -c -o $@ $(CRAY_CFLAGS) $<
parallel-archer: $(MPI_ARCHER_OBJECTS)
CC -DMPICF $(GCC_LDFLAGS) $(LIBS) $(MPI_ARCHER_OBJECTS) -o $(PEXECUTABLE)
$(MPI_ARCHER_OBJECTS): obj/%_archer_mpi.o: src/%.cpp
CC -DMPICF -c -o $@ $(GCC_CFLAGS) $<
parallel-llvm: $(MPI_LLVM_OBJECTS)
$(MPICC) $(LLVM_LDFLAGS) $(LIBS) $(MPI_LLVM_OBJECTS) -o $(PEXECUTABLE)
$(MPI_LLVM_OBJECTS): obj/%_llvm_mpi.o: src/%.cpp
$(MPICC) -c -o $@ $(LLVM_CFLAGS) $(OPTIONS) $<
parallel-pathscale: $(MPI_PCC_OBJECTS)
$(MPICC) $(PCC_LDFLAGS) $(LIBS) $(MPI_PCC_OBJECTS) -o $(PEXECUTABLE)
$(MPI_PCC_OBJECTS): obj/%_p_mpi.o: src/%.cpp
$(MPICC) -c -o $@ $(PCC_CFLAGS) $(OPTIONS) $<
parallel-ibm: $(MPI_IBM_OBJECTS)
$(MPICC) $(IBM_LDFLAGS) $(MPI_IBM_OBJECTS) -o $(PEXECUTABLE)
$(MPI_IBM_OBJECTS): obj/%_ibm_mpi.o: src/%.cpp
$(MPICC) -c -o $@ $(IBM_CFLAGS) $(OPTIONS) $<
parallel-debug: $(MPI_GCCDB_OBJECTS)
$(MPICC) $(GCC_DBLFLAGS) $(LIBS) $(MPI_GCCDB_OBJECTS) -o $(PEXECUTABLE)-debug
$(MPI_GCCDB_OBJECTS): obj/%_gdb_mpi.o: src/%.cpp
$(MPICC) -c -o $@ $(GCC_DBCFLAGS) $(OPTIONS) $<
parallel-intel-debug: $(MPI_ICCDB_OBJECTS)
$(MPIICC) $(ICC_DBLFLAGS) $(LIBS) $(MPI_ICCDB_OBJECTS) -o $(PEXECUTABLE)-intel-debug
$(MPI_ICCDB_OBJECTS): obj/%_idb_mpi.o: src/%.cpp
$(MPIICC) -c -o $@ $(ICC_DBCFLAGS) $(OPTIONS) $<
parallel-cray-debug: $(MPI_CRAY_OBJECTS)
$(MPICC) $(CCC_LDFLAGS) $(LIBS) $(MPI_CRAYDB_OBJECTS) -o $(PEXECUTABLE)
$(MPI_CRAYDB_OBJECTS): obj/%_craydb_mpi.o: src/%.cpp
$(MPICC) -c -o $@ $(CCC_CFLAGS) $(OPTIONS) $<
parallel-pathscale-debug: $(MPI_PCCDB_OBJECTS)
$(MPICC) $(PCC_DBLFLAGS) $(LIBS) $(MPI_PCCDB_OBJECTS) -o $(PEXECUTABLE)
$(MPI_PCCDB_OBJECTS): obj/%_pdb_mpi.o: src/%.cpp
$(MPICC) -c -o $@ $(PCC_DBCFLAGS) $(OPTIONS) $<
clean:
@rm -f obj/*.o
@rm -f obj/*/*.o
purge:
@rm -f obj/*.o
@rm -f obj/*/*.o
@rm -f vampire-*
tidy:
@rm -f *~
@rm -f hdr/*~
@rm -f src/*~
@rm -f src/*/*~
vdc:
$(MAKE) -C util/vdc/
install:
echo "Preparing installation package"
rm -rf vampire.pkg
mkdir vampire.pkg
mkdir vampire.pkg/bin
cp vampire-* vampire.pkg/bin/
cp util/vdc/vdc vampire.pkg/bin/
mkdir vampire.pkg/examples
cp input vampire.pkg/examples/
cp Co.mat vampire.pkg/examples/
sudo mv -f vampire.pkg /opt/vampire
sudo echo "/opt/vampire/bin" > /etc/paths.d/vampire_path
uninstall:
rm -rf /opt/vampire
rm -f /etc/paths.d/vampire_path