编译版本6的VASP

最近拿到组里购买的版本6.1.1VASP(Vienna Ab initio Simulation Package). 由于其具有的一些新的功能,特别是在机器学习力场和电声耦合计算,支持OpenMP和MPI混编有利于提高内存使用效率,同时配合支持OpenACC的GPU加速可以使得对于大规模并行加速明显。

重大更新

下面列出VASP6版本的有一些重大的更新[1]:

  • 支持OpenMP和MPI混编。这有利于提高内存使用效率,而且对于大规模并行加速明显。VASP5一般使用200核并行效率就很难继续提高了。但是用OpenMP和MPI混编的方式可以进行更大规模的并行计算
  • 支持libxc,这样可以选择的泛函就非常多了。VASP5只有有限的一些泛函可以用;
  • 新方法机器学习力场,这个功能也是最值得期待的,(Machine Learned Force Fields),具体使用的方法是On-the-fly machine learning force field generation using Bayesian linear regression.细节信息可以阅读:新版本VASP6 --之机器学习;
  • 电声耦合计算(Electron-phonon interactions);
  • X-ray absorption near-edge spectroscopy (XANES)计算,目前支持Super-cell core-hole (SCH) method计算方法;
  • constrained Random Phase Approximation(CRPA);
  • 支持OpenACC的GPU加速计算,可以使用Adaptively compressed exchange使得杂化泛函计算速度提高2-3倍。

对新版vasp做的测试

目录分布

其中了解一下VASP的目录分布

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
               vasp.X.X.X (root directory)
|
------------------------------------------------
| | | | | |
arch bin build src testsuite tools

* `root/`

Holds the high-level makefile and several subdirectories.

* `root/src`

Holds the source files of VASP and a low-level makefile.

* `root/arch`

Holds a collection of `makefile.include.*` files.

* `root/build`

The different versions of VASP, i.e., the standard, gamma-only,
non-collinear, and CUDA-GPU versions will be build in separate
subdirectories of this directory.

* `root/bin`

Here make will store the binaries.

* `root/testsuite`

Holds a suite of correctness tests to check your build.

* `root/tools`

Holds several python scripts related to the (optional) use
of HDF5 input/output files.

编译

和之前使用的5.4.4版本编译情况相似,从arch/文件中拷贝出适用于自己服务器或者个人电脑的makefile.include。我们组服务器上的环境让我选择的是makefile.include.linux_intel,并且拷贝到上一级目录也就是解压后VASP的根目录更名为makefile.include

修改makefile.include文件,以下是我根据自己组里的服务器的环境所修改的[2]

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
# Precompiler options
CPP_OPTIONS= -DHOST=\"LinuxIFC\"\
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Dvasp6 \
-Duse_bse_te \
-Dtbdyn \
-Dfock_dblbuf

CPP = fpp -f_com=no -free -w0 $*$(FUFFIX) $*$(SUFFIX) $(CPP_OPTIONS)

FC = mpiifort
FCL = mpiifort -mkl=sequential

FREE = -free -names lowercase

FFLAGS = -assume byterecl -w -xHOST
OFLAG = -O2
OFLAG_IN = $(OFLAG)
DEBUG = -O0

# 自己mkl的根目录
MKLROOT =/opt/intel2019/compilers_and_libraries_2019.5.281/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

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
LLIBS += -lstdc++

# Normally no need to change this
SRCDIR = ../../src
BINDIR = ../../bin

#================================================
# GPU Stuff

CPP_GPU = -DCUDA_GPU -DRPROMU_CPROJ_OVERLAP -DUSE_PINNED_MEMORY -DCUFFT_MIN=28 -UscaLAPACK -Ufock_dblbuf

OBJECTS_GPU= fftmpiw.o fftmpi_map.o fft3dlib.o fftw3d_gpu.o fftmpiw_gpu.o

CC = icc
CXX = icpc
CFLAGS = -fPIC -DADD_ -Wall -qopenmp -DMAGMA_WITH_MKL -DMAGMA_SETAFFINITY -DGPUSHMEM=300 -DHAVE_CUBLAS

# 自己的cuda目录位置
CUDA_ROOT ?= /usr/local/cuda
NVCC := $(CUDA_ROOT)/bin/nvcc -ccbin=icc
CUDA_LIB := -L$(CUDA_ROOT)/lib64 -lnvToolsExt -lcudart -lcuda -lcufft -lcublas

GENCODE_ARCH := -gencode=arch=compute_30,code=\"sm_30,compute_30\" \
-gencode=arch=compute_35,code=\"sm_35,compute_35\" \
-gencode=arch=compute_60,code=\"sm_60,compute_60\" \
-gencode=arch=compute_70,code=\"sm_70,compute_70\" \
-gencode=arch=compute_72,code=\"sm_72,compute_72\"

MPI_INC = /opt/intel2019/compilers_and_libraries_2019.5.281/linux/mpi/intel64/include

然后执行make或者make all即可编译得到vasp_gamvasp_stdvasp_nclvasp_gpuvasp_gpu_ncl。其中后两个可以通过GPU加速的,且只有在某些情况才能支持[3]。

参考

[1] vasp.6.1.0 更新介绍/安装/测试

[2] Installing VASP.6.X.X

[3] GPU port of VASP