源码安装Hyper MPI(开源组件)
前提条件
操作系统 |
依赖包 |
---|---|
|
|
Ubuntu 18.04.5 LTS arm64 |
|
编译环境变量检查
GCC编译Hyper MPI软件包
Hyper MPI包含Hyper MPI、HUCX和XUCG三个软件层,其中Hyper MPI的安装依赖于HUCX和XUCG,编译顺序应为编译HUCX > 编译XUCG > 编译Hyper MPI。
- 编译HUCX。
- 使用PuTTY工具,以Hyper MPI安装维护用户(例如“hmpi_master”)登录至作业执行节点。
- 下载HUCX源码包“hucx-v2.3.0-huawei.tar.gz”。
下载地址:https://gitee.com/kunpengcompute/hucx/repository/archive/v2.3.0-huawei.tar.gz
- 将上述源码包上传至服务器HUCX源码包安装目录,如“/path/to/download/hucx”。
- 执行以下命令,进入HUCX源码包安装路径。
- 执行以下命令,解压上述源码包。
- 执行以下命令,进入“autogen.sh”脚本所在目录。
- 执行以下命令,进行源码包安装。
./contrib/configure-opt --prefix=/path/to/install/hucx --enable-mt CC=gcc CXX=g++ FC=gfortran
- 若需要支持GPU Aware功能,且环境上已安装CUDA,则需要执行以下命令,指定--with-cuda参数:
./contrib/configure-opt --prefix=/path/to/install/hucx --with-cuda=/path/to/install/cuda --enable-mt CC=gcc CXX=g++ FC=gfortran
- 环境上若没有安装numactl插件,则需要执行以下命令,指定--disable-numa参数:
./contrib/configure-opt --prefix=/path/to/install/hucx --disable-numa --enable-mt CC=gcc CXX=g++ FC=gfortran
- /path/to/install/hucx:表示HUCX的安装路径。
- /path/to/install/cuda:表示CUDA的安装路径。
make -j32
make -j32 install
make后面-j参数为并行编译参数,表示有多少CPU核数参与编译过程,请根据实际CPU核数进行指定。
- 若需要支持GPU Aware功能,且环境上已安装CUDA,则需要执行以下命令,指定--with-cuda参数:
- 执行以下命令,加载HUCX环境变量。
export LD_LIBRARY_PATH=/path/to/install/hucx/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/path/to/install/hucx/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/path/to/install/hucx/include:$CPLUS_INCLUDE_PATH
- 编译XUCG。
- 使用PuTTY工具,以Hyper MPI安装维护用户(例如“hmpi_master”)登录至作业执行节点。
- 下载XUCG源码包“xucg-v2.3.0-huawei.tar.gz”。
下载地址:https://gitee.com/kunpengcompute/xucg/repository/archive/v2.3.0-huawei.tar.gz
- 将上述源码包上传至服务器XUCG源码包安装目录,如“/path/to/download/xucg”。
- 执行以下命令,进入XUCG源码包安装路径。
- 执行以下命令,解压上述源码包。
- 执行以下命令,进入“CMakeLists.txt”所在目录。
- 执行以下命令,进行源码包安装。
cmake3 .. -DCMAKE_INSTALL_PREFIX=/path/to/install/xucg -DCMAKE_BUILD_TYPE=Release -DUCG_BUILD_WITH_UCX=/path/to/install/hucx -DUCG_ENABLE_MT=ON -DUCG_BUILD_TESTS=OFF -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran
/path/to/install/xucg:表示XUCG的安装路径。
make -j32
make -j32 install
make后面-j参数为并行编译参数,表示有多少CPU核数参与编译过程,请根据实际CPU核数进行指定。
- 执行以下命令,加载XUCG环境变量。
export LD_LIBRARY_PATH=/path/to/install/xucg/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/path/to/install/xucg/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/path/to/install/xucg/include:$CPLUS_INCLUDE_PATH
- 编译Hyper MPI。
- 使用PuTTY工具,以Hyper MPI安装维护用户(例如“hmpi_master”)登录至作业执行节点。
- 下载Hyper MPI源码包“hmpi-v2.3.0-huawei.tar.gz”。
下载地址:https://gitee.com/kunpengcompute/hmpi/repository/archive/v2.3.0-huawei.tar.gz
- 将源码包上传至服务器Hyper MPI源码包安装目录,如“/path/to/download/hmpi”。
- 执行以下命令,进入源码包安装目录。
- 执行以下命令,解压软件包。
- 执行以下命令,进入“autogen.pl”脚本所在目录。
- 执行以下命令,进行Hyper MPI源码包安装。
./autogen.pl
./configure --prefix=/path/to/install/hmpi --with-platform=contrib/platform/mellanox/optimized --enable-mpi1-compatibility --with-ucx=/path/to/install/hucx --with-ucg=/path/to/install/xucg CC=gcc CXX=g++ FC=gfortran
make
make install
- 若需要支持GPU Aware功能,且环境上已安装CUDA,则需要执行以下命令,指定--with-cuda参数:
./configure --prefix=/path/to/install/hmpi --with-platform=contrib/platform/mellanox/optimized --with-cuda=/path/to/install/cuda --enable-mpi1-compatibility --with-ucx=/path/to/install/hucx --with-ucg=/path/to/install/xucg CC=gcc CXX=g++ FC=gfortran
- /path/to/install/hmpi:表示Hyper MPI的安装路径。
- /path/to/install/cuda:表示CUDA的安装路径。
- /path/to/install/hucx:表示HUCX的安装路径。
- /path/to/install/xucg:表示XUCG的安装路径。
- 若需要支持GPU Aware功能,且环境上已安装CUDA,则需要执行以下命令,指定--with-cuda参数:
毕昇编译Hyper MPI软件包
Hyper MPI包含Hyper MPI、HUCX和XUCG三个软件层,其中Hyper MPI的安装依赖于HUCX和XUCG,编译顺序应为编译HUCX > 编译XUCG > 编译Hyper MPI。
- 编译HUCX。
- 使用PuTTY工具,以Hyper MPI安装维护用户(例如“hmpi_master”)登录至作业执行节点。
- 下载HUCX源码包“hucx-v2.3.0-huawei.tar.gz”。
下载地址:https://gitee.com/kunpengcompute/hucx/repository/archive/v2.3.0-huawei.tar.gz
- 将上述源码包上传至服务器HUCX源码包安装目录,如“/path/to/download/hucx”。
- 执行以下命令,进入HUCX源码包安装路径。
- 执行以下命令,解压上述源码包。
- 执行以下命令,进入“autogen.sh”脚本所在目录。
- 安装源码包。
- 毕昇编译器为3.0.0及以上版本,请执行以下命令,进行源码安装。
./contrib/configure-opt --prefix=/path/to/install/hucx CFLAGS="-Wno-unused-but-set-variable" --enable-mt CC=clang CXX=clang++ FC=flang
- 毕昇编译器为3.0.0以下版本,请执行以下命令,进行源码安装。
./contrib/configure-opt --prefix=/path/to/install/hucx --enable-mt CC=clang CXX=clang++ FC=flang
- 若需要支持GPU Aware功能,且环境上已安装CUDA,请执行以下命令,指定--with-cuda参数:
- 毕昇编译器为3.0.0及以上版本
./contrib/configure-opt --prefix=/path/to/install/hucx --with-cuda=/path/to/install/cuda CFLAGS="-Wno-unused-but-set-variable" --enable-mt CC=clang CXX=clang++ FC=flang
- 毕昇编译器为3.0.0以下版本
./contrib/configure-opt --prefix=/path/to/install/hucx --with-cuda=/path/to/install/cuda --enable-mt CC=clang CXX=clang++ FC=flang
- 毕昇编译器为3.0.0及以上版本
- 若没有安装numactl插件,则需要执行以下命令,指定--disable-numa参数:
- 毕昇编译器为3.0.0及以上版本
./contrib/configure-opt --prefix=/path/to/install/hucx CFLAGS="-Wno-unused-but-set-variable" --disable-numa --enable-mt CC=clang CXX=clang++ FC=flang
- 毕昇编译器为3.0.0以下版本
./contrib/configure-opt --prefix=/path/to/install/hucx --disable-numa --enable-mt CC=clang CXX=clang++ FC=flang
- 毕昇编译器为3.0.0及以上版本
- /path/to/install/hucx:表示HUCX的安装路径。
- /path/to/install/cuda:表示CUDA的安装路径。
make -j32
make -j32 install
make后面-j参数为并行编译参数,表示有多少CPU核数参与编译过程,请根据实际CPU核数进行指定。
- 毕昇编译器为3.0.0及以上版本,请执行以下命令,进行源码安装。
- 执行以下命令,加载HUCX环境变量。
export LD_LIBRARY_PATH=/path/to/install/hucx/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/path/to/install/hucx/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/path/to/install/hucx/include:$CPLUS_INCLUDE_PATH
- 编译XUCG。
- 使用PuTTY工具,以Hyper MPI安装维护用户(例如“hmpi_master”)登录至作业执行节点。
- 下载XUCG源码包“xucg-v2.3.0-huawei.tar.gz”。
下载地址:https://gitee.com/kunpengcompute/xucg/repository/archive/v2.3.0-huawei.tar.gz
- 将上述源码包上传至服务器XUCG源码包安装目录,如“/path/to/download/xucg”。
- 执行以下命令,进入XUCG源码包安装路径。
- 执行以下命令,解压上述源码包。
- 执行以下命令,进入“CMakeLists.txt”所在目录。
- 执行以下命令,进行源码包安装。
cmake3 .. -DCMAKE_INSTALL_PREFIX=/path/to/install/xucg -DCMAKE_BUILD_TYPE=Release -DUCG_BUILD_WITH_UCX=/path/to/install/hucx -DUCG_ENABLE_MT=ON -DUCG_BUILD_TESTS=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang
/path/to/install/xucg:表示XUCG的安装路径。
make -j32
make -j32 install
make后面-j参数为并行编译参数,表示有多少CPU核数参与编译过程,请根据实际CPU核数进行指定。
- 执行以下命令,加载XUCG环境变量。
export LD_LIBRARY_PATH=/path/to/install/xucg/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/path/to/install/xucg/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/path/to/install/xucg/include:$CPLUS_INCLUDE_PATH
- 编译Hyper MPI。
- 使用PuTTY工具,以Hyper MPI安装维护用户(例如“hmpi_master”)登录至作业执行节点。
- 下载Hyper MPI源码包“hmpi-v2.3.0-huawei.tar.gz”。
下载地址:https://gitee.com/kunpengcompute/hmpi/repository/archive/v2.3.0-huawei.tar.gz
- 将源码包上传至服务器Hyper MPI源码包安装目录,如“/path/to/download/hmpi”。
- 执行以下命令,进入源码包安装目录。
- 执行以下命令,解压软件包。
- 执行以下命令,进入“autogen.pl”脚本所在目录。
- 执行以下命令,进行Hyper MPI源码包安装。
./autogen.pl
./configure --prefix=/path/to/install/hmpi --with-platform=contrib/platform/mellanox/optimized --enable-mpi1-compatibility --with-ucx=/path/to/install/hucx --with-ucg=/path/to/install/xucg CC=clang CXX=clang++ FC=flang
make
make install
- 若需要支持GPU Aware功能,且环境上已安装CUDA,则需要执行以下命令,指定--with-cuda参数:
./configure --prefix=/path/to/install/hmpi --with-platform=contrib/platform/mellanox/optimized --with-cuda=/path/to/install/cuda --enable-mpi1-compatibility --with-ucx=/path/to/install/hucx --with-ucg=/path/to/install/xucg CC=clang CXX=clang++ FC=flang
- /path/to/install/hmpi:表示Hyper MPI的安装路径。
- /path/to/install/cuda:表示CUDA的安装路径。
- /path/to/install/hucx:表示HUCX的安装路径。
- /path/to/install/xucg:表示XUCG的安装路径。
- 若需要支持GPU Aware功能,且环境上已安装CUDA,则需要执行以下命令,指定--with-cuda参数:
配置环境变量
- 使用PuTTY工具,以Hyper MPI普通用户(例如“hmpi_user”)登录至作业执行节点。
- 安装environment-modules工具。
- 执行以下命令,安装environment-modules。
表2 每种操作系统对应安装的操作步骤 操作系统
操作步骤
- CentOS Linux release 7.6 AArch64
- CentOS Linux release 8.2 AArch64
- Kylin Linux Advanced Server V10 SP2 AArch64
- 银河麒麟高级服务器操作系统V10(HPC版) AArch64(不支持OceanStor Pacific存储DPC客户端)
- 麒麟信安服务器操作系统V3.5.2 AArch64(不支持OceanStor Pacific存储DPC客户端)
- openEuler 20.03 LTS SP3 AArch64
- openEuler 22.03 LTS SP2 AArch64(不支持OceanStor Pacific存储DPC客户端)
yum install -y environment-modules
Ubuntu 18.04.5 LTS arm64
apt-get install -y environment-modules
- 执行以下命令,查看environment-modules是否安装成功。
若module命令不可用,请先执行以下命令,使module命令生效。
- CentOS Linux release 7.6 AArch64、CentOS Linux release 8.2 AArch64、Kylin Linux Advanced Server V10 SP2 AArch64、银河麒麟高级服务器操作系统V10(HPC版) AArch64(不支持OceanStor Pacific存储DPC客户端)、麒麟信安服务器操作系统V3.5.2 AArch64(不支持OceanStor Pacific存储DPC客户端)、openEuler 20.03 LTS SP3 AArch64、openEuler 22.03 LTS SP2 AArch64(不支持OceanStor Pacific存储DPC客户端)
- Ubuntu 18.04.5 LTS arm64
回显如下类似信息,说明environment-modules安装成功。
Modules Release 4.1.1 (2018-02-17)
- 执行以下命令,安装environment-modules。
- 执行以下命令,在environment-modules工具安装路径下创建并编辑“Hmpi_modulefiles”配置文件。
- 打开“Hmpi_modulefiles”配置文件。
vi /path/to/install/Hmpi_modulefiles
- 按“i”进入编辑模式,修改如下内容。
#%Module1.0 # HMPI module for use with 'environment-modules' package: conflict mpi prepend-path OPAL_PREFIX /path/to/install/hmpi/ prepend-path PATH /path/to/install/hmpi/bin:/path/to/install/hucx/bin:/path/to/install/xucg/bin prepend-path LD_LIBRARY_PATH /path/to/install/hmpi/lib:/path/to/install/hucx/lib:/path/to/install/xucg/lib prepend-path INCLUDE /path/to/install/hmpi/include:/path/to/install/hucx/include:/path/to/install/xucg/include
/path/to/install:表示environment-modules工具的安装路径。若用户不指定安装路径,则会安装在默认路径下,不同操作系统的默认路径如下。
- CentOS Linux release 7.6 AArch64、CentOS Linux release 8.2 AArch64、Kylin Linux Advanced Server V10 SP2 AArch64、银河麒麟高级服务器操作系统V10(HPC版) AArch64(不支持OceanStor Pacific存储DPC客户端)、麒麟信安服务器操作系统V3.5.2 AArch64(不支持OceanStor Pacific存储DPC客户端)、openEuler 20.03 LTS SP3 AArch64、openEuler 22.03 LTS SP2 AArch64(不支持OceanStor Pacific存储DPC客户端)的默认路径:/usr/share/Modules/modulefiles
- Ubuntu 18.04.5 LTS arm64的默认路径:/usr/share/modules/modulefiles
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
- 打开“Hmpi_modulefiles”配置文件。
- 执行以下命令,在工具安装路径下加载环境变量。
module load /path/to/install/Hmpi_modulefiles
- 执行以下命令,将Hyper MPI环境变量写到用户的“~/.bashrc”文件中。
- 打开“~/.bashrc”文件。
vi ~/.bashrc
- 按“i”进入编辑模式,添加如下内容。
module use /path/to/install module load /path/to/install/Hmpi_modulefiles
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
默认用户的“~/.bashrc”文件在共享目录中,若不在,请修改所有节点的“~/.bashrc”。
- 打开“~/.bashrc”文件。
- 执行以下命令,使配置生效。