源码安装Hyper MPI
前提条件
确保环境上已安装gcc 7.4/9.3。
编译环境变量检查
- 请执行以下命令,检查gcc 7.4/9.3是否安装,回显信息显示如下表示gcc 7.4已安装。
gcc -v
gcc version 7.4.0(GCC);
软件包编译
Hyper MPI包含ompi和ucx两个软件层,其中ompi的安装依赖于ucx,编译时应先编译ucx。
- ucx编译
- 从github上获取ucx源码:git clone https://github.com/kunpengcompute/hucx.git。
- 进入主目录。
cd /where/to/download/ucx
/where/to/download/ucx:代表ucx源码包下载后的存放路径。
- 利用autotool工具进行安装。
./autogen.sh
./contrib/configure-opt --prefix=/where/to/install/ucx
make -j32
make -j32 install
make后面-j参数是并行编译参数,指的是有多少CPU核心参与编译过程,需用户根据实际CPU核数进行指定。
- ompi编译
- 从github上获取ompi源码:git clone https://github.com/kunpengcompute/hmpi.git。
- 进入主目录。
cd /where/to/download/ompi
/where/to/download/ompi:代表ompi源码包下载后的存放路径。
- 利用autotool工具进行ompi安装。
./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
配置环境变量
与二进制包安装一样,源码安装也需要对环境变量进行配置。配置环境变量主要是将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
当涉及到多节点使用MPI时,应将上述环境变量写到用户的~/.bashrc文件中。