2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OpenMPI v5.0.0をビルドする

Last updated at Posted at 2023-11-07

はじめに

メッセージ・パッシング・インターフェース(MPI)の実装の一つであるOpen MPIの新バージョン5.0.0が2023年10月26日にリリースされました。

[Open MPI Announce] Open MPI v5.0.0 available

Tomislav Janjusic via announce Thu, 26 Oct 2023 12:54:58 -0700

Dear Open MPI Users,

We are thrilled to announce that Open MPI v5.0.0 is now officially available at 
https://www.open-mpi.org/software/ompi/v5.0/ .
Please test and send feedback either via the user mailing lists or create an 
issue at https://github.com/open-mpi/ompi/issues/ .

We want to express our sincere gratitude to the many individuals whose 
contributions were instrumental in making this release possible.

Thank you,
v5.0 Release Managers
_______________________________________________
announce mailing list
announce@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/announce

cf. https://www.mail-archive.com/announce@lists.open-mpi.org/msg00162.html

本稿では、このOpen MPIバージョン5.0.0をソースコードからビルドし、実行バイナリをインストールするまでの一連の手順について説明します。

例としてGentoo Linuxでのインストール方法を記述しますが、他のディストリビューションでも同様にして(手動で)インストールすることができると思います。

環境

  • Gentoo Linux(kernel 6.1.57)
  • Portage 3.0.51
  • GCC 12.3.1

ビルド

準備

cf. Open MPI Documentation -- 4.7. Required support libraries

以下の依存関係パッケージをインストールします。

  • Libevent 2.0.22
  • hwloc 2.9.1
  • PMIx 4.2.7
  • PRRTE 3.0.2
% sudo emerge --ask dev-libs/libevent sys-apps/hwloc

PMIx 4.2.7とPRRTEはGentooの公式リポジトリには(現時点では)含まれていないのですが、手動でインストールするか、もしくは次のオーバーレイ1を利用してインストールすることができます。

ShinobuAmasaki/amasaki-overlay

オーバーレイを利用してインストールする場合の例を以下に示します。

まず、オーバーレイを使用するためにリポジトリを登録して同期します。

% sudo emerge --ask app-select/eselect-repository
% sudo eselect repository add amasaki-overlay git https://github.com/ShinobuAmasaki/amasaki-overlay.git
% sudo emerge --sync

次に、オーバーレイに含まれるパッケージをインストールします。

% sudo emerge --ask ">=sys-cluster/pmix-4.2.7" ">=sys-cluster/prrte-3.0.2"

また、ドキュメントをビルドする場合には、Sphinxが必要です。

% sudo emerge --ask dev-python/sphinx dev-python/sphinx-rtd-theme dev-python/recommonmark

Open MPIのビルド

ソースコードを公式サイトからダウンロードします。

% wget https://download.open-mpi.org/release/open-mpi/v5.0/openmpi-5.0.0.tar.bz2

アーカイブを解凍して展開し、そのディレクトリに入ります。

% tar jxvf openmpi-5.0.0.tar.bz2
% cd ./openmpi-5.0.0

./configureコマンドを実行します(これには長くて5分くらいかかります)。

% ./configure --prefix=/usr/local     \
	--disable-mpi-java                \
	--enable-mpi-fortran=all          \
	--enable-pretty-print-stacktrace  \
	--enable-prte-prefix-by-default   \
	--sysconfdir=/etc/openmpi         \
	--with-hwloc=/usr                 \
	--with-hwloc-libdir=/usr/lib64    \
	--with-libltdl=/usr               \
	--with-libltdl-libdir=/usr/lib64  \
	--with-libevent=/usr              \
	--with-libevent-libdir=/usr/lib64 \
	--enable-heterogeneous            \
	--with-prrte=/usr                 \
	--enable-binaries                 \
	--enable-ipv6                     \
	--enable-peruse                   \
	--enable-io-romio                 \
	--with-tm                         \
	--with-pbs                    

ここで、--with-prrte=/usrとしているのは、--with-prrte=internalではなぜか構成に失敗するためで、システムにインストールされたPRRTEを用いるように指示しています。

最後に以下のような出力を得ることができれば成功です。これでコンパイルの準備が整いました。

Open MPI configuration:
-----------------------
Version: 5.0.0
MPI Standard Version: 3.1
Build MPI C bindings: yes
Build MPI Fortran bindings: mpif.h, use mpi, use mpi_f08
Build MPI Java bindings (experimental): no
Build Open SHMEM support: yes
Debug build: no
Platform file: (none)
 
Miscellaneous
-----------------------
Atomics: GCC built-in style atomics
Fault Tolerance support: mpi
HTML docs and man pages: building and installing
hwloc: external
libevent: external
Open UCC: no
pmix: external
PRRTE: external
Threading Package: pthreads
 
Transports
-----------------------
Cisco usNIC: no
Cray uGNI (Gemini/Aries): no
Intel Omnipath (PSM2): no (not found)
Open UCX: yes
OpenFabrics OFI Libfabric: no (not found)
Portals4: no (not found)
Shared memory/copy in+copy out: yes
Shared memory/Linux CMA: yes
Shared memory/Linux KNEM: no
Shared memory/XPMEM: no
TCP: yes
 
Accelerators
-----------------------
CUDA support: no
ROCm support: no
 
OMPIO File Systems
-----------------------
DDN Infinite Memory Engine: no
Generic Unix FS: yes
IBM Spectrum Scale/GPFS: no (not found)
Lustre: no (not found)
PVFS2/OrangeFS: no

makeを実行します。-jオプションの値には自分のCPU数に合わせて適宜変更してください。ここではCPUのスレッド数に合わせて64とします。

% make -j64

一例として、Xeon E5-2683 v4の2CPUマシンではコンパイルに4分ほど掛かりました。

コンパイルが終了すれば、make installを実行できます。

% sudo make install

以上で、OpenMPIのインストールは完了です。

インストールされたか確認する

前のセクションで構成時に--prefix=/usr/localと指定したので、実行ファイル・ライブラリは/usr/local以下にインストールされます。

% type mpif90
mpif90 is /usr/local/bin/mpif90

% type mpiexec
mpiexec is /usr/local/bin/mpiexec

上のようにtypeコマンドでコンパイラとランナーが表示されれば無事インストールに成功したことを確認できます。

おわりに

Open MPIの新バージョンをソースコードからビルドして実行する方法について述べました。

バージョン4.1.7と5.0.0のconfigure --helpを比較して眺めてみると、多くのコンパイルオプションが変更されているのがわかります。しかし、元々のオプションの数が多すぎて、まずは実行バイナリを得るためにどれが必要なのかを探すことに苦労しました。本稿で紹介した構成オプションはほんの一例に過ぎないので、皆さんも自分のマシンに最適な選択肢を探してみてください。

なお、本記事と似たビルド構成のebuildファイルはShinobuAmasaki/amasaki-overlayから利用可能なので、オーバーレイを使用してemerge "=sys-cluster/openmpi-5.0.0"を実行すれば、同様の構成で簡単にインストールすることが可能です。

補遺

  1. PRRTEはOpen MPI v5.0.0から新たに依存関係として追加された。

    • これ無しでもOpen MPIのビルド自体はできるが、mpiexecmpirunの実行ファイルが生成されないので、当該ホストで実行したい場合には必須となる。
      • つまりクロスコンパイルするだけなら無くてもよい(はず)。
    • --with-prrte=internalはなぜか失敗する。
  2. ドキュメントにはPMIxのv4.2.0でビルド可能と書いてある

    • しかしPortageの公式リポジトリにあるv4.2.2-r1ではコンパイルに失敗した。
    • そのためv4.2.7を使用した。
  3. 構成オプションで--with-tm--with-pbsを有効にしているのは、ジョブスケジューラのOpenPBSを利用するため。

  1. Gentoo Linuxのサードパーティ・リポジトリのこと。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?