mailoliver的个人博客分享 http://blog.sciencenet.cn/u/mailoliver

博文

[转载]gpaw 安装合集(在线、离线、非root)(linux)-转自知乎

已有 2894 次阅读 2022-3-8 17:14 |个人分类:gpaw|系统分类:科研笔记|文章来源:转载

gpaw 是一款效率比较高的第一性原理计算软件,在接近vasp的计算精度情况下,只消耗20%的时间。官网为:

https://wiki.fysik.dtu.dk/gpaw/install.html#siteconfigwiki.fysik.dtu.dk/gpaw/install.html#siteconfig

安装介绍:Installation - GPAW

Installation - GPAWwiki.fysik.dtu.dk/gpaw/install.html#siteconfig


一. root,在线,pip安装, 单节点(centos:最简洁版)

这个可以安装在自己的电脑,用来作为测试使用。

  1. 下载必要依赖包:

yum install epel-release #有些程序包在这里面 yum install libxc-devel openblas-devel openmpi-devel fftw-devel yum install blacs-openmpi-devel scalapack-openmpi-devel

.bashrc 加入:

OPENMPI=/usr/lib64/openmpi
export PATH=$OPENMPI/bin/:$PATH
export LD_LIBRARY_PATH=$OPENMPI/lib:$LD_LIBRARY_PATH
export GPAW_SETUPPATH=/home/yourusername/gpaw_setups/gpaw-setups-0.9.20000.tar.gz

其中setups文件从官网下载:wiki.fysik.dtu.dk/gpaw/

2. 安装gpaw:

pip install gpaw

结果如上图所示,这种安装方式功能有限,并且因为为了方便,配置内容都放在了.bashrc,比较混乱。

二. root 离线,本地安装(建议)

  1. 下载必要依赖包,(在线安装如下,离线rpm包,在此安装不做展开):

yum install epel-release #有些程序包在这里面 yum install libxc-devel openblas-devel openmpi-devel fftw-devel yum install blacs-openmpi-devel scalapack-openmpi-devel

从gitlab下载gpaw.tar.gz,,解压并修改配置文件siteconfig.py。(若没有可创建,或者更改已存在的siteconfig_exapmle.py 为siteconfig.py):

tar -xf gpaw***.tar.gz 
cd pgaw
vim siteconfig.py

写入:

# FFTW3:
fftw = True
if fftw:
libraries = ['fftw3']

# openblas
openblas = True
if openblas :
libraries +=['openblas']

# mpiblacs

mpiblacs = True
if mpiblacs :
libraries +=['mpiblacs']

# ScaLAPACK (version 2.0.1+ required):
scalapack = True
if scalapack:
libraries += ['scalapack']

# xc:
xc = True
if xc:
libraries += ['xc']

# openmp
openmp = False
if openmp:
extra_compile_args += ['-fopenmp']
extra_link_args += ['-fopenmp']

保存文件,其中 openmp 在并行安装时使用。

2. 安装gpaw:

python setup.py install

结果如下图所示,推荐,其他辅助功能可按照类似方式配置。


ubuntu

注:ubuntu同centos,第一步依赖程序换成:

sudo apt install libopenblas-dev libxc-dev libscalapack-mpi-dev libfftw3-dev

三. 在线, root,多节点并行 (intel mpi)

对于能够联网intel服务器来说这里,可以参考第二种方式。关闭其中的openmp,同时需要在.bashrc文件中加入:

export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/mpi/:$PATH
export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/mpi/intel64/bin/:$PATH
export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/:$PATH


intel mpi下载请自行百度,一般使用过一段时间的服务器都已经安装好了,对应位置请自行设置。

四. 完全离线, 非root,编译安装,多节点并行 (intel mpi)

对于不能联网服务器,比如某些使用intel cpu的超算,安装最为麻烦,其他种类的cpu请参考他们的文档。

  1. 需要先编译几个基本库

Inter MPI:(不使用openmp)

intel mpi下载请自行百度,一般使用过一段时间的服务器都已经安装好了,对应位置请自行设置。在.bashrc文件中加入:

export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/mpi/:$PATH
export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/mpi/intel64/bin/:$PATH
export PATH=/opt/intel2020/compilers_and_libraries_2020.0.166/linux/:$PATH

libxc:

wget http://www.tddft.org/programs/octopus/down.php?file=libxc/4.2.3/libxc-4.2.3.tar.gz -O libxc-4.2.3.tar.gz
tar -xf libxc-4.2.3.tar.gz
cd libxc-4.2.3
./configure --enable-shared --disable-fortran --prefix=$HOME/libxc-4.2.3
make -j 10
make install

添加文件.bashrc:

XC=~/libxc-4.2.3
export C_INCLUDE_PATH=$XC/include
export LIBRARY_PATH=$XC/lib
export LD_LIBRARY_PATH=$XC/lib

(这个过程中,可能会需要设置添加-std=c99, 或者直接更改xc-theshold.c文件第800+行,把i定义放在for循环外。不知道是不是bug? )

openblas (非必须):

tar -xf openblas.tar.gz
cd openblas
./configure --prefix=$HOME/openblas
make -j 10
make install
libraries = ['openblas']
library_dirs = ['path_to_myblas']

添加文件.bashrc:

export C_INCLUDE_PATH=$HOME/openblas/include/:$C_INCLUDE_PATH
export LD_LIBRARY_PATH=$HOME/openblas/lib/:$LD_LIBRARY_PATH
export LIBRARY_PATH=/$HOME/openblas/lib/:$LIBRARY_PATH
export PATH=$HOME/openblas/bin/:$PATH

fftw:

FFTW Download Pagewww.fftw.org/download.html

没啥说的,和上面一样,编译安装,其中配置参数注意:

(并行版本)

./configure MPICC=mpicc --prefix=$HOME/fftw --disable-fortran --enable-mpi --enable-shared

(非并行版本)

./configure --prefix=$HOME/fftw --disable-fortran

添加文件.bashrc:

export LD_LIBRARY_PATH=/$HOME/fftw/lib/:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$HOME/fftw/include/:$C_INCLUDE_PATH
export LIBRARY_PATH=$HOME/fftw/lib/:$LIBRARY_PATH

其他的库请按照该方式自行安装。

2. gpaw:

tar -xf gpaw***.tar.gz 
cd gpaw
vim siteconfig.py

siteconfig.py 写入:

libraries += ['openblas']
library_dirs += ['/data/home/wa/openblas/lib/']

include_dirs +=["/data/home/wa/anaconda3/include/python3.8"]
include_dirs +=["/data/home/wa/anaconda3/lib/python3.8/site-packages/numpy/core/include"]

# FFTW3:
fftw=True

libraries += ['fftw3']
ff = '/data/home/wa/gpaw/fftw/'
include_dirs += [ff + 'include']
library_dirs += [ff + 'lib']
extra_link_args += ['-Wl,-rpath={ff}lib'.format(ff=ff)]

# LibXC:

xc = '/data/home/wa/gpaw/libxc/'
include_dirs += [xc + 'include']
library_dirs += [xc + 'lib']
# You can use rpath to avoid changing LD_LIBRARY_PATH:
extra_link_args += ['-Wl,-rpath={xc}lib'.format(xc=xc)]
if 'xc' not in libraries:
libraries.append('xc')

setup.py 文件写入:

extra_compile_args = ['-Wall', '-Wno-unknown-pragmas', '-std=c99',"-Xlinker",]

运行:

python setup.py build_ext install

这样装完,基本都是动态链接。所以谨慎删除文件。

编辑于 2021-09-18 18:02



https://blog.sciencenet.cn/blog-3471958-1328574.html

上一篇:已知拉曼张量,计算拉曼振动模强度随旋转角度变化关系(偏振拉曼)
下一篇:openmpi+gfortran编译ShengBTE
收藏 IP: 110.87.118.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-28 03:00

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部