安装HDF5-Parallel

  • 下载
    由于使用的是mpif90进行源码编译,所以必须要安装HDF5支持parallel的编译选项:
    处于版本管理的考虑,这里直接选择源码安装,这样安装文件比较可控
    下载地址:https://support.hdfgroup.org/ftp/HDF5/releases/,下载放置于`/home/jihenghu/`下。
    Prof.XU安装的版本应该是1.10.6,我这里直接使用最新的1.14.0,并且发现是行得通的。

  • 安装

    bash
    $ cd
    jihenghu@canopy:~ $ mkdir hdf5-parallel-1.14.0
    jihenghu@canopy:~ $ tar -zvxf hdf5-1.14.0.tar.gz
    jihenghu@canopy:~ $ cd hdf5-1.14.0

    ## 提供zlib库的位置。参考RTTOV安装的文章,这里是否必要我不是很清楚,反正我用了
    jihenghu@canopy:hdf5-1.14.0 $ export LD_LIBRARY_PATH=/home/hjh/zlib/lib:$LD_LIBRARY_PATH

    ## HDF5 编译选项
    jihenghu@canopy:hdf5-1.14.0 $ ./configure --with-zlib=/home/jihenghu/zlib \
    --prefix=/home/jihenghu/hdf5-parallel-1.14.0 \
    FC=mpif90 CC=mpicc \
    --disable-static \
    --enable-parallel\
    --enable-fortran

    jihenghu@canopy:hdf5-1.14.0 $ make
    jihenghu@canopy:hdf5-1.14.0 $ make check ## 会发现一些错误,但是不影响
    jihenghu@canopy:hdf5-1.14.0 $ make install
  • ~/.bashrc中注册HDF5-parallel

    plaintext
    jihenghu@canopy:~ $ vim ~/.bashrc
    ## 追加一下内容:
    ## hdf5-1.14.0 parallel
    export PATH=/home/jihenghu/hdf5-parallel-1.14.0/bin:$PATHy
    export LD_LIBRARY_PATH=/home/jihenghu/hdf5-parallel-1.14.0/lib:$LD_LIBRARY_PATH

    参考:https://www.pism.io/docs/installation/parallel-io-libraries.html

安装ED2-hydro

  • 下载ED2-hydro,我是从Xu的仓库拉取的,你也可以使用ED2的官方仓库:

    bash
    jihenghu@canopy:data00 $ git clone https://github.com/xiangtaoxu/ED2
  • 编译配置
    进入ED/ED/build/make文件下:

    bash
    jihenghu@canopy:make $ cp include.mk.gfortran include.mk.canopy

    jihenghu@canopy:make $ vim include.mk.canopy
    # 按照HDF5的安装设置修改一下内容
    # HDF 5 Libraries
    HDF5_HOME=/home/jihenghu/hdf5-parallel-1.14.0
    HDF5_INCS=-I/home/jihenghu/hdf5-parallel-1.14.0/include
    HDF5C_INCS=-I/home/jihenghu/hdf5-parallel-1.14.0/include
    HDF5_LIBS=-lhdf5 -lhdf5_fortran -lhdf5_hl -lz
  • 安装

    bash
    jihenghu@canopy:make $ ./install.sh -k E -p canopy -g

    具体编译选项可以去看:https://github.com/EDmodel/ED2/wiki/Quick-start#user-content-Compiling_ED2
    如果编译错了,可以使用-c 选项来清除对应的编译安装遗留。
    安装完成了可以看到提示:’Finished building === ../../build//ed_2.2-opt’,这就是可执行文件的位置。

运行

Running ED-2 (以下内容来自于ED2 WIKI)

  • 串行方式
    单个polygon(包含多个sites)的模拟必须使用串行方式。To run this, simply copy or link the executable (for example, ed_2.2-opt to the same directory where the ED2IN file you modified is located, then type:
    plaintext
    > ./ed_2.2-opt
    In case your namelist is called anything other than ED2IN, you must provide the correct name using the -f option
    plaintext
    > ./ed_2.2-opt -f my-ED2IN
  • 并行方式
    Regional模拟(包含多个grids和polygon的情形),可以是用并行加速,所以你需要用到mpirun命令:
    plaintext
    > mpirun -np [n] ./ed_2.2-opt -f my-ED2IN
    where [n] is the number of processors to use. The -f option also works in parallel simulations.