Installation of VASP 5.4.4 on Win10/Ubuntu 18.04#
Linux commands are represented in bold, directories and files are represented in italics.
Update: Ubuntu 20.04 cannot install Parallel Studio.
After enabling WSL on Win10 1903, download Ubuntu 18.04 LTS and disable real-time protection of Windows Defender (optional, otherwise IO will not work in Linux). After logging into the new version of Ubuntu, you need to create a user and set the sudo password. You can also set the root password (optional).
sudo passwd root
After entering the system, install Intel Parallel Studio XE and configure the compilation environment.
The reason for not using GNU installation is that I encountered compilation errors multiple times. I will study it when I have time. In theory, GNU installation is the most convenient, as it only requires a few packages to be installed using apt-get.
Register an educational account with edu.cn email to download the online installation package of Intel Parallel Studio XE, which is 18 MB in size. Use wget to download and tar -xzvf to extract. Enter the directory and run install.sh with root privileges (you can also modify the installation directory and only install it for the current user).
sudo ./install.sh
Follow the instructions to install, and pay attention to selecting custom installation later and deselecting all unnecessary components (except for large disk space). The only components needed for compiling VASP are: Intel C++, Intel Fortran, Math Kernel for Fortran, and Intel MPI. It is also recommended to install Math Kernel for C++, but other software can be used. A total of five components will be installed, with a size of approximately 3 GB (the complete installation is 11 GB).
After installation, configure the environment variables and add the following content to ~/.bashrc:
source /opt/intel/compilers_and_libraries_2019.4.243/linux/bin/compilervars.sh intel64
source /opt/intel/compilers_and_libraries_2019.4.243/linux/bin/iccvars.sh intel64
source /opt/intel/compilers_and_libraries_2019.4.243/linux/bin/ifortvars.sh intel64
source /opt/intel/compilers_and_libraries_2019.4.243/linux/mkl/bin/mklvars.sh intel64
source /opt/intel/impi/2019.4.243/intel64/bin/mpivars.sh
The content added depends on the actual situation for the installation of Parallel Studio XE version 2019.4.243. After adding source, update the variables, and then check if the installation is complete using which icc ifort icpc mpiifort.
Next, compile parallel FFTW. Enter the directory:
cd /opt/intel/compilers_and_libraries_2019.4.243/linux/mkl/interfaces/fftw3xf
After entering, switch to the root user and source /home/user/.bashrc, and then compile fftw3xf:
make libintel64
The reason for switching to root is that directly using make will prompt insufficient permissions (because the current operation is within /opt). When using sudo make, the compilation fails because the root user does not have the environment variables configured. After the compilation is complete, exit the root user using exit, and the file libfftw3xf_intel.a will appear in this directory.
Another approach is to install Intel libraries without root permissions, and put them in your own directory. Both methods work.
Next, download the VASP files, extract them using tar, and cd into the directory. Copy makefile.include.linux_intel:
cp arch/makefile.include.linux_intel makefile.include
Modify a few contents. First, the location of the math library (add one line of code):
MKLROOT = /opt/intel/compilers_and_libraries_2019.4.243/linux/mkl
MKL_PATH = $(MKLROOT)/lib/intel64
BLAS =
LAPACK =
BLACS = -lmkl_blacs_intelmpi_lp64
SCALAPACK = $(MKL_PATH)/libmkl_scalapack_lp64.a $(BLACS)
Of course, the first line can also be added directly to makefile.include (because $MKLROOT is an environment path). If you don't know how to do this, it's better to add it here.
Finally, modify the fftm configuration:
OBJECTS = fftmpiw.o fftmpi_map.o fft3dlib.o fftw3d.o \
$(MKLROOT)/interfaces/fftw3xf/libfftw3xf_intel.a
Yes, you only need to modify two locations. The tutorials found online, which first install ifort, then compile openmpi, then compile fftm, and finally compile vasp, are written for situations where Parallel Studio XE cannot be obtained. If you are using it personally, just use Parallel Studio XE, it's simple and straightforward.
Then run make all or make std, depending on the version you need. DO NOT use the -j command during compilation, as VASP has strict dependencies within the package, and adding the command will cause compilation failure. Single-threaded compilation of the three packages takes about an hour. If the compilation fails, it may be because some dependencies are not installed, so use apt-get to install them.
After compilation, configure the environment variables, and you can run the program using mpirun or directly vasp.
The complete makefile.include is as follows:
# Precompiler options
CPP_OPTIONS= -DHOST=\"LinuxIFC\"\
-DMPI -DMPI_BLOCK=8000 \
-Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Duse_bse_te \
-Dtbdyn \
-Duse_shmem
CPP = fpp -f_com=no -free -w0 $*$(FUFFIX) $*$(SUFFIX) $(CPP_OPTIONS)
FC = mpiifort
FCL = mpiifort -mkl=sequential -lstdc++
FREE = -free -names lowercase
FFLAGS = -assume byterecl -w
OFLAG = -O2
OFLAG_IN = $(OFLAG)
DEBUG = -O0
MKLROOT = /opt/intel/compilers_and_libraries_2019.4.243/linux/mkl
MKL_PATH = $(MKLROOT)/lib/intel64
BLAS =
LAPACK =
BLACS = -lmkl_blacs_intelmpi_lp64
SCALAPACK = $(MKL_PATH)/libmkl_scalapack_lp64.a $(BLACS)
OBJECTS = fftmpiw.o fftmpi_map.o fft3dlib.o fftw3d.o \
$(MKLROOT)/interfaces/fftw3xf/libfftw3xf_intel.a
INCS =-I$(MKLROOT)/include/fftw
LLIBS = $(SCALAPACK) $(LAPACK) $(BLAS)
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
OBJECTS_O2 += fft3dlib.o
# For what used to be vasp.5.lib
CPP_LIB = $(CPP)
FC_LIB = $(FC)
CC_LIB = icc
CFLAGS_LIB = -O
FFLAGS_LIB = -O1
FREE_LIB = $(FREE)
OBJECTS_LIB= linpack_double.o getshmem.o
# For the parser library
CXX_PARS = icpc
LIBS += parser
LLIBS += -Lparser -lparser -lstdc++
# Normally no need to change this
SRCDIR = ../../src
BINDIR = ../../bin
On a laptop with dual-core and four threads, running mpirun -np 2 shows that the CPU usage is only 50%. However, hyper-threading CPUs should not be set to -np twice the number of cores, so let it run at 50%.
In addition, on a Ubuntu machine, after installing without root privileges, it can run up to 8 threads on a four-core machine. Therefore, it is more likely to be a problem with the WSL system.
Furthermore, let's talk about solving some bugs. If cross-node communication is not enabled, the corresponding configuration files need to be deleted. When running on a personal computer, you may encounter an "out of memory" error, in which case you cannot use mpirun directly with vasp_std. In addition, for large systems, you need to modify the stack size, for example, change it to 256 MB, otherwise there may be a memory overflow.
Translation: