-
Notifications
You must be signed in to change notification settings - Fork 15
/
makefile_mac_mpi
286 lines (248 loc) · 11 KB
/
makefile_mac_mpi
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
# $^ : dependency list
# $@ : target
#----- Change options and library path according to your system ------------#
#-----------------------------------
# Compiler options and bin path |
#---------------------------------------------------------------------------|
#OPTIONS= -fpp -DMPI -mcmodel=large # for curion2
################# Possible options ##########################################
# -DSPGLIB : printout spacegroup information in the initial stages
# : if you want to use this option, please link SPGLIB
# library path properly in the "Dependencies" section below
# -DF08 : Fortran 2008 language is accepted or not
# -DMKL_SPARSE : use MKL_SPARSE library for the sparse matrix routines
# This option will save your memory 'enormously'.
# Before activate this option, make sure that the file
# mkl_spblas.f90 is exist in $(MKLPATH)/include/mkl_spblas.f90
# If this option is activated, you can use EWINDOW tag in
# your input file. See the manual for the details.
# Important note: if you want to generate python module,
# by "make tbfitpy_mod ", then you should turn of this OPTION
# -DPSPARSE : use FEAST_MPI with 4.0 version instead of MKL FEAST_SMP 2.1 version.
# This option is only available if -DMKL_SPARSE and -DMPI are activated
# For the details, please go to http://www.ecs.umass.edu/~polizzi/feast/
# NOTE: not a valid option in the current version. On developing now...
# Important note: if you want to generate python module,
# by "make tbfitpy_mod ", then you should turn off this OPTION
# -DSCALAPACK : use ScaLAPACK library for the eigenvalue parallism
# !!! WARN !!! do not use in the current version: it is upon
# developing stage now.
# MPI_USE : if "YES" MPI paralallism activation with the k-point parallization.
# IF "YES", with "make tbfit" tbfit.mpi will be compiled, and
# with "make tbfitpy_mod" tbfitpy_mod_mpi will be compiled
# In the future release, if -DSCALAPACK option is activated,
# k-point + eigenvalue parallism will be imployed (not supported now).
# Note: possible make command
# make tbfit # generate tbfit execution file
# make tbfitpy_mod # generate tbfit python module (don't use -DMKL_SPARSE, -DPSPARSE, -DSPGLIB)
# make lib # generate tbfit library libtbfit.a archiving all subroutines
#############################################################################
TBBIN=$(HOME)/code/bin
TBLIB=$(HOME)/code/lib
#####################
# MAC-INTEL COMPILE #
#####################
#FC = mpiifort
FC = mpif90
OPTIONS= -fPIC -fpp -DF08 -DMKL_SPARSE -DSPGLIB -DPSPARSE #-DSCALAPACK
FFLAG = -O2 -heap-arrays -nogen-interfaces
MPI_USE= YES
F90WRAP_LAPACK = --link-lapack_mkl # for ifflsurm --link-lapack , for mac --link-lapack_mkl
#F90WRAP_LAPACK = --link-lapack # for ifflsurm --link-lapack , for mac --link-lapack_mkl
##########################
# LINUX-gfortran COMPILE #
##########################
#OPTIONS=
#F90 = gfortran-mp-8
#FFLAG = -cpp -O2 -ffree-line-length-256 -fmax-stack-var-size=32768
#F90WRAP_LAPACK = --link-lapack # for ifflsurm --link-lapack , for mac --link-lapack_mkl
#MPI_USE= NO
#OPTIONS= -cpp -DMPI -DF08 -DSPGLIB #-DMKL_SPARSE -DSCALAPACK
#F90 = mpif90-openmpi-mp $(OPTIONS)
#FFLAG = -O2 -ffree-line-length-512 -fmax-stack-var-size=32768
#F90WRAP_LAPACK = --link-lapack # for ifflsurm --link-lapack , for mac --link-lapack_mkl
#MPI_USE= YES
#############################
# NURION-INTEL COMPILE #
# *tested by Chongze Wang, #
# Hanyang Univ, #
# chongze@hanyang.ac.kr #
#############################
#ADDITIONAL_OPTS =-O3 -qopenmp -xCOMMON-AVX512 -align array64byte
#OPTIONS= -fpp -DMPI -DF08 -DSPGLIB
#FC = mpiifort ${ADDITIONAL_OPTS}
#F90 = mpiifort ${ADDITIONAL_OPTS}
#FFLAG = -heap-arrays -nogen-interfaces -static-intel
#F90WRAP_LAPACK = --link-lapack # for ifflsurm --link-lapack , for mac --link-lapack_mkl
#MPI_USE= YES
BIN = $(TBBIN)
LIB = $(TBLIB)
#---------------------------------------------------------------------------|
#-----------------------------------
# Dependencies: LAPACK, SPGLIB |
#---------------------------------------------------------------------------|
#SPGLIB = -L/Users/Infant/code/lib/ -lsymspg # home
SPGLIB = ${HOME}/tbfit_fortran/LIB/spglib-1.16.2/lib/libsymspg.a # mymac
#SPGLIB = /local/th1/iff003/kim/tbfit_fortran/LIB/spglib-1.16.2/lib64/libsymspg.a # iffslurm
#SPGLIB = -L/home/Infant/tbfit_fortran/LIB/spglib-master -lsymspg # curion2
MKLPATH = $(MKLROOT)
LAPACK = -L$(MKLPATH)/lib/ \
-lmkl_intel_lp64 -lmkl_sequential \
-lmkl_core -liomp5
BLAS =
INCLUDE = -I$(MKLPATH)/include
FEAST = -L/${HOME}/tbfit_fortran/LIB/FEAST/4.0/lib/x64 -lfeast # Serial version for mac
FEAST_MPI = -L/${HOME}/tbfit_fortran/LIB/FEAST/4.0/lib/x64 -lpfeast -lfeast # MPI version for mac
#FEAST = -L/local/th1/iff003/kim/tbfit_fortran/LIB/FEAST/4.0/lib/x64 -lfeast # Serial version for iffslurm
#FEAST_MPI = -L/local/th1/iff003/kim/tbfit_fortran/LIB/FEAST/4.0/lib/x64 -lpfeast -lfeast # MPI version for iffslurm
#SCALAPACK = /Users/Infant/tbfit_fortran/LIB/scalapack-2.0.2/libscalapack.a
SCALAPACK = /${HOME}/tbfit_fortran/LIB/scala_home/libscalapack.a
#---------------------------------------------------------------------------|
######################### Do not modify below ###############################
# version tag
#TBFIT_VERSION=0.5.4
TBFIT_VERSION=0.5.6
#-----------------------------------
# Objects |
#---------------------------------------------------------------------------|
MKL_SP =$(findstring -DMKL_SPARSE,$(OPTIONS))
MKL_SPARSE = mkl_spblas.o
ifeq ($(MKL_SP),-DMKL_SPARSE)
SP_MOD = mkl_spblas.o
else
SP_MOD =
endif
SCALAPACK_USE=$(findstring -DSCALAPACK,$(OPTIONS))
SPARSE_PARA=$(findstring -DPSPARSE,$(OPTIONS))
MPI_MOD= blacs_basics.o mpi_basics.o mpi_setup.o
TBFITPY= tbfitpy_mod.o
KIND_MAP= kind_map # mapping between Fortran and C types used when ' make tbfitpy_mod '
TEST = test.o
MODULE = mykind.o print_io.o directory.o $(MPI_MOD) kill.o memory.o time.o version.o $(SP_MOD) \
parameters.o set_default.o random_mod.o element_info.o read_incar.o \
orbital_wavefunction.o kronecker_prod.o phase_factor.o \
do_math.o print_matrix.o sorting.o berry_phase.o sparse_tool.o \
pikaia_module.o get_parameter.o \
reorder_band.o total_energy.o projected_band.o cost_function.o \
classify.o unfold.o ${TBFITPY}
READER = parse.o read_input.o read_param.o read_poscar.o read_kpoint.o \
read_energy.o set_weight.o get_site_number.o find_nn.o
WRITER = print_param.o plot_eigen_state.o plot_stm_image.o set_ribbon_geom.o print_energy.o \
print_wcc.o print_zak_phase.o print_berry_curvature.o replot_dos_band.o \
print_circ_dichroism.o
GET = get_tij.o get_eig.o get_dos.o get_soc.o get_param_class.o \
get_cc_param.o get_berry_curvature.o get_wcc.o get_zak_phase.o \
get_z2_invariant.o get_parity.o get_symmetry_eig.o get_hamk_sparse.o \
get_effective_ham.o e_onsite.o get_degeneracy.o get_circular_dichroism.o \
post_process.o get_unfold.o
SYMM = get_symmetry.o
SPG_INT= spglib_interface.o
FITTING_LIB= get_fit.o minpack_sub.o lmdif.o genetic_alorithm.o pso.o
LIBTOOL= ar src
ifeq ($(SCALAPACK_USE), -DSCALAPACK)
SCALAPACK_LIB= $(SCALAPACK)
SCALAPACK_OBJ= #scalapack_initialize.o
else
SCALAPACK_LIB=
SCALAPACK_OBJ=
endif
ifeq ($(SPARSE_PARA), -DPSPARSE)
FEAST_LIB= $(FEAST_MPI)
else
FEAST_LIB= $(FEAST)
endif
SPG =$(findstring -DSPGLIB,$(OPTIONS))
ifeq ($(SPG),-DSPGLIB)
SPGLIB_= $(SPGLIB)
OBJECTS= $(MODULE) tbfit.o tbpack.o $(READER) $(WRITER) $(GET) \
$(FITTING_LIB) $(SCALAPACK_OBJ) $(TEST) $(SPG_INT) $(SYMM)
OBJECTS_LIB = $(MODULE) tbpack.o $(READER) $(WRITER) $(GET) \
$(FITTING_LIB) $(SCALAPACK_OBJ) $(TEST) $(SPG_INT) $(SYMM)
else
SPGLIB_=
OBJECTS= $(MODULE) tbfit.o tbpack.o $(READER) $(WRITER) $(GET) \
$(FITTING_LIB) $(SCALAPACK_OBJ) $(TEST) $(SYMM)
OBJECTS_LIB = $(MODULE) tbpack.o $(READER) $(WRITER) $(GET) \
$(FITTING_LIB) $(SCALAPACK_OBJ) $(TEST) $(SYMM)
endif
OBJECTS_PY= print_io.o $(MPI_MOD)
ifeq ($(MPI_USE), YES)
F90 = $(FC) $(OPTIONS) -DMPI
F90FLAGS = $(FFLAG)
else
F90 = $(FC) $(OPTIONS)
F90FLAGS = $(FFLAG)
endif
#---------------------------------------------------------------------------|
#-----------------------------------
# Suffix rules |
#-----------------------------------
ifeq ($(MKL_SP),-DMKL_SPARSE)
.SUFFIXES: $(MKL_SPARSE)
$(MKL_SPARSE): $(MKLPATH)/include/mkl_spblas.f90
$(F90) $(FFLAG) -c $<
endif
.SUFFIXES: .f .f90
%.o: %.f90
$(F90) $(FFLAG) -c $<
#-----------------------------------
# Targets |
#-----------------------------------
ifeq ($(MPI_USE), YES)
tbfit.mpi: $(OBJECTS)
$(F90) -o $@ $^ $(FEAST_LIB) $(BLAS) $(LAPACK) $(SCALAPACK_LIB) $(SPGLIB_) $(INCLUDE)
cp $@ $(BIN)/tbfit.mpi
cp $@ tbfit.$(TBFIT_VERSION).mpi
if [ -d "./tbfit.versions" ]; then cp tbfit.$(TBFIT_VERSION).mpi tbfit.versions ; fi
else
tbfit.serial: $(OBJECTS)
$(F90) -o $@ $^ $(FEAST_LIB) $(BLAS) $(LAPACK) $(SCALAPACK_LIB) $(SPGLIB_) $(INCLUDE)
cp $@ $(BIN)/tbfit.serial
cp $@ tbfit.$(TBFIT_VERSION).serial
if [ -d "./tbfit.versions" ]; then cp tbfit.$(TBFIT_VERSION).serial tbfit.versions ; fi
endif
libtbfit.a: $(OBJECTS)
$(LIBTOOL) $@ $^
libtbfit_ldos.a: $(OBJECTS_LIB)
$(LIBTOOL) $@ $^
lib: $(OBJECTS)
$(LIBTOOL) libtbfit.a $^
ldos_lib: $(OBJECTS_LIB)
$(LIBTOOL) libtbfit_ldos.a $^
get_ldos: get_ldos.o $(OBJECTS_LIB)
$(F90) -o $@ $^ $(LAPACK) $(INCLUDE) $(SPGLIB_) $(INCLUDE)
mv get_ldos $(BIN)
#NOTE: --link-lapack for iffslurm
# : --link-lapack_mkl for intel Mac
ifeq ($(MPI_USE), YES)
tbfitpy_mod: $(OBJECTS)
f90wrap -v -m $@_mpi tbfitpy_mod.f90 -k $(KIND_MAP)
f2py-f90wrap --f90exec=$(FC) --fcompiler=intelem --f90flags='$(F90FLAGS)' --compiler=intelem $(F90WRAP_LAPACK) -I. $(OBJECTS) -c f90wrap_tbfitpy_mod.f90 -m _$@_mpi
cp _$@_mpi.cpython*.so $@_mpi.py $(LIB)
cp ./PYTHON_MODULE/tbfitpy_mpi.py $(LIB)
else
tbfitpy_mod: $(OBJECTS)
f90wrap -m $@ tbfitpy_mod.f90 -k $(KIND_MAP)
f2py-f90wrap --f90exec=$(FC) --fcompiler=intelem --f90flags='$(F90FLAGS)' --compiler=intelem $(F90WRAP_LAPACK) -I. $(OBJECTS) -c f90wrap_tbfitpy_mod.f90 -m _$@
cp _$@.cpython*.so $@.py $(LIB)
cp ./PYTHON_MODULE/tbfitpy_serial.py $(LIB)
endif
fl2xyz: fleur2bs.o
$(F90) -o $@ $^
cp fl2xyz $(BIN)/fl2xyz
pc2xyz: poscar2bs.o
$(F90) -o $@ $^
cp pc2xyz $(BIN)/pc2xyz
all: $(OBJECTS)
$(F90) -o tbfit $^ $(BLAS) $(LAPACK) $(SCALAPACK_LIB) $(SPGLIB_) $(INCLUDE)
$(F90) -o pc2xyz poscar2bs.f90
cp tbfit $(BIN)
cp pc2xyz $(BIN)
touch:
touch tbfit.f90
clean:
rm *.o *.mod
clean_pc2xyz:
rm $(BIN)/pc2xyz poscar2bs.o
clean_get_ldos:
rm get_ldos