-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
238 lines (204 loc) · 6.14 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
# User-editable options
#
# 1. choose parallel or sequential build
# if it's defined
ifdef SEQUENTIAL
ifeq ($(SEQUENTIAL), false)
else
SEQUENTIAL=true
endif
else
SEQUENTIAL=true
#SEQUENTIAL=false
endif
ifeq ($(SEQUENTIAL), false)
FFLAGS+=-DVALENCE_MPI
endif
# 2. choose compiler (INTEL or GNU)
#COMPILER_VENDOR=INTEL
COMPILER_VENDOR=GNU
ifeq ($(COMPILER_VENDOR), GNU)
ifeq ($(SEQUENTIAL), false)
FC=mpifort
F77=mpifort
CC=mpicc
else
FC=gfortran
F77=gfortran
CC=gcc
endif
endif
ifeq ($(COMPILER_VENDOR), INTEL)
ifeq ($(SEQUENTIAL), false)
FC=mpiifort
F77=mpiifort
CC=mpiicc
else
FC=ifort
F77=ifort
CC=icc
endif
FFLAGS+=-align array64byte -mkl
endif
# 3. choose SIMINT base path
SIMINT_BASE=./simint
INTEGRALS=USE_SIMINT
ifeq ($(INTEGRALS), USE_SIMINT)
SIMINT_LIBRARY=$(SIMINT_BASE)/lib/
SIMINT_INCLUDE=$(SIMINT_BASE)/include/simint
# alignment here is necessary if simint is vectorized
# CCA order changes the ordering of integrals to Common Component Architecture order
FFLAGS+=-DSIMINT_INT -DCCA_ORDER -I$(SIMINT_INCLUDE)
LINK_FLAGS+=$(SIMINT_LIBRARY)libsimint.a
endif
# 4. choose MPI library (full path) - optional
#MPI_LIBRARY=/home/my_libs/mpi
# 5. choose shared object or static library
# if BUILD_SHARED_LIB is set in the environment to false,
# then build a static library. if it's set to anything else,
# build a shared object. If it's not set, build a static
# library.
ifdef BUILD_SHARED_LIB
ifeq ($(BUILD_SHARED_LIB),false)
else
BUILD_SHARED_LIB=true
endif
else
BUILD_SHARED_LIB=false
endif
###### WARNING: some expertise required to edit below here!
GIVENS=USE_FORTRAN
#GIVENS=USE_FORTRAN_KNL
#GIVENS=USE_C
#GIVENS=USE_LAPACK
#PRINT_MATRIX=yes
PRINT_MATRIX=no
#PRINT_TIMING=yes
PRINT_TIMING=no
#PRINT_COUNTERS=yes
PRINT_COUNTERS=no
ifeq ($(findstring theta,$(HOSTNAME)),theta)
FC=ftn
F77=ftn
CC=cc
FFLAGS+=-align array64byte -mkl
endif
ifeq ($(findstring mira,$(HOSTNAME)),mira)
FC=mpixlf90_r
F77=mpixlf77_r
CC=mpixlc
endif
CFLAGS=-O3 -g
FFLAGS+=-O3 -g $(VALENCE_EXTRA_FLAGS)
ifeq ($(BUILD_SHARED_LIB),false)
else
FFLAGS+=-fPIC
# this option is for parallel VALENCE runs during
# integration with NITROGEN. The integration will
# still work with NITROGEN in serial if this flag
# is not set. This is only for if one wishes to
# run VALENCE in parallel during a NITROGEN run
# FFLAGS+=-DVALENCE_NITROGEN_PARALLEL
endif
OBJS=givens.o rsg.o tools_module.o valence_simint_module.o density_module.o\
integrals_module.o valence.o timing_flops_module.o xm_module.o \
valence_api_nitrogen.o valence_api.o valence_initialize_module.o \
valence_finalize_module.o
ifeq ($(GIVENS), USE_C)
FFLAGS=-O3 -g -DUSE_C_VERSION
OBJS += givens_in_c.o
endif
ifeq ($(GIVENS), USE_LAPACK)
FFLAGS+=-DUSE_LAPACK
endif
ifeq ($(GIVENS), USE_FORTRAN)
FFLAGS+=-DUSE_FORTRAN_VERSION
endif
ifeq ($(GIVENS), USE_FORTRAN_KNL)
FFLAGS+=-DGIVENS_KNL
endif
ifeq ($(PRINT_MATRIX), yes)
FFLAGS+=-DPRINT_MATRIX
endif
ifeq ($(PRINT_TIMING), yes)
FFLAGS+=-DPRINT_TIMING
endif
ifeq ($(PRINT_COUNTERS), yes)
FFLAGS+=-DPRINT_COUNTERS
endif
# change these to proper directories where each file should be
SRCDIR = src
BINDIR = bin
LIBDIR = lib
TARGET=valence
TARGETMK=modelkit
ifeq ($(BUILD_SHARED_LIB),false)
TARGETLIB=libvalence.a
else
TARGETLIB=libvalence.so
endif
all: $(TARGETLIB) $(TARGET) $(TARGETMK) clean
$(TARGETLIB): $(OBJS)
mkdir -p $(LIBDIR)
ifeq ($(BUILD_SHARED_LIB),false)
ar rcs $(LIBDIR)/$(TARGETLIB) $(OBJS)
else
$(FC) -shared -o $(LIBDIR)/$(TARGETLIB) $(OBJS) -L$(SIMINT_LIBRARY) -lsimint
endif
$(TARGET): $(OBJS) valence_driver.o
mkdir -p $(BINDIR)
ifeq ($(BUILD_SHARED_LIB),false)
$(FC) -o $(BINDIR)/$(TARGET) $(FFLAGS) valence_driver.o $(LIBDIR)/$(TARGETLIB) $(LINK_FLAGS)
else
$(FC) -o $(BINDIR)/$(TARGET) $(FFLAGS) valence_driver.o -L$(LIBDIR) -L$(SIMINT_LIBRARY) -lsimint -lvalence
endif
$(TARGETMK) :
$(FC) $(FFLAGS) $(SRCDIR)/modelkit.F90 -o $(BINDIR)/$(TARGETMK)
valence_driver.o : $(SRCDIR)/valence_driver.F90 tools_module.o tools.mod
$(FC) $(FFLAGS) -c $< -o $@
givens.o : $(SRCDIR)/givens.F90 tools_module.o tools.mod
$(FC) $(FFLAGS) -c $< -o $@
rsg.o : $(SRCDIR)/rsg.F
$(F77) $(FFLAGS) -c $< -o $@
tools_module.o tools.mod : $(SRCDIR)/tools_module.F90
$(FC) $(FFLAGS) -c $< -o tools_module.o
valence_simint_module.o valence_simint.mod : $(SRCDIR)/valence_simint_module.F90 \
integrals_module.o integrals.mod
$(FC) $(FFLAGS) -c $< -o valence_simint_module.o
density_module.o densitywork.mod : $(SRCDIR)/density_module.F90 tools_module.o tools.mod
$(FC) $(FFLAGS) -c $< -o density_module.o
integrals_module.o integrals.mod : $(SRCDIR)/integrals_module.F90 tools_module.o tools.mod
$(FC) $(FFLAGS) -c $< -o integrals_module.o
timing_flops_module.o timing_flops.mod : $(SRCDIR)/timing_flops_module.F90
$(FC) $(FFLAGS) -c $< -o timing_flops_module.o
valence.o : $(SRCDIR)/valence.F90 tools_module.o density_module.o integrals_module.o \
tools.mod integrals.mod densitywork.mod timing_flops_module.o \
timing_flops.mod valence_simint_module.o valence_simint.mod \
xm_module.o xm.mod valence_initialize_module.o \
valence_finalize_module.o valence_finit.mod
$(FC) $(FFLAGS) -c $< -o $@
givens_in_c.o : $(SRCDIR)/givens_in_c.cpp
$(CC) $(CFLAGS) -c $< -o $@
valence_api_nitrogen.o : $(SRCDIR)/valence_api_nitrogen.F90
$(FC) $(FFLAGS) -c $< -o $@
valence_api.o : $(SRCDIR)/valence_api.F90
$(FC) $(FFLAGS) -c $< -o $@
valence_initialize_module.o : $(SRCDIR)/valence_initialize_module.F90 xm_module.o xm.mod
$(FC) $(FFLAGS) -c $< -o $@
valence_finalize_module.o : $(SRCDIR)/valence_finalize_module.F90
$(FC) $(FFLAGS) -c $< -o $@
xm_module.o xm.mod : $(SRCDIR)/xm_module.F90 tools_module.o density_module.o \
integrals_module.o integrals.mod densitywork.mod timing_flops_module.o \
timing_flops.mod tools.mod
$(FC) $(FFLAGS) -c $< -o $@
doc:
doxygen doc/Doxyfile
clean:
rm -f *.o *.mod
veryclean:
rm -f *.o *.mod $(LIBDIR)/$(TARGETLIB) $(BINDIR)/$(TARGET) $(BINDIR)/$(TARGETMK)
test:
testing/test_script $(PWD)/$(BINDIR)/$(TARGET) $(SEQUENTIAL) small
test-large:
testing/test_script $(PWD)/$(BINDIR)/$(TARGET) $(SEQUENTIAL) large
.PHONY: all clean doc test