OpenMPIをGitHubからインストールする手順(for winBash, Ubuntu)
OpenMPIの最新版をインストールしたい。 tarなんちゃらをwgetするんじゃなくってGitHubからソースを引っ張ってきてインストールしたい。
環境は以下の通り。
環境 : Bash on Ubuntu on Windows
要はUbuntuと変わらない。
https://github.com/open-mpi/ompi
インストールの詳細はルートディレクトリにあるファイルINSTALLに記述されている。
以下は、簡単なインストール手順。
git clone https://github.com/open-mpi/ompi
# ソースのダウンロードcd ompi
#ディレクトリ移動 1../autogen.pl
# configure生成./configure --prefix=$HOME/usr
# Makefile生成make all install
# インストール
サンプルを使って実行できるか試してみよう。
cd exsample
mpicc ring_c.c
# コンパイルmpirun -np 4 ./a.out
# 実行
mpirun -np 4 ./a.out Process 0 sending 10 to 1, tag 201 (4 processes in ring) Process 0 sent to 1 Process 0 decremented value: 9 Process 0 decremented value: 8 Process 0 decremented value: 7 Process 0 decremented value: 6 Process 0 decremented value: 5 Process 0 decremented value: 4 Process 0 decremented value: 3 Process 0 decremented value: 2 Process 0 decremented value: 1 Process 0 decremented value: 0 Process 0 exiting Process 2 exiting Process 3 exiting Process 1 exiting
わーい!やったー!すごーい! このプログラムは『send a trivial message around in a ring 』するんだって! すごーい! ちなみにhello_cはエラーが出てコンパイルできなかったよ!なんでー? oshmem_*のコンパイルにはshmem.hが必要なんだってー!すごーい!
ちなみにMPIのバージョンは1.6.5。
バージョン確認にはompi_info
を使うよ。