Open MPI 4.0 编译安装

电脑上目前使用的mpi环境是2.1.1版本的openmpi,是我之前直接使用系统的包管理工具安装的。但是系统包版本一般都比较老旧,现在openmpi最新版已经出到了4.0,即将出4.1了,所以我打算升级一下系统里的mpi环境。

本地环境:

  • Corei7 9700k
  • Ubuntu18.04 LTS
  • gcc 7.5.0
  • GNU make 4.1
  • cmake 3.10.2

参考了 @xuyaowen 的安装教程,这里我安装的是最新的4.0.4版本。

直接上最终脚本:

curl -O -L https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.4.tar.gz
tar xvzf openmpi-4.0.4.tar.gz

cd openmpi-4.0.4

# --prefix 用于配置自身环境中安装的位置
./configure --prefix=/usr/local --with-orte

# 8核CPU并行编译
make -j 8 all
make -j 8 install

注意!脚本需要以root权限运行,以安装mpi到系统路径。
安装完成之后可以使用 mpirun --version 来检查是否安装成功。

按照参考教程安装的过程中遇到了一个问题,在网上没有搜到很满意的解决方案,最终自己尝试解决了这个问题。

我在本机 Ubuntu18.04 LTS 安装完成之后,运行时报错,提示缺少运行库:
mpirun: error while loading shared libraries: libopen-rte.so.40: cannot open shared object file: No such file or directory

查阅README发现第 1972 行有这么一段话:

The following pkg-config(1) configuration files *may* be installed,
depending on which command line options were specified to Open MPI's
configure script. They are not necessary for MPI applications, but
may be used by applications that use Open MPI's lower layer support
libraries.

orte: Open MPI Run-Time Environment applications
opal: Open Portable Access Layer applications

根据报错提示,在./configure的时候加入 --with-orte 选项修复了这个问题。

posted @ 2020-08-04 23:22  与MPI做斗争  阅读(3592)  评论(0编辑  收藏  举报