「MPI」の版間の差分
細 (→参考ページ) |
(→ソースからのインストール) |
||
行64: | 行64: | ||
==== ソースからのインストール ==== | ==== ソースからのインストール ==== | ||
− | OpenMPI プロジェクトのサイトから openmpi-1. | + | OpenMPI プロジェクトのサイトから openmpi-1.8.3.tar.bz2 をダウンロードしたのち、 |
以下のようなオプションを configure に渡せばいい。 | 以下のようなオプションを configure に渡せばいい。 | ||
2つのパラメーター、F77 (fortran 77) と FC (fortran 90/95) に | 2つのパラメーター、F77 (fortran 77) と FC (fortran 90/95) に | ||
行80: | 行80: | ||
Developer Tools の gcc(デフォルト)を C コンパイラとして使う場合は、 | Developer Tools の gcc(デフォルト)を C コンパイラとして使う場合は、 | ||
コンパイラオプション '''CFLAGS=-m64 CXXFLAGS=-m64''' を追加する必要がある。 | コンパイラオプション '''CFLAGS=-m64 CXXFLAGS=-m64''' を追加する必要がある。 | ||
+ | (I am not sure whether the "-m64" option is necessary in 2014) | ||
$ ./configure --prefix=/opt/openmpi64i F77=/opt/intel/Compiler/11.1/067/bin/intel64/ifort \ | $ ./configure --prefix=/opt/openmpi64i F77=/opt/intel/Compiler/11.1/067/bin/intel64/ifort \ | ||
行88: | 行89: | ||
Intel Composer の場合 | Intel Composer の場合 | ||
− | $ ./configure --prefix=/opt/openmpi64i F77=/opt/intel/bin/ifort FC=/opt/intel/bin/ifort CFLAGS=-m64 CXXFLAGS=-m64 | + | $ . /opt/intel/bin/ifortvars.sh intel64 |
+ | $ ./configure --prefix=/opt/openmpi64i F77=/usr/bin/ifort FC=/usr/bin/ifort | ||
+ | <!-- $ ./configure --prefix=/opt/openmpi64i F77=/opt/intel/bin/ifort FC=/opt/intel/bin/ifort CFLAGS=-m64 CXXFLAGS=-m64 --> | ||
$ make | $ make | ||
$ sudo make install | $ sudo make install |
2014年11月30日 (日) 19:31時点における版
目次
MPI とは?
Message Passing Interface の略で、並列・分散プロセス間のメッセージング機能を提供する標準規格。 あるいは、その実装を差す。1995年に MPI フォーラムによって標準化されて以来、多くの実装が存在していて、 コードの移植性に優れているのが特徴。言語に依存せず、C でも Fortran でも利用できる。
プログラム内に MPI 用のヘッダをインクルードして、 UNIX の fork プログラミングの要領で MPI 関数を追加していくだけで、 手軽に並列プログラムを作ることができる。
- MPI Forum - http://www.mpi-forum.org/
実装
多くのフリーの MPI 実装が開発されてきたが、 現在は Open MPI と MPICH2 の2つに集約されていると考えてよいだろう。 OSX 10.5 Leopard には、C言語専用の Open MPI が デフォルトでインストールされている(後述)。
LAM/MPI
daemon を介して、メッセージングを行う実装らしい。 現在はメンテナンスモードとなっていて、 開発者は後述の OpenMPI プロジェクトに合流しているそうだ。
MacPorts には、以下の Port が用意されている。
lammpi science/lammpi 7.1.2 MPI implementation for parallel computing
MPICH
広く使われている MPI 実装で、rsh/ssh 越しに通信を行うもの。 最近は、mpich2 が主流。
インストール手順
- ソースを展開して、手動で configure, make, make install を行う。
- MacPorts には、以下の Ports が用意されている。
mpich science/mpich 1.2.7 Message Passing Interface (MPI) Library mpich2 science/mpich2 1.0.3 Message Passing Interface (MPI) Library
Open MPI
FT-MPI, LA-MPI, LAM/MPI, PACX-MPI などの さまざまな先行プロジェクトの成果をもとに 開発されている MPI 実装。
OSX 10.5 Leopard にはデフォルトで Open MPI がインストールされている。 ただし fortran サポートはオフになっており、mpif77 などは機能しない。 Fortran から MPI を使う場合は、ソースからビルドするか、MacPorts などのパッケージシステムを使う必要がある。
MacPorts
以下の Port が用意されている。
openmpi science/openmpi 1.3.1 A High Performance Message Passing Library
ソースからのインストール
OpenMPI プロジェクトのサイトから openmpi-1.8.3.tar.bz2 をダウンロードしたのち、 以下のようなオプションを configure に渡せばいい。 2つのパラメーター、F77 (fortran 77) と FC (fortran 90/95) に コンパイラのパスを直に渡せば良い。
32bit コンパイラ:
$ ./configure --prefix=/opt/openmpi32 F77=/opt/intel/Compiler/11.1/067/bin/ia32/ifort \ FC=/opt/intel/Compiler/11.1/067/bin/ia32/ifort $ make $ sudo make install
64bit コンパイラ:
Developer Tools の gcc(デフォルト)を C コンパイラとして使う場合は、 コンパイラオプション CFLAGS=-m64 CXXFLAGS=-m64 を追加する必要がある。 (I am not sure whether the "-m64" option is necessary in 2014)
$ ./configure --prefix=/opt/openmpi64i F77=/opt/intel/Compiler/11.1/067/bin/intel64/ifort \ FC=/opt/intel/Compiler/11.1/067/bin/intel64/ifort CFLAGS=-m64 CXXFLAGS=-m64 $ make $ sudo make install
Intel Composer の場合
$ . /opt/intel/bin/ifortvars.sh intel64 $ ./configure --prefix=/opt/openmpi64i F77=/usr/bin/ifort FC=/usr/bin/ifort $ make $ sudo make install
64bit gfortran は以下のオプションで動作した。
$ ./configure --prefix=/opt/openmpi64g CFLAGS=-m64 CXXFLAGS=-m64 FCFLAGS=-m64 FFLAGS=-m64 $ make $ sudo make install
参考書籍
- 「並列プログラミング入門 MPI版」
- http://accc.riken.jp/HPC/training/text.html
- 元 IBM の青山さんによる、理研の講習会のテキスト。
- MPI並列プログラミング(ISBN:456301544X)
- http://www.alde.co.jp/mpi/ - 邦訳書籍
- Parallel Programming with MPI - 原書のサポートサイト。ソースコードもあり。
- 実践MPI‐2—メッセージパッシング・インタフェースの上級者向け機能 (ISBN:4894714442)
- High Performance Linux Clusters: With Oscar, Rocks, openMosix, And MPI (ISBN:0596005709)