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

源码安装Hyper MPI

前提条件

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

      安装GCC编译器9.3版本/毕昇编译器1.3.1版本前,需按如下顺序安装依赖: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/毕昇编译器1.3.1是否安装。
    • GCC 7.3/8.4/9.3

      gcc -v

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

      gcc version 7.3.0(GCC);
    • 毕昇编译器1.3.1

      clang -v

      检查回显信息中是否包含毕昇编译器,且版本号是否正确。

  2. 请执行以下命令,检查libtool是否安装。

    libtool --version

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

    libtool (GNU libtool) 2.4.2

GCC编译Hyper MPI软件包

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. 将源码包上传至服务器,例如“/path/to/download/ucx”目录。
    6. 执行如下命令,进入源码包路径。

      cd /path/to/download/ucx

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

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

      tar -xzvf ucx-huawei.tar.gz

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

      cd ucx-huawei/

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

      ./autogen.sh

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

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

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

      • “/path/to/install/ucx”:代表ucx的安装路径。

      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. 将源码包上传至服务器,例如“/path/to/download/ompi”目录。
    3. 执行如下命令,进入源码包路径。

      cd /path/to/download/ompi

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

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

      tar -xzvf ompi-huawei.tar.gz

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

      cd ompi-huawei/

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

      ./autogen.pl

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

      make

      make install

毕昇编译Hyper MPI软件包

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. 将上述两个源码包上传至服务器HUCX源码包安装目录,如“/path/to/download/ucx”。
    4. 执行如下命令,解压上述两个源码包。

      tar -xzvf hucx-huawei.tar.gz

      tar -xzvf xucg-huawei.tar.gz

    5. 执行以下命令,进入HUCX源码包安装路径。

      cd /path/to/download/ucx

    6. 执行以下命令,将XUCG源码包中的内容复制到HUCX源码包中的“src/ucg”目录下。

      cp -r xucg-huawei/* hucx-huawei/src/ucg

    7. 执行以下命令,进入“autogen.sh”脚本所在目录。

      cd hucx-huawei/

    8. 执行以下命令,进行源码包安装。

      ./autogen.sh

      ./contrib/configure-opt --prefix=/path/to/install/ucx CC=clang CXX=clang++ FC=flang

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

        ./contrib/configure-opt --prefix=/path/to/install/ucx --disable-numa CC=clang CXX=clang++ FC=flang

      • /path/to/install/ucx:代表UCX的安装路径。

      for file in `find . -name Makefile`;do sed -i "s/-Werror//g" $file;done

      for file in `find . -name Makefile`;do sed -i "s/-implicit-function-declaration//g" $file;done

      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. 将源码包上传至服务器Hyper MPI源码包安装目录,如“/path/to/download/ompi”。
    3. 执行以下命令,进入源码包安装目录。

      cd /path/to/download/ompi

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

      tar -zxvf ompi-huawei.tar.gz

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

      cd ompi-huawei/

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

      ./autogen.pl

      ./configure --prefix=/path/to/install/ompi --with-platform=contrib/platform/mellanox/optimized --enable-mpi1-compatibility --with-ucx=/path/to/install/ucx CC=clang CXX=clang++ FC=flang

      make

      make install

      • /path/to/install/ompi:代表ompi的安装路径。
      • /path/to/install/ucx:代表ucx的安装路径。

配置环境变量

可通过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 /path/to/install

      module load /path/to/install/Hmpi_modulefiles

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

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

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

    export OPAL_PREFIX=/path/to/install/ompi/

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