中国科学技术大学超级计算中心 李会民<hmli@ustc.edu.cn> 2017-04-01
原文:http://hmli.ustc.edu.cn/doc/app/wien2k14u2.htmWIEN2k是用密度泛函理论计算固体的电子结构的商业收费软件。它基于键结构计算最准确的方案——完全势能(线性)增广平面波((L)APW)+局域轨道(lo)方法。在密度泛函中可以使用局域(自旋)密度近似(LDA)或广义梯度近似(GGA)。WIEN2k使用全电子方案,包含相对论影响。
WIEN2k14.2软件包支持MPI并行、OpenMP并行及串行等,无需root权限即可安装,用户可以安装在自己目录下。本文仅针对采用Intel编译环境(编译器、MKL、MPI)及FFTW3做下说明。
- 设定Intel编译环境:
- 查看所用的编译器:
which ifort
输出类似:/opt/intel/composer_xe_2015.1.133/bin/intel64/ifort
如显示不存在,那么可以类似下面设置下Intel编译器环境(具体路径与你所使用的系统有关):. /opt/intel/composer_xe_2015.1.133/bin/compilervars.sh intel64
- 查看Intel MKL环境:
echo $MKLROOT
输出类似:/opt/intel/composer_xe_2015.1.133/mkl
如显示不存在,那么可以类似下面设置下Intel MKL环境(最好与编译器版本一致):. /opt/intel/composer_xe_2015.1.133/mkl/bin/mklvars.sh intel64
- 查看Intel MPI环境(最好与编译器版本一致):
which mpiifort
如显示不存在,那么可以类似下面设置下Intel MPI环境:. /opt/intel/impi/5.0.2.044/bin64/mpivars.sh intel64
- 查看所用的编译器:
- 安装支持MPI的FFTW3:
WIEN2k支持FFTW MPI并行,本人不确定Intel MKL带有的是否支持,此处采用源码编译FFTW3,并打开MPI支持。
- 下载(http://www.fftw.org/download.html):
wget ftp://ftp.fftw.org/pub/fftw/fftw-3.3.6-pl2.tar.gz
- 解压缩:
tar xvf fftw-3.3.6-pl2.tar.gz
- 进入fftw-3.3.6-pl2目录:
cd fftw-3.3.6-pl2
- 查看安装帮助:
- 查看README、INSTALL文件
- 运行命令:
./configure --help
- 生成Makefile配置:
CC=icc F77=ifort MPICC=mpiicc ./configure --prefix=~/local --enable-mpi
- CC:设定编译C程序的命令
- F77:设定编译Fortran程序的命令
- MPICC:设定编译MPI并行C程序的命令
- --prefix:设定安装后目录
- --enable-mpi:设定支持MPI
- 编译及安装;
make && make install
顺利的话将在~/local/lib目录下生成libfftw3_mpi.a及libfftw3.a等文件。
- 下载(http://www.fftw.org/download.html):
- 解压缩WIEN2k14.2.tar.gz:
tar xvf WIEN2k14.2.tar.gz
- 进入WIEN2k14.2目录:
- 给expand_lapw添加可执行权限(如已有此权限,则无需执行):
chmod +x expand_lapw
- 解压缩源文件:
./expand_lapw
将解压缩SRC_*.tar等文件到对应的SRC_*等目录。 - 查看WIEN2k官方用户手册及安装帮助:SRC_usersguide_html目录及SRC/usersguide.pdf文件等。
- 安装:
./siteconfig_lawp
将会有如下菜单输出:********************************************************* * W I E N * * site configuration * ********************************************************* Last configuration: 2017年 04月 01日 星期六 19:22:30 CST Wien Version: WIEN2k_14.2 (Release 15/10/2014) System: linuxifc S specify a system C specify compiler O specify compiler options, BLAS and LAPACK P configure Parallel execution D Dimension Parameters R Compile/Recompile U Update a package L Perl path (if not in /usr/bin/perl) Q Quit Selection:分别根据前面对应的单个字母(不区分大小写)设置相应选项:- 设置系统,按S:
********************** * Specify a system * ********************** Current system is: linuxifc I Linux (Intel ifort compiler (12.0 and later) + mkl ) J Linux (Intel ifort 9 or 10 compiler + mkl 9.0 ) K Linux (Intel ifort 11.0 compiler + mkl ) K1 Linux (Intel ifort 11.1 compiler + mkl ) A AIX (not updated) V Linux (gfortran compiler + blaslapw (try to use at least gotoblas) G GENERIC (you have to define everything ) L Linux (PGI compiler) (not updated) P Linux (Pathscale compiler) (not updated) W Linux (G95 compiler + gotolib) (not updated) S SGI (Origin) (not updated) S1 SGI Altix 350/3000 with Intel 7.1 compiler) (not updated) U SUN (not updated) L1 Linux (Lahey LF97 compiler) (not updated) M Mac (mac g4 + absoft compiler) (not updated) Q Quit选择I,采用linuxifc,设置完后将保存在SYSTEM文件中,以后可以修改此文件后再运行siteconfig_lawp进行设置,下面几步中的类似。 - 设置编译器,按C:
Recommended setting for f90 compiler: ifort Current selection: ifort Your compiler:直接回车或输入ifort回车,采用Intel Fortran编译器,设置后将保存在COMPILER文件中。Recommended setting for C compiler: cc Current selection: icc Your compiler:直接回车或输入icc回车,采用Intel C编译器,设置后将保存在COMPILERC文件中。 - 设置BLAS、LAPACK等编译选项,按O:
会提示已经找到MKL环境:
Your MKLROOT=/opt/intel/composer_xe_2015.1.133/mkl Your MKL_TARGET_ARCH=intel64 The default options shown on the next screen should be ok
回车后显示(Current因为我已经设置过,所以如此显示):ecommended options for system linuxifc are: Compiler options: -FR -mp1 -w -prec_div -pc80 -pad -ip -DINTEL_VML -traceback -assume buffered_io Linker Flags: $(FOPT) -L$(MKLROOT)/lib/$(MKL_TARGET_ARCH) -pthread Preprocessor flags: '-DParallel' R_LIB (LAPACK+BLAS): -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread Current settings: O Compiler options: -FR -mp1 -w -prec_div -pc80 -pad -ip -DINTEL_VML -O2 -axavx -fp-model source -assume buffered_io F FFTW options: -DFFTW3 -I/$(HOME)/local/include L Linker Flags: $(FOPT) -L$(MKLROOT)/lib/$(MKL_TARGET_ARCH) P Preprocessor flags '-DParallel' R R_LIB (LAPACK+BLAS): -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread FL FFTW_LIBS: -lfftw3_mpi -lfftw3 -L/$(HOME)/local/lib S Save and Quit Q Quit abandon changes To change an item select option. Selection:
O Compiler options: -FR -mp1 -w -prec_div -pc80 -pad -ip -DINTEL_VML -O2 -axavx -fp-model source -assume buffered_io F FFTW options: -DFFTW3 -I/$(HOME)/local/include L Linker Flags: $(FOPT) -L$(MKLROOT)/lib/$(MKL_TARGET_ARCH) P Preprocessor flags '-DParallel' R R_LIB (LAPACK+BLAS): -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread FL FFTW_LIBS: -lfftw3_mpi -lfftw3 -L/$(HOME)/local/lib
设置各项后记得按S保存退出。设置后会保存在OPTIONS文件中。- 设置并行方式,按P,随后出现的页面中选择MPI而非共享内存并行,在下面直接回车或输入N回车:
Shared Memory Architecture? (y/N):
设定完后将保存在MPI文件中 - 设定是否绑定到特定节点,直接回车:
Do you know/need a command to bind your jobs to specific nodes ? (like taskset -c). Enter N / your_specific_command:
- 设定是否采用MPI2,输入1回车,设置完后将保存在parallel_options文件中:
On most mpi-2 versions, it is better to start an mpijob on the original machine and not via ssh on a remote system. If you are using mpi2 set MPI_REMOTE to 0 Set MPI_REMOTE to 0 / 1:
- 设定远程shell,采用ssh,直接回车:
Remote shell (default is ssh) =
- 设定为了支持大算例,需要设定相关MPI和FFTW环境:
This is useful only for BIG cases (50 atoms and more / unit cell) and your HARDWARE has at least 16 cores (or is a cluster with Infiniband) You need to KNOW details about your installed MPI and FFTW )
- 在/usr和/opt尝试自动搜索设定FFTW环境:
Finding the required fftw2/3 mpi-files in /usr and /opt ....
设定FFTW2或3,采用FFTW3:输入FFTW3回车 - 如果找到FFTW,会显示找到的,也可以考虑采用找到的:
Please specify the ROOT-path of your FFTW installation (like /opt/fftw3):
此处选择采用本文前面编译的,输入/home/nic/hmli/local回车,显示:Your FFTW_LIBS are: -lfftw3_mpi -lfftw3 -L/home/nic/hmli/local/lib Your FFTW_OPT are : -DFFTW3 -I/home/nic/hmli/local/include
如正确,则输入Y回车确认。 - 输入S保存退出
- 在/usr和/opt尝试自动搜索设定FFTW环境:
- 设置维度参数,输入D:请根据自己需要参考WIEN2k官方用户手册设置。
- 设置
- 编译,输入R:
A Compile all programs (suggested) S Select program Q Quit Selection:请根据需要选择部分编译(S)或全编译(A),此处选择A进行全编译。然后就开始漫长的编译了,编译最后会提示是否有问题。
- 设置系统,按S:
- 用户设置:
./userconfig_lapw
请根据提示设置编辑器、pdf查看器、工作目录等,具体请看WIEN2k官方用户手册。 - w2web网页服务设置:请参看WIEN2k官方用户手册。
- 问题处理:查看各SRC_*目录下的compile.msg文件,如果有问题,那么可以根据提示,修改对应目录下的Makefile,然后再执行make或make para等。
