labs.beatcraft.com
Deep Learning

Installing Chainer1.5

This article shows the points that you may be stumbled in the installation of Chainer1.5 over Chainer1.3 or 1.4.

Components

The components listed below have been used since Chainer1.3.0. As versions of Chainer are updated, these components have remained the same through Chainer1.4.2.
Hardware

▪GPU: Corei7 3770
▪Memory: 32GB
▪GPU1 (for display): NVIDIA GeForce GT730
▪GPU2 (for CUDA): NVIDIA Tesla K20c


Software

▪OS: Ubuntu 14.04.1 LTS
▪Python: 2.7
▪Cuda: 6.5

Installing

As Chainer1.5 is installed with sudo pip install –upgrade chainer, MemoryError and other troubles may occur and its installation process is failed. At Chainer1.5.1, these issues are solved. In this article, chainer is upgraded to version 1.5.1. As version 1.5.1 of Chainer is released, the installation guide is also published. The installation process shown below is article is based upon this installation guide. (In the following installation process, sudo is omitted.) If you need a reference, please visit the URL shown below.

Reference: Chainer Install Guide: http://docs.chainer.org/en/stable/install.html

1) Uninstall chainer-cuda-deps

Since Chainer1.4 starts using CuPy, this python module has not been required anymore. It is known that this module does NOT cause any issues, but for just incase, please remove this module.

pip uninstall chainer-cuda-deps
 

2) Upgrade pip

Without upgrading pip, the pip, which was previously used for uninstall chainer-cuda-deps, cannot find chainer. Please upgrade pip before proceeding to the next step.

pip install –upgrade pip

3) Uninstall chainer

Please apply the uninstalling process at least twice on chainer since there are several versions of chainer packages have been installed in the install folder.

pip uninstall chainer

4) install libhdf5

In Install Guide, this module is supposed to be install with gcc. However, in this working environment, the newest version of g++ has already been installed. Thus, install only libhdf5 here.

apt-get install llibhdf5-dev

5) Install chainer

Finally, install the newest version of chainer. Since the previous version of chainer is already removed, this will be the clean install. --upgrade is not required.

pip install chainer

Benchmarking

Since Chainer1.5.1 has been successfully installed, now, apply a simple benchmark. The benchmark measures the duration of how long it takes to examine the MNIST sample. To measure the duration of time, time -p command is used.
Please apply the command line below.

time -p python train_mnist.py -g 0


-g 0 is the option for using GPU.

real 65.34
user 61.02
sys 2.66

The outputs are shown above. The outputs of previous version (1.4.2) of Chainder are: real is about 88 seconds, and user is 85 seconds, approximately. Thus, the new version of Chainer roughly performs 20 seconds faster than the previous version.

Using cuDNN

Performing the benchmark shown above, a warring shows up on the screen, and it warns that cuDNN has not been effective. cuDNN is free library for Neural Network, provided by NVIDIA. Compering the increase in the speed of execution, cuDNN consumes less memory than it is expected.

cuDNN can be downloaded from NVIDIA's developer's site (https://developer.nvidia.com/cudnn). However, to download the library, the registration and authentication are required. To register to the site, you should answer a short questionnaire, which asks the language for the development and the purpose of use of this library. To answer these questions, the registration is completed, Please wait that NVIDIA sends an authentication e-mail. Once you have received the e-mail, you can download cuDNN from the site. The authentication process usually takes few hours. In some case it will takes few days. Please be patient.

To download cuDNN, please answer the similar questionnaire that you took for the registration. Then, please select one version of cuDNN library for the download. As of December 2015, cuDNN can be downloadable up to version 4. Chainer supports version 2 and version 3 of cuDNN. Since CUDA 6.5 is installed in this system, version 2 of cuDNN is selected. (If CUDA 7.0 is installed, please select version 3 of cuDNN. It is depending on your configuration.)

Since cuDNN does not include its installer, the folder of cuDNN simply contains its header files and libraries. The downloaded cuDNN is the version 2 for Linux x64, and the contents of the file are shown below.

$ tar zxvf cudnn-6.5-linux-x64-v2.tgz
cudnn-6.5-linux-x64-v2/
cudnn-6.5-linux-x64-v2/INSTALL.txt
cudnn-6.5-linux-x64-v2/CUDNN_License.pdf
cudnn-6.5-linux-x64-v2/cudnn.h
cudnn-6.5-linux-x64-v2/libcudnn_static.a
cudnn-6.5-linux-x64-v2/libcudnn.so.6.5
cudnn-6.5-linux-x64-v2/libcudnn.so.6.5.48
cudnn-6.5-linux-x64-v2/libcudnn.so

These files are copied to CUDA install folder. In this working environment, CUDA install folder is located at the directory of /usr/local/cuda. To copy the files to this folder, pleasae apply the command lines shown below.

cp cudnn.h /usr/local/cuda/include/
cp lib* /usr/local/cuda/lib64/

This is the end of installing cuDNN.

To make cuDNN effective with Chainer, the clean installation of Chainer is required. To follow the instructions of Intallation 3) and 5), Please remove Chainer first, then, install Chainer again.

pip uninstall chainer
pip install chainer

Now, the set up of Chainer1.5.1, includes cuDNN is completed. Retrying the benchmark above, no warring appears. The results of benchmark is shown below.

real 64.97
user 60.91
sys 2.65

Using cuDNN, there is a little improvement on the results. The improvement is considered within the measuring errors. If larger data set is applied to this benchmark, its outcome could have been far different than this one.

Revision History


Front page   New List of pages Search Recent changes   RSS of recent changes