Skip to content

Instantly share code, notes, and snippets.

@azet
Last active December 26, 2015 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azet/7183050 to your computer and use it in GitHub Desktop.
Save azet/7183050 to your computer and use it in GitHub Desktop.
building optimized VASP 5.2.12 with Intel toolchain
#modules:
> module list
Currently Loaded Modulefiles:
1) shared 6) intel/compiler/64/13.1/2013.5.192
2) cmgui/6.1 7) torque/4.2.2
3) cmsh 8) intel/mkl/64/11.0/2013.5.192
4) cmd 9) intel-mpi/64/4.1.1/036
5) cluster-tools/6.1
#build:
while :; do make -f makefile -j 4; done
# yup. seriously. and just wait.
.SUFFIXES: .inc .f .f90 .F
#-----------------------------------------------------------------------
# Makefile for Intel Fortran compiler for P4 systems
#
# The makefile was tested only under Linux on Intel platforms
#-----------------------------------------------------------------------
# all CPP processed fortran files have the extension .f
SUFFIX=.f90
#-----------------------------------------------------------------------
# START CUSTOMIZATION HERE
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# whereis CPP ?? (I need CPP, can't use gcc with proper options)
# the following works almost on all systems
# possible cpp is located in a different directory
#-----------------------------------------------------------------------
CPP_ = ./preprocess <$*.F | /usr/bin/cpp -P -C -traditional >$*$(SUFFIX)
#-----------------------------------------------------------------------
# f90 compiler
#-----------------------------------------------------------------------
# simple version, use mpif77 wrapper
# this works only if mpif77 has been compiled using the exactly
# same fortran compiler
FC=mpiifort
FCL=$(FC)
#-----------------------------------------------------------------------
# general fortran flags (there must a trailing blank on this line)
#-----------------------------------------------------------------------
INCS=
FFLAGS = -FR -assume byterecl -nostand
#-----------------------------------------------------------------------
# optimization
# for some files a lower optimization level is explicitly selected
# at the bottom
#-----------------------------------------------------------------------
OFLAG=-O3 -ipo -xavx -fno-alias $(INCS)
QLC_LNK_FLAG=
OFLAG_HIGH = $(OFLAG)
OFLAG_NOOPT = -O1 -ip -ftz
OBJ_HIGH =
OBJ_NOOPT =
DEBUG = -FR -O0
INLINE = $(OFLAG) -ip
#-----------------------------------------------------------------------
# the following lines specify the position of BLAS and LAPACK,
# PBLAS and scaLAPACK
#-----------------------------------------------------------------------
MKL_PATH=$(MKLROOT)/lib/intel64
BLAS= -mkl=cluster -Wl,--start-group $(MKL_PATH)/libmkl_intel_thread.a $(MKL_PATH)/libmkl_core.a -Wl,--end-group -liomp5
LAPACK= $(MKL_PATH)/libmkl_intel_lp64.a
BLACS=/cm/shared/apps/intel/composer_xe/2013.5.192/mkl/lib/intel64/libmkl_blacs_intelmpi_lp64.a
SCA=/cm/shared/apps/intel/composer_xe/2013.5.192/mkl/lib/intel64/libmkl_scalapack_lp64.a $(BLACS)
WANLIB=../wannier90-1.2/libwannier.a
LINK=
FFT3D = fftmpi.o fftmpi_map.o fftw3d.o fft3dlib.o $(MKL_PATH)/libfftw3xf_intel.a
#-----------------------------------------------------------------------
# END CUSTOMIZATION
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# options for CPP in parallel version (see also above):
# NGZhalf charge density reduced in Z direction
# wNGZhalf gamma point only reduced in Z direction
# scaLAPACK use scaLAPACK (usually slower on 100 Mbit Net)
#-----------------------------------------------------------------------
ifdef SCA
CPP = $(CPP_) -DMPI -DHOST=\"IFC91_ompi\" -DIFC \
-Dkind8 -DNGZhalf -DCACHE_SIZE=4000 -DPGF90 -Davoidalloc \
-DMPI_BLOCK=8000 -DscaLAPACK -Duse_collective \
-DnoAugXCmeta -DVASP2WANNIER90
else
CPP = $(CPP_) -DMPI -DHOST=\"IFC91_ompi\" -DIFC \
-Dkind8 -DNGZhalf -DCACHE_SIZE=4000 -DPGF90 -Davoidalloc \
-DMPI_BLOCK=8000 -Duse_collective \
-DnoAugXCmeta -DVASP2WANNIER90
endif
#-----------------------------------------------------------------------
# libraries for vasp
#-----------------------------------------------------------------------
ifdef SCA
LIB = -L../vasp.5.lib -ldmy \
../vasp.5.lib/linpack_double.o \
$(WANLIB) $(SCA) $(LAPACK) $(BLAS)
else
LIB = -L../vasp.5.lib -ldmy \
../vasp.5.lib/linpack_double.o \
$(WANLIB) $(LAPACK) $(BLAS)
endif
#-----------------------------------------------------------------------
# general rules and compile lines
#-----------------------------------------------------------------------
BASIC= symmetry.o symlib.o lattlib.o random.o
SOURCE= base.o mpi.o smart_allocate.o xml.o \
constant.o jacobi.o main_mpi.o scala.o \
asa.o lattice.o poscar.o ini.o mgrid.o xclib.o vdw_nl.o xclib_grad.o \
radial.o pseudo.o gridq.o ebs.o \
mkpoints.o wave.o wave_mpi.o wave_high.o \
$(BASIC) nonl.o nonlr.o nonl_high.o dfast.o choleski2.o \
mix.o hamil.o xcgrad.o xcspin.o potex1.o potex2.o \
constrmag.o cl_shift.o relativistic.o LDApU.o \
paw_base.o metagga.o egrad.o pawsym.o pawfock.o pawlhf.o rhfatm.o paw.o \
mkpoints_full.o charge.o Lebedev-Laikov.o stockholder.o dipol.o pot.o \
dos.o elf.o tet.o tetweight.o hamil_rot.o \
steep.o chain.o dyna.o sphpro.o us.o core_rel.o \
aedens.o wavpre.o wavpre_noio.o broyden.o \
dynbr.o rmm-diis.o reader.o writer.o tutor.o xml_writer.o \
brent.o stufak.o fileio.o opergrid.o stepver.o \
chgloc.o fast_aug.o fock.o mkpoints_change.o sym_grad.o \
mymath.o internals.o dynconstr.o dimer_heyden.o dvvtrajectory.o vdwforcefield.o \
hamil_high.o nmr.o pead.o mlwf.o subrot.o subrot_scf.o \
force.o pwlhf.o gw_model.o optreal.o davidson.o david_inner.o \
electron.o rot.o electron_all.o shm.o pardens.o paircorrection.o \
optics.o constr_cell_relax.o stm.o finite_diff.o elpol.o \
hamil_lr.o rmm-diis_lr.o subrot_cluster.o subrot_lr.o \
lr_helper.o hamil_lrf.o elinear_response.o ilinear_response.o \
linear_optics.o linear_response.o \
setlocalpp.o wannier.o electron_OEP.o electron_lhf.o twoelectron4o.o \
ratpol.o screened_2e.o wave_cacher.o chi_base.o wpot.o local_field.o \
ump2.o bse_te.o bse.o acfdt.o chi.o sydmat.o dmft.o \
rmm-diis_mlr.o linear_response_NMR.o
INC=
vasp: $(SOURCE) $(FFT3D) $(INC) main.o
rm -f vasp
$(FCL) -o vasp main.o $(SOURCE) $(FFT3D) $(LIB) $(LINK)
vasp_: $(SOURCE) $(FFT3D) $(INC) main.o
rm -f vasp_
$(FCL) -o vasp_ main.o $(SOURCE) $(FFT3D) $(LIB) $(LINK)
makeparam: $(SOURCE) $(FFT3D) makeparam.o main.F $(INC)
$(FCL) -o makeparam $(LINK) makeparam.o $(SOURCE) $(FFT3D) $(LIB)
zgemmtest: zgemmtest.o base.o random.o $(INC)
$(FCL) -o zgemmtest $(LINK) zgemmtest.o random.o base.o $(LIB)
dgemmtest: dgemmtest.o base.o random.o $(INC)
$(FCL) -o dgemmtest $(LINK) dgemmtest.o random.o base.o $(LIB)
ffttest: base.o smart_allocate.o mpi.o mgrid.o random.o ffttest.o $(FFT3D) $(INC)
$(FCL) -o ffttest $(LINK) ffttest.o mpi.o mgrid.o random.o smart_allocate.o base.o $(FFT3D) $(LIB)
kpoints: $(SOURCE) $(FFT3D) makekpoints.o main.F $(INC)
$(FCL) -o kpoints $(LINK) makekpoints.o $(SOURCE) $(FFT3D) $(LIB)
clean:
-rm -f *.mod *.f90 *.o *.L ; touch *.F
main.o: main$(SUFFIX)
$(FC) $(FFLAGS)$(DEBUG) $(INCS) -c main$(SUFFIX)
xcgrad.o: xcgrad$(SUFFIX)
$(FC) $(FFLAGS) $(INLINE) $(INCS) -c xcgrad$(SUFFIX)
xcspin.o: xcspin$(SUFFIX)
$(FC) $(FFLAGS) $(INLINE) $(INCS) -c xcspin$(SUFFIX)
makeparam.o: makeparam$(SUFFIX)
$(FC) $(FFLAGS)$(DEBUG) $(INCS) -c makeparam$(SUFFIX)
makeparam$(SUFFIX): makeparam.F main.F
#
# MIND: I do not have a full dependency list for the include
# and MODULES: here are only the minimal basic dependencies
# if one strucuture is changed then touch_dep must be called
# with the corresponding name of the structure
#
base.o: base.inc base.F
mgrid.o: mgrid.inc mgrid.F
constant.o: constant.inc constant.F
lattice.o: lattice.inc lattice.F
setex.o: setexm.inc setex.F
pseudo.o: pseudo.inc pseudo.F
poscar.o: poscar.inc poscar.F
mkpoints.o: mkpoints.inc mkpoints.F
wave.o: wave.inc wave.F
nonl.o: nonl.inc nonl.F
nonlr.o: nonlr.inc nonlr.F
$(OBJ_HIGH):
$(CPP)
$(FC) $(FFLAGS) $(OFLAG_HIGH) $(INCS) -c $*$(SUFFIX)
$(OBJ_NOOPT):
$(CPP)
$(FC) $(FFLAGS) $(OFLAG_NOOPT) $(INCS) -c $*$(SUFFIX)
fft3dlib_f77.o: fft3dlib_f77.F
$(CPP)
$(F77) $(FFLAGS_F77) -c $*$(SUFFIX)
.F.o:
$(CPP)
$(FC) $(FFLAGS) $(OFLAG) $(INCS) -c $*$(SUFFIX)
.F$(SUFFIX):
$(CPP)
$(SUFFIX).o:
$(FC) $(FFLAGS) $(OFLAG) $(INCS) -c $*$(SUFFIX)
# special rules
#-----------------------------------------------------------------------
# -tpp5|6|7 P, PII-PIII, PIV
# -xW use SIMD (does not pay of on PII, since fft3d uses double prec)
# all other options do no affect the code performance since -O1 is used
fft3dlib.o : fft3dlib.F
$(CPP)
$(F77) -FR -O2 -c $*$(SUFFIX)
fft3dfurth.o : fft3dfurth.F
$(CPP)
$(F77) -FR -O1 -c $*$(SUFFIX)
fftw3d.o : fftw3d.F
$(CPP)
$(F77) -FR -O1 -c $*$(SUFFIX)
radial.o : radial.F
$(CPP)
$(F77) -FR $(OFLAG) -c $*$(SUFFIX)
fftmpi.o : fftmpi.F
$(CPP)
$(F77) -FR -O1 -c $*$(SUFFIX)
fftmpiw.o : fftmpiw.F
$(CPP)
$(F77) -FR -O1 $(INCS) -c $*$(SUFFIX)
symlib.o : symlib.F
$(CPP)
$(F77) -FR $(OFLAG) -c $*$(SUFFIX)
symmetry.o : symmetry.F
$(CPP)
$(F77) -FR $(OFLAG) -c $*$(SUFFIX)
broyden.o : broyden.F
$(CPP)
$(F77) -FR $(OFLAG) -c $*$(SUFFIX)
dynbr.o : dynbr.F
$(CPP)
$(F77) -FR $(OFLAG) -c $*$(SUFFIX)
paw.o : paw.F
$(CPP)
$(F77) -FR -O3 -c $*$(SUFFIX)
cl_shift.o : cl_shift.F
$(CPP)
$(F77) -FR -O3 -c $*$(SUFFIX)
us.o : us.F
$(CPP)
$(F77) -FR -O3 -c $*$(SUFFIX)
wave.o : wave.F
$(CPP)
$(F77) -FR -O3 -c $*$(SUFFIX)
wave_high.o : wave_high.F
$(CPP)
$(FC) -FR -O1 -c $*$(SUFFIX)
LDApU.o : LDApU.F
$(CPP)
$(F77) -FR -O3 -c $*$(SUFFIX)
.SUFFIXES: .inc .f .F
#-----------------------------------------------------------------------
# Makefile for Portland Group F90/HPF compiler
# the makefile was tested only under Linux on Intel platforms
# however it might work on other platforms as well
#
# this release of vasp.4.lib contains lapack v2.0
# this can be compiled with pgf90 compiler if the option -O1 is used
#
# Mind: one user reported that he had to copy preclib.F diolib.F
# dlexlib.F and drdatab.F to the directory vasp.4.4, compile the files
# there and link them directly into vasp
# for no obvious reason these files could not be linked from the library
#
#-----------------------------------------------------------------------
# C-preprocessor
#CPP = gcc -E -P -C $*.F >$*.f
CPP = gcc -DLONGCHAR -E -P -C $*.F >$*.f
FC=ifort
CFLAGS = -O
#FFLAGS = -O0 -FI -msse2
FFLAGS = -O0 -FI -xavx
FREE = -FR
DOBJ = preclib.o timing_.o derrf_.o dclock_.o diolib.o dlexlib.o drdatab.o
#-----------------------------------------------------------------------
# general rules
#-----------------------------------------------------------------------
libdmy.a: $(DOBJ) lapack_double.o linpack_double.o lapack_atlas.o
-rm libdmy.a
ar vq libdmy.a $(DOBJ)
# files which do not require autodouble
lapack_min.o: lapack_min.f
$(FC) $(FFLAGS) $(NOFREE) -c lapack_min.f
lapack_double.o: lapack_double.f
$(FC) $(FFLAGS) $(NOFREE) -c lapack_double.f
lapack_single.o: lapack_single.f
$(FC) $(FFLAGS) $(NOFREE) -c lapack_single.f
lapack_atlas.o: lapack_atlas.f
$(FC) $(FFLAGS) $(NOFREE) -c lapack_atlas.f
linpack_double.o: linpack_double.f
$(FC) $(FFLAGS) $(NOFREE) -c linpack_double.f
linpack_single.o: linpack_single.f
$(FC) $(FFLAGS) $(NOFREE) -c linpack_single.f
.c.o:
$(CC) $(CFLAGS) -c $*.c
.F.o:
$(CPP)
$(FC) $(FFLAGS) $(FREE) $(INCS) -c $*.f
.F.f:
$(CPP)
.f.o:
$(FC) $(FFLAGS) $(FREE) $(INCS) -c $*.f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment