Chainrmn をTSUBAME2.5にインストール

これはなに?

分散型深層学習フレームワークchainermnがリリースされました。TSUBAMEで早速使うべくインストールバトルをしたのでその記録です

GCC野良ビルド

これは各自がんばってください(C++11が使えることが必須)

NCCL

makefile23-25行をコメントアウト

NVCC_GENCODE ?= -gencode=arch=compute_35,code=sm_35 \                             
                -gencode=arch=compute_50,code=sm_50 \                            
                -gencode=arch=compute_52,code=sm_52 \                             
                #-gencode=arch=compute_60,code=sm_60\                             
                #-gencode=arch=compute_61,code=sm_61 \                            
                #-gencode=arch=compute_60,code=compute_60
make CUDA_HOME=/usr/apps.sp3/cuda/7.5 test

MVAPICH

./configure --enable-cuda --prefix=PATH_TO_INSTALL
make -j4
make install
echo 'export MV2_USE_CUDA=1' >> ~/.bashrc

mpi4py

git clone https://github.com/mpi4py/mpi4py
cd mpi4py
python setup.py install

defaultのPYTHONPATHに、

/usr/apps.sp3/isv/amber/16_update01/i2013.1.046_ompi1.6.5_cuda7.5/amber16/lib/python2.7/site-packages

何故か入っていてここにpython2.7のmpi4pyが入っているため競合して死にますのでテキトーにこれを削除すること

chainermn

CC=~/where_to_gcc/bin/gcc-*.* CPATH=/usr/apps.sp3/cuda/7.5/include/:where_to_nccl/src/ LD_LIBRARY_PATH=$NCCL_ROOT/lib/:$LD_LIBRARY_PATH  python setup.py install

chainerの修正

TSUBAME上のGlibcが古いためadamの計算中に死にます

from math import pow
...

def lr(self):                                                                 
        fix1 = 1. - pow(self.hyperparam.beta1 , self.t)                           
        fix2 = 1. - pow(self.hyperparam.beta2 , self.t)                           
        return self.hyperparam.alpha * math.sqrt(fix2) / fix1

と変更

実行

(py35) ****@t2a006178:> python train_mnist.py --communicator naive -u 3
GPU: -1
# unit: 3
# Minibatch-size: 100
# epoch: 20
epoch       main/loss   validation/main/loss  main/accuracy  validation/main/accuracy  elapsed_time
1           1.66641     1.37389               0.386533       0.477                     2.28905       
2           1.29713     1.22861               0.505617       0.5274                    4.62439       
3           1.18703     1.1563                0.555467       0.5726                    6.97202       
4           1.12184     1.10202               0.586317       0.6042                    9.2815        
5           1.07451     1.06617               0.60965        0.6231                    11.5855       
6           1.03577     1.03241               0.626          0.6427                    13.8904       
7           1.00202     1.00216               0.64285        0.6502                    16.2714       
8           0.971201    0.972216              0.654417       0.6621                    18.5773       
9           0.944552    0.94554               0.663717       0.68                      20.8936       
10          0.923072    0.93476               0.67625        0.6806                    23.2178       
11          0.904248    0.909097              0.684383       0.6966                    27.4446       
12          0.887569    0.901461              0.695067       0.6992                    29.7539       
13          0.872541    0.879583              0.701683       0.7024                    32.0666       
14          0.860256    0.870163              0.707083       0.7094                    34.4527       
15          0.849695    0.868137              0.713617       0.7098                    36.7594       
16          0.840893    0.857363              0.716383       0.7179                    39.08         
17          0.831741    0.847023              0.720683       0.7158                    41.9922       
18          0.825027    0.837325              0.72385        0.7226                    44.3936       
19          0.818212    0.835769              0.727233       0.7271                    46.7902       
20          0.811998    0.828687              0.7304         0.73                      49.2771