LoginSignup
4
3

More than 5 years have passed since last update.

共用環境向けのChainerMNのインストール

Last updated at Posted at 2017-05-29

共用環境でCUDAやOpenMPIが標準的なパスにインストールされていない場合のChainerMNのインストール手順.

ChainerMNのダウンロード

今回はCUDAやOpenMPIのインストールパスを指定するためソースからインストールする.

$ git clone https://github.com/pfnet/chainermn.git

ソースからインストールしなくて良い場合は以下のようにするとchainerやmpi4pyのインストールなどをよしなにやってくれる.

$ pip install chainermn

Chainerのインストール

CUDAが標準的なパス(/usr/local/cudaとか?)にインストールされていない場合,以下のようにする.

$ CUDA_PATH=/path/to/cuda pip install chainer

詳細は以下を参照.
http://docs.chainer.org/en/stable/install.html

mpi4pyのインストール

OpenMPIが標準的なパス(/usrとか?)にインストールされていない場合,以下のようにする.

$ env MPICC=/path/to/mpicc pip install mpi4py

詳細は以下を参照.
https://pythonhosted.org/mpi4py/usrman/install.html

ChainerMNのインストール

基本的には以下のようにすればよい.

python setup.py install

ただし,CUDA(やNCCL)やOpenMPIが標準的なパスにインストールされていないときはライブラリをみつけてくれないのでsetup.pyを以下のように編集する.(もっとナイスなやり方があるかも..)

<         include_dirs=['/path/to/cuda/include', '/path/to/openmpi/include'],
<         libraries=['nccl'],
<         library_dirs=['/path/to/cuda/lib', '/path/to/openmpi/lib'])
---
>         libraries=['nccl'])

簡単なテスト

$ mpiexec -n 4 python examples/mnist/train_mnist.py

4
3
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
4
3