鲲鹏社区首页
中文
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

源码安装Hyper MPI

前提条件

已经完成以下依赖包的安装。
  • perl-Data-Dumper
  • autoconf
  • automake
  • libtool 2.4.2
  • gcc编译器 7.3/8.4/9.3

    安装gcc编译器9.3版本前,需按如下顺序安装依赖:gmp-6.2.0.tar.bz2、mpfr-4.0.2.tar.bz2、mpc-1.1.0.tar.gz、isl-0.18.tar.bz2

  • numactl
  • binutils
  • systemd-devel
  • valgrind

编译环境变量检查

  1. 请执行以下命令,检查GCC 7.3/8.4/9.3是否安装。

    gcc -v

    回显信息显示如下表示GCC 7.3.0已安装:

    gcc version 7.3.0(GCC);
  2. 请执行以下命令,检查libtool是否安装。

    libtool --version

    回显信息显示如下表示libtool 2.4.2已安装:

    libtool (GNU libtool) 2.4.2

软件包编译

Hyper MPI包含ompi和ucx两个软件层,其中ompi的安装依赖于ucx,编译时应先编译ucx。

  • ucx编译
    1. 执行如下命令,从github上获取hucx源码包“hucx-huawei.tar.gz”

      git clone https://github.com/kunpengcompute/hucx

    2. 执行如下命令,从github上获取xucg源码包“xucg-huawei.tar.gz”

      git clone https://github.com/kunpengcompute/xucg

    3. 执行如下命令,解压上述两个源码包,并将xucg源码包中的内容复制到hucx源码包中的“src\ucg”目录下。

      tar -xzvf hucx-huawei.tar.gz

      tar -xzvf xucg-huawei.tar.gz

    4. 执行如下命令,压缩hucx源码包。

      tar -zcvf ucx-huawei.tar.gz hucx-huawei

    5. 将源码包上传至服务器,例如“/where/to/download/ucx”目录。
    6. 执行如下命令,进入源码包路径。

      cd /where/to/download/ucx

      /where/to/download/ucx:代表ucx源码包上传后的存放路径。

    7. 执行如下命令,解压软件包。

      tar -xzvf ucx-huawei.tar.gz

    8. 执行如下命令,进入autogen.sh脚本所在目录。

      cd ucx-huawei/

    9. 执行如下命令,进行源码包安装。

      ./autogen.sh

      ./contrib/configure-opt --prefix=/where/to/install/ucx

      环境上若没有安装numactl插件,则需要执行如下命令,指定--disable-numa参数:

      ./contrib/configure-opt --prefix=/where/to/install/ucx --disable-numa

      make -j32

      make -j32 install

      make后面-j参数是并行编译参数,指的是有多少CPU核心参与编译过程,需用户根据实际CPU核数进行指定。

  • ompi编译
    1. 执行如下命令,从github上获取ompi源码包ompi-huawei.tar.gz。

      git clone https://github.com/kunpengcompute/hmpi

    2. 将源码包上传至服务器,例如“/where/to/download/ompi”目录。
    3. 执行如下命令,进入源码包路径。

      cd /where/to/download/ompi

      /where/to/download/ompi:代表ompi源码包上传后的存放路径。

    4. 执行如下命令,解压软件包。

      tar -xzvf ompi-huawei.tar.gz

    5. 执行如下命令,进入autogen.pl脚本所在目录。

      cd ompi-huawei/

    6. 执行如下命令,进行源码包安装。

      ./autogen.pl

      ./configure --prefix=/where/to/install/ompi --with-platform=contrib/platform/mellanox/optimized --enable-mpi1-compatibility --with-ucx=/where/to/install/ucx

      make

      make install

配置环境变量

可通过environment-modules工具和写入~/.bashrc文件两种方式配置环境变量。

  • 方式1:使用environment-modules工具管理环境变量,加载环境前,先确认已安装此工具。此方式用于临时生效Hyper MPI环境变量。
    1. 执行如下命令,在environment-modules工具安装路径下创建并编辑Hmpi_modulefiles配置文件。

      vim /path/to/install/Hmpi_modulefiles

      修改内容如下:

      #%Module1.0
      #  HMPI module for use with 'environment-modules' package:
      conflict                mpi 
      prepend-path  OPAL_PREFIX /path/to/install/ompi/
      prepend-path  PATH /path/to/install/ompi/bin:/path/to/install/ucx/bin
      prepend-path  LD_LIBRARY_PATH /path/to/install/ompi/lib:/path/to/install/ucx/lib
      prepend-path  INCLUDE /path/to/install/ompi/include

      /path/to/install:表示environment-modules工具的安装路径。用户若不指定安装路径,则默认安装在/usr/share/Modules/modulefiles路径下。

    2. 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
    3. 执行如下module命令,加载环境变量。

      module use /usr/share/Modules/modulefiles

      module load /usr/share/Modules/modulefiles/Hmpi_modulefiles

  • 方式2:将以下环境变量写到用户的~/.bashrc文件中,使其配置生效。此方式永久生效Hyper MPI环境变量。

    配置环境变量主要是将hucx和hmpi加入到PATH和LD_LIBRARY_PATH中:

    export PATH=/where/to/install/ompi/bin:/where/to/install/ucx/bin:$PATH

    export LD_LIBRARY_PATH=/where/to/install/ompi/lib:/where/to/install/ucx/lib:$LD_LIBRARY_PATH

export PATH=/where/to/install/ompi/bin:/where/to/install/ucx/bin:$PATH

export LD_LIBRARY_PATH=/where/to/install/ompi/lib:/where/to/install/ucx/lib:$LD_LIBRARY_PATH