鲲鹏社区首页
中文
注册
如何软件编译安装HMPI

如何软件编译安装HMPI

HPC

发表于 2023/04/26

0

本章节的实操过程需要使用鲲鹏平台环境,开发者可以使用自备的鲲鹏平台进行学习。

环境部署

为保证Hyper MPI能够正常工作,请检查您的安装环境,确保安装环境达到推荐配置要求。

Hyper MPI环境要求:

项目

类别

子项

版本要求

服务器

鲲鹏服务器(基于鲲鹏920处理器)

操作系统

CentOS Linux release 7.6 aarch64
CentOS Linux release 8.2 aarch64
Kylin Linux Advanced Server V10 SP2 aarch64
Ubuntu18.04.5(ARM)

服务器

x86服务器

操作系统

CentOS Linux release 7.6 x86_64

软件

编译器

GCC

GCC 9.3.0

软件

编译器

毕昇编译器

毕昇编译器2.3.0

软件

工具

Libtool

Libtool 2.4.2

驱动

网卡驱动

Mellanox OFED驱动

Mellanox OFED 4.9-0.1.7.0
Mellanox OFED 5.0-2.1.8.0
说明:
鲲鹏服务器(基于鲲鹏920处理器)和x86服务器支持Mellanox OFED 4.9-0.1.7.0、Mellanox OFED 5.0-2.1.8.0驱动。
Mellanox OFED 4.9-0.1.7.0、Mellanox OFED 5.0-2.1.8.0适配以下版本OS:
• CentOS Linux release 7.6 aarch64
• CentOS Linux release 7.6 x86_64
• Ubuntu18.04.5(ARM)

驱动

网卡驱动

Mellanox OFED驱动

Mellanox OFED 5.4-1.0.3.0
说明:
鲲鹏服务器(基于鲲鹏920处理器)支持Mellanox OFED 5.4-1.0.3.0驱动。
Mellanox OFED 5.4-1.0.3.0适配版本OS:
• Kylin Linux Advanced Server V10 SP2 aarch64
• CentOS Linux release 8.2 aarch64

编译HMPI

1. 安装依赖软件

编译安装HMPI之前需要先完成以下依赖包的安装,如果依赖存在,可跳过此步骤,编译HMPI软件包,如需安装请通过镜像源或者源码编译安装等方式进行安装。

(1)perl-Data-Dumper

(2)autoconf

(3)automake

(4) libtool 2.4.2

(5)GCC编译器9.3.0/毕昇编译器2.3.0

安装GCC编译器9.3.0版本/毕昇编译器2.3.0版本前,需按如下顺序安装依赖:gmp-6.2.0.tar.bz2、mpfr-4.0.2.tar.bz2、mpc-1.1.0.tar.gz、isl-0.18.tar.bz2。

(1)numactl

(2)binutils

(3)systemd-devel

(4)valgrind

2. 编译HMPI软件包

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

(1)HUCX编译

a. 使用PuTTY工具,以Hyper MPI安装维护用户,如“hmpi_master”登录作业执行节点;

b. 下载HUCX源码包“hucx-1.2.1-huawei.tar.gz”;

下载地址:https://gitee.com/kunpengcompute/hucx/archive/refs/tags/v1.2.1-huawei.tar.gz

c. 下载XUCG源码包“xucg-1.2.1-huawei.tar.gz”;

下载地址:https://gitee.com/kunpengcompute/xucg/archive/refs/tags/v1.2.1-huawei.tar.gz

d. 将上述两个源码包上传至服务器HUCX源码包安装目录,如“/path/to/download/hucx”;

e. 执行以下命令,解压上述两个源码包;

tar -zxvf hucx-1.2.1-huawei.tar.gz
tar -zxvf xucg-1.2.1-huawei.tar.gz

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

cd /path/to/download/hucx

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

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

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

cd hucx-1.2.1-huawei/

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

./autogen.sh
./contrib/configure-opt --prefix=/path/to/install/hucx

如果使用毕昇编译器需要执行以下命令,然后再make:

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

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

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

“/path/to/install/hucx”表示HUCX的安装路径。

(2)Hyper MPI编译

使用PuTTY工具,以Hyper MPI安装维护用户,如“hmpi_master”登录作业执行节点。

下载Hyper MPI源码包“hmpi-1.2.1-huawei.tar.gz”。

下载地址: https://gitee.com/kunpengcompute/hmpi/archive/refs/tags/v1.2.1-huawei.tar.gz

将源码包上传至服务器Hyper MPI源码包安装目录,如“/path/to/download/hmpi”。

执行以下命令,进入源码包安装目录。

cd /path/to/download/hmpi

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

tar -zxvf hmpi-1.2.1-huawei.tar.gz

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

cd hmpi-1.2.1-huawei/

执行以下命令,进行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

如果是毕昇编译器,需要在./configure时添加以下执行编译工具的参数:

CC=clang CXX=clang++ FC=flang
make
make install

“/path/to/install/hmpi”表示Hyper MPI的安装路径。

“/path/to/install/hucx”表示HUCX的安装路径。

3. 配置环境变量

使用MPI的用户,需要配置环境变量,可通过environment-modules工具方式配置环境变量。

(1)使用PuTTY工具,以Hyper MPI普通用户,如“hmpi_user”登录作业执行节点

(2)执行以下命令,安装environment-modules工具

yum install -y environment-modules

(3)执行以下命令,在environment-modules工具安装路径下创建并编辑“Hmpi_modulefiles”配置文件

a. 打开“Hmpi_modulefiles”配置文件

vi /path/to/install/Hmpi_modulefiles

b. 按“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
prepend-path  LD_LIBRARY_PATH /path/to/install/hmpi/lib:/path/to/install/hucx/lib
prepend-path  INCLUDE /path/to/install/hmpi/include:/path/to/install/hucx/include

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

c. 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑

(4)执行以下命令,在工具安装路径下加载环境变量

module use /path/to/install
module load /path/to/install/Hmpi_modulefiles

(5)执行以下命令,将Hyper MPI环境变量写到用户的“~/.bashrc”文件中

a. 打开“~/.bashrc”文件

vi ~/.bashrc

b. 按“i”进入编辑模式,添加如下内容:

module use /path/to/installmodule load /path/to/install/Hmpi_modulefiles

c. 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑

(6)执行以下命令,使配置生效

source ~/.bashrc

4.安装后检查

执行以下命令,进行安装后检查。

which mpirun

若返回如下安装路径示例,则证明安装成功。

/path/to/install/hmpi/bin/mpirun

本页内容