http://cms.mpi.univie.ac.at/wiki/index.php/Installing_VASP
Installing VASP
Contents[hide] |
Requirements
For the parallel compilation of VASP the following software is mandatory:
- Fortran Compiler
- An implementation of MPI (Message Passing Interface)
- Numerical libraries like BLAS, LAPACK, FFTW, ScaLAPACK
Intel Composer XE (12.1.3)
When installing the Intel Composer XE software package, both the Intel Fortran compiler ifort
(version 12.1.3) as well as the Intel Math Kernel Library (MKL) in version 10.3 is installed. The Intel MKL includes libraries for BLAS, LAPACK ScaLAPACK and their own implementation of FFT. No additional numerical libraries have to be compiled and installed. Make sure that the following file is sourced in your ~/.bashrc
:
source /opt/intel/composerxe/bin/compilervars.sh [ia32|intel64]
where you should use ia32
for 32bit and intel64
for 64bit operating systems.
Intel MKL FFTW wrappers
VASP internally uses the calling statements of the FFTW3 which differ to the implementation of the FFT in the MKL. Therefore we have to build wrapper routines which are shipped with the MKL but not compiled:
cd $MKLROOT/interfaces/fftw3xf/ make
After a successful compilation libfftw3xf_intel.a
was created in this directory.
openMPI
Download a version of openMPI (we use version 1.4.5) and untar the tarball.
tar -xjvf openmpi-1.4.5.tar.bz2 cd openmpi-1.4.5
Use
./configure --help
to get help for all the compilation options available. We used the following configure line, ensuring the Intel Fortran and C compilers are used
./configure CC=icc CXX=icpc F77=ifort FC=ifort --prefix=PREFIX
and where PREFIX
is the absolute path to the directory where it should be installed on your system. Use the following naming for the final directory to know which Fortran compiler was used opempi-1.4.5-INTEL-12.1.3
. After configuration has finished execute:
make make install
Probably you need root privileges to execute the last command. Finally we have to make the openMPI directories available for your bash. Therefore we include the following statement in the ~/.bashrc
if [ -f /opt/intel/composerxe/bin/compilervars.sh ] then source /opt/intel/composerxe/bin/compilervars.sh intel64 2> /dev/null export MPI=[PREFIX] export PATH=$MPI/bin:$PATH export LD_LIBRARY_PATH=$MPI/lib:$LD_LIBRARY_PATH export MANPATH=$MANPATH:$MPI/share/man export INFOPATH=$INFOPATH:$MPI/share/man fi
In the first line we test whether the Intel composer is installed by checking whether the compilervars.sh
file exists. Then we source the appropriate compiler and the openMPI version compiled with this compiler. PREFIX
is the directory you installed openMPI.
Compilation
The following flags should be changed in the makefile, so that the most recent version of VASP compiles.
-
FC
We are using openMPI for the parallel MPI environment and therefore we have to compile with the MPI version of the Fortran compiler mpif90
. Mind that the used Fortran compiler has to be identical to the compiler used to compile openMPI.
FC=mpif90
-
FCL
The -mkl
option tells the ifort compiler to link all necessary MKL libraries. Mind that this uses the ordinary LAPACK routines and not ScaLAPACK. Therefore you can comment all BLAS
, LAPACK
, BLACS
, SCA
statements in the makefile.
FCL=mpif90 -mkl
-
FFLAGS
Some namings of compiler flags changed in the most recent version of the Intel Fortran compiler. This is optional, but will prevent warnings and in the future it has to be changed since the old flags are deprecated.
FFLAGS = -free -names lowercase -assume byterecl
-
FFTW
Include the Intel MKL FFT wrapper library which we compiled at the beginning of this section.
FFT3D = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o $(MKLROOT)/interfaces/fftw3xf/libfftw3xf_intel.a
-
SCA
If one wants to use ScaLAPACK routines instead of LAPACK the following line will activate ScaLAPACK support in VASP and includes the necessary libraries. Mind that you have to recompile certain files to add support for ScaLAPACK.
SCA= -lmkl_scalapack_lp64.a -lmkl_blacs_openmpi_lp64
Intel© Math Kernel Library Link Line Advisor
A very handy site is the Intel© Math Kernel Library Link Line Advisor. With its help you get a recommendation for the best libraries which you should use on your particular system.
Add profiling support
To add profiling support in the most recent version of VASP you have to add -DPROFILING
to the preprocessor flags under CPP
CPP = $(CPP_) -DMPI ...... -DPROFILING
Afterwards execute
make clean make vasp
to recompile all source files of VASP. For further reading see Profiling
Hybrid openMPI/openMP parallelization
To enable explicit openMP support in VASP add -openmp
to the FC
line in the makefile
FC=mpif90 -openmp
Since this subject is more complex see Hybrid openMPI/openMP parallelization fur further information.