本文为自学笔记, 仅供参考, 正确的安装和使用方法请参考ABACUS的官方网站.
ABACUS
安装
安装编译器
同 Intel® oneAPI Toolkits(Intel Parallel Studio XE的代替品)安装使用
SSLAB上加载编译参数
module load mpi/intelmpi/2017.4.239
module load compiler/intel/intel-compiler-2017.5.239
注意
ABACUS使用下面elpa的这些函数,而这些函数在elpa-2016.05.004
编译的库中还有,
而在elpa-2020.11.001
中这些库已经没有或者调用方式发生了变化,如图
因此我们需要使用elpa-2016.05.004
Intel® oneAPI
以及intel-compiler-2019u3
编译elpa-2016.05.004
会报错(本文最后给出错误解决方案),intel-compiler-2017.5.239
可以编译通过elpa-2016.05.004
elpa_cholesky_complex
elpa_cholesky_real
elpa_get_communicators
elpa_invert_trm_complex
elpa_invert_trm_real
elpa_solve_evp_complex_1stage
elpa_solve_evp_complex_2stage
elpa_solve_evp_real_1stage
elpa_solve_evp_real_2stage
get_elpa_communicators
安装依赖
mkdir -p ~/code/intel
cd ~/code/intel
ROOT=$PWD
mkdir $ROOT/source
###fftw3
cd $ROOT/source
wget https://cndaqiang.gitee.io/packages//mirrors/fftw/fftw-3.3.4.tar.gz
tar xzvf fftw-3.3.4.tar.gz
cd fftw-3.3.4
./configure --prefix=$ROOT/fftw-3.3.4 CC=icc MPICC=mpiicc --enable-mpi
make install -j20
###boost
cd $ROOT/source
wget https://cndaqiang.gitee.io/packages//mirrors/boost/boost_1_66_0.tar.bz2
tar --bzip2 -xf boost_1_66_0.tar.bz2
cd boost_1_66_0/
./bootstrap.sh --prefix=$ROOT/boost_1_66_0 --with-toolset=intel-linux
./b2 install -j20
###elpa
TAG=2016.05.004
ROOT=~/code/intel
cd $ROOT/source
if [ ! -f elpa-$TAG.tar.gz ]
then
wget https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$TAG/elpa-$TAG.tar.gz
fi
rm -rf elpa-$TAG
rm -rf $ROOT/elpa-$TAG
tar xzvf elpa-$TAG.tar.gz
cd elpa-$TAG
MKL_HOME=$MKLROOT
if [ ! -f configure ]
then
./autogen.sh
fi
rm -rf build
mkdir build
cd build
../configure --prefix=$ROOT/elpa-$TAG CC=mpiicc CXX=mpiicpc FC=mpiifort FCFLAGS="-mkl=cluster"
#使用 FCFLAGS="-mkl=cluster" 或者下面的方式定义SCALAPACK都是可以的
# SCALAPACK_LDFLAGS="-L$MKL_HOME/lib/intel64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lmkl_blacs_intelmpi_lp64 -lpthread -lm -Wl,-rpath,$MKL_HOME/lib/intel64" \
# SCALAPACK_FCFLAGS="-L$MKL_HOME/lib/intel64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lmkl_blacs_intelmpi_lp64 -lpthread -lm -I$MKL_HOME/include/intel64/lp64" \
#--enable-openmp
make install -j20
安装
#cd ~/code/abacus/ABACUS_v2.1.0/source/
cd $ROOT
if [ ! -f ABACUS_v2.1.0.tar.gz ]
then
wget https://abacus.ustc.edu.cn/uploadfile/ABACUS_v2.1.0.tar.gz
fi
rm -rf ABACUS_v2.1.0
tar xzvf ABACUS_v2.1.0.tar.gz
cd ABACUS/source
cat > Makefile.vars << EOF
CPLUSPLUS = icpc
# C++ compiler
CPLUSPLUS_MPI = mpiicpc
# intel mpi or mpich
FORTRAN = ifort
# Fortran compiler
LAPACK_DIR = $MKLROOT
# intel mkl
FFTW_DIR = $ROOT/fftw-3.3.4
# lib fftw
BOOST_DIR = $ROOT/boost_1_66_0
# lib boost
ELPA_DIR = $ROOT/elpa-$TAG
# lib elpa
EOF
make
#注意在上面的内容中,FFTW_DIR = $ROOT/fftw-3.3.4
等后面不能有任何空格,如错误的FFTW_DIR = $ROOT/fftw-3.3.4[空格]
运行
(python37) cndaqiang@mommint:~/work/abacus/learn-20210421$ cp -r ~/code/abacus/ABACUS_v2.1.0/examples/01a_Si_diamond_pw_scf .
(python37) cndaqiang@mommint:~/work/abacus/learn-20210421$ cd 01a_Si_diamond_pw_scf
(python37) cndaqiang@mommint:~/work/abacus/learn-20210421/01a_Si_diamond_pw_scf$ mpirun -np 10 ABACUS.mpi.2.1.0 | tee result
*********************************************************
* *
* WELCOME TO ABACUS *
* *
* 'Atomic-orbital Based Ab-initio *
* Computation at UStc' *
* *
* Website: http://abacus.ustc.edu.cn/ *
* *
*********************************************************
Wed Apr 21 20:49:47 2021
MAKE THE DIR : OUT.ABACUS/
DONE(0.0328901 SEC) : SETUP UNITCELL
DONE(0.0689782 SEC) : SYMMETRY
DONE(0.069421 SEC) : INIT K-POINTS
---------------------------------------------------------
This calculation is self-consistent
---------------------------------------------------------
SPIN KPOINTS PROCESSORS
1 8 10
---------------------------------------------------------
Use plane wave basis
---------------------------------------------------------
ELEMENT NATOM XC
Si 2 PZ-LDA
---------------------------------------------------------
Initial plane wave basis and FFT box
---------------------------------------------------------
DONE(0.161176 SEC) : INIT PLANEWAVE
UNIFORM GRID DIM : 36 * 36 * 36
UNIFORM GRID DIM(BIG): 36 * 36 * 36
MEMORY FOR PSI (MB) : 0.0820312
DONE(0.162648 SEC) : LOCAL POTENTIAL
DONE(0.172807 SEC) : NON-LOCAL POTENTIAL
START POTENTIAL : atomic
DONE(0.1748 SEC) : INIT POTENTIAL
DONE(0.22581 SEC) : INIT BASIS
-------------------------------------------
SELF-CONSISTENT :
-------------------------------------------
ITER ETOT(eV) EDIFF(eV) DRHO2 CG_ITER TIME(S)
CG1 -2.192279e+02 0.000000e+00 6.928e-02 3.000e+00 3.369e-02
CG2 -2.154958e+02 3.732172e+00 5.745e-03 2.750e+00 3.172e-02
CG3 -2.155043e+02 -8.536782e-03 2.622e-05 2.406e+00 2.994e-02
CG4 -2.155047e+02 -3.698259e-04 5.403e-07 3.875e+00 3.880e-02
CG5 -2.155047e+02 -1.855886e-06 1.931e-08 2.875e+00 3.231e-02
CG6 -2.155047e+02 -7.198559e-08 1.776e-10 2.969e+00 3.263e-02
|CLASS_NAME---------|NAME---------------|TIME(Sec)-----|CALLS----|AVG------|PER%-------
A DC_Driv solve_eachf 0.28 1 0.28 63 %
B Run_Frag frag_pw_line 0.28 1 0.28 63 %
X FFT FFT3D 0.15 1876 8.2e-05 35 %
H Hamilt_PW h_psi 0.15 828 0.00018 34 %
C Ions opt_ions_pw 0.21 1 0.21 49 %
D electrons self_consistent 0.21 1 0.21 49 %
E electrons c_bands 0.15 6 0.025 35 %
F Hamilt diago 0.15 48 0.0031 34 %
G Diago_CG diag 0.11 48 0.0023 25 %
----------------------------------------------------------------------------------------
START Time : Wed Apr 21 20:49:47 2021
FINISH Time : Wed Apr 21 20:49:47 2021
TOTAL Time : 0
SEE INFORMATION IN : OUT.ABACUS/
输入和输出
(python37) cndaqiang@mommint:~/work/abacus/learn-20210421/01a_Si_diamond_pw_scf$ tree
.
├── INPUT
├── KPT
├── OUT.ABACUS
│ ├── INPUT
│ ├── istate.info
│ ├── running_scf.log
│ ├── Si
│ │ ├── Si.NONLOCAL
│ │ ├── Si-P.ORBITAL
│ │ ├── Si-S.ORBITAL
│ │ └── v_loc_g.dat
│ ├── STRU_READIN_ADJUST.cif
│ └── warning.log
├── README
├── result
├── Si.pz-vbc.UPF
└── STRU
备注
Intel® oneAPI
以及intel-compiler-2019u3
编译elpa-2016.05.004
报错解决
这里是以--enable-openmp
版本的报错解决,普通版本的解决方式一致. 这里记录解决问题的过程
TAG=2016.05.004
ROOT=~/code/intel
cd $ROOT/source
if [ ! -f elpa-$TAG.tar.gz ]
then
wget https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$TAG/elpa-$TAG.tar.gz
fi
rm -rf elpa-$TAG
rm -rf $ROOT/elpa-$TAG
tar xzvf elpa-$TAG.tar.gz
cd elpa-$TAG
MKL_HOME=$MKLROOT
if [ ! -f configure ]
then
./autogen.sh
fi
rm -rf build
mkdir build
cd build
../configure --prefix=$ROOT/elpa-$TAG CC=mpiicc CXX=mpiicpc FC=mpiifort FCFLAGS="-mkl=cluster" --enable-openmp
make install -j20
出现报错,使用make V=1
查看具体的报错地点
可以发现是Makefile的1869行报错
通过修改Makefile文件,输出各个变量,找到报错在elpa2_print_kernels_openmp_LINK
变量中
同样的方式输出组成elpa2_print_kernels_openmp_LINK
的各个变量(如下)
468 elpa2_print_kernels_openmp_LINK = $(LIBTOOL) $(AM_V_lt) --tag=FC \
469 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(FCLD) \
470 $(elpa2_print_kernels_openmp_FCFLAGS) $(FCFLAGS) \
471 $(AM_LDFLAGS) $(LDFLAGS) -o $@
追踪到
1330 elpa2_print_kernels_openmp_FCFLAGS = $(AM_FCFLAGS) -module ${ac_empty}private_modules -Iprivate_modules
找到源头了,是因为libtool把标签-module
给忽略了,编译器不知道后面的private_modules
是什么东西,因此报错
一种曲线的解决问题方式修改${ac_empty}private_modules
, 修改
1065 ac_empty =-I
然后
make install -j20
看起来是libtool吃掉了连接module所在文件夹连接标志-module
,根据configure
for ac_flag in -J '-J ' -fmod= -moddir= +moddir= -qmoddir= '-mod ' \
'-module ' -M '-Am -M' '-e m -J '; do
FCFLAGS="$ac_fc_module_output_flag_FCFLAGS_save ${ac_flag}sub"
cat > conftest.$ac_ext <<_ACEOF
连接标志有-mod,-module
,因为intel 17
识别的ac_flag
是-mod
,且支持,gnu识别的是-J
,而intel 19
是-module
,libtool不知道为什么没能处理好-module
本文首发于我的博客@cndaqiang.
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!