下载

要下载AxiSEM3D,可以在终端中输入以下命令:

1
$ git clone https://github.com/kuangdai/AxiSEM3D

安装依赖包

  • mpi并行环境,可安装不带 MPI 加速的版本
  • METIS 安装版本大于5.1, 只需安装32位的版本即可
  • Boost 安装的版本要大于1.60, 直接下载解压即可
  • Eigen3 安装的版本要大于3.3-rc1, 直接下载解压即可
  • FFTW 安装版本要大于3.3, 需要安装双精度和单精度两个版本
  • NetCDF 安装版本大于4.4
  • zlib NetCDF的依赖项,暂无版本要求,建议1.2.8以上
  • hdf5 NetCDF的依赖项,暂无版本要求,建议1.8.12以上

FFTW

由于MPi并行环境,metis之前已写过安装教程,可自行参考上面的链接查看或看官网给的安装说明。

Boost和Eigen3只需要下载软件,解压即可,不在此过多讨论。

FFTW的安装过程比较简单,其安装过程如下

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 下载软件
$ wget http://www.fftw.org/fftw-3.3.8.tar.gz
# 解压软件
$ tar -xvf fftw-3.3.8.tar.gz
# 配置双精度版本
$ cd fftw-3.3.8
$ ./configure --prefix=${HOME}/.axisem3d_depends/fftw-3.3.8
$ make -j
# 配置单精度版本
$ ./configure --enable-float --prefix=${HOME}/.axisem3d_depends/fftw-3.3.8
$ make -j
$ make install

zlib的安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 下载
$ wget https://zlib.net/zlib-1.2.8.tar.gz
# 解压
$ tar -xvf zlib-1.2.8.tar.gz
# 安装
$ cd zlib-1.2.8
$ ZDIR=${HOME}/.axisem3d_depends/zlib-1.2.8
$ ./configure --prefix=${ZDIR}
$ make check
$ make install

hdf5的安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 下载
$ wget https://support.hdfgroup.org/ftp/HDF5/prev-releases/hdf5-1.8/hdf5-1.8.12/src/hdf5-1.8.12.tar.gz
# 解压
$ tar -xvf hdf5-1.8.12.tar.gz
# 安装
$ cd hdf5-1.8.12
$ H5DIR=${HOME}/.axisem3d_depends/hdf5-1.8.12
$ ./configure --with-zlib=${ZDIR} --prefix=${H5DIR} --enable-hl
$ make check
$ make install

NetCDF的安装

1
2
3
4
5
6
7
8
# 下载
$ git clone http://github.com/Unidata/netcdf-c netcdf-c
# 安装
$ cd netcdf-c
$ NCDIR=${HOME}/.axisem3d_depends/netcdf-c
$ CPPFLAGS='-I${H5DIR}/include -I${ZDIR}/include' LDFLAGS='-L${H5DIR}/lib -L${ZDIR}/lib' ./configure --prefix=${NCDIR}
$ make check
$ make install

AxiSEM3D

配置依赖项

编辑$AxiSEM3D_SRC下的axisem3d_depends.sh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export MY_CONDA_INSTALL_DIR=/home/opt/anaconda3/2020.02
# Ubuntu default
export MY_BASH_PROFILE_UBT=$HOME/.bashrc

# What do you have already? And where are they?
# boost
export MY_BOOST_READY=true
export MY_BOOST_DIR=$HOME/.axisem3d_depends/boost
# eigen3 (make sure it is above 3.3-rc1, very important)
export MY_EIGEN3_READY=true
export MY_EIGEN3_DIR=$HOME/.axisem3d_depends/eigen3
# fftw (make sure it contains both double- and single-precision)
export MY_FFTW_READY=true
export MY_FFTW_DIR=$HOME/.axisem3d_depends/fftw-3.3.8
# Metis (make sure it is built with 32-bit)
export MY_METIS_READY=true
export MY_METIS_DIR=$HOME/.axisem3d_depends/metis-5.1.0
# NetCDF
export MY_NETCDF_READY=true
export MY_NETCDF_DIR=$HOME/.axisem3d_depends/netcdf-c

# where you would like to download boost and eigen3
export BOOST_INSTALL_DIR=$HOME/.axisem3d_depends/boost
export EIGEN3_INSTALL_DIR=$HOME/.axisem3d_depends/eigen3

安装

1
2
3
4
5
6
7
8
9
# build, my_axisem3d_build和AxiSEM3D是同一级目录
$ mkdir my_axisem3d_build
$ ls
AxiSEM3D my_axisem3d_build
$ cd my_axisem3d_build
# cmake
$ cmake -DCMAKE_BUILD_TYPE=release ../AxiSEM3D/SOLVER
# compile and link
$ make -j

测试

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
########## run ##########
# make a simulation directory
mkdir my_second_run
cd my_second_run
# copy the executable 
cp ../my_axisem3d_build/axisem3d ./
# copy the input folder
cp -R ../AxiSEM3D/template/input ./
# Though optional, it is always a good practice 
# to backup the source code for reproducibility:
cp -r ../AxiSEM3D/SOLVER ./
# run it with any number of processors
mpirun -np 4 ./axisem3d
# check the outputs
ls output

修订历史

  • 2020-09-02:初稿;

参考资料