#! /usr/bin/perl

#
# Author: Sebastian Enger, M.Sc.
# Date: 3/13/2016
# Website: www.OneTIPP.com
# Email: Sebastian.Enger@gmail.com
# Topic: Install Host Image Requirements for Ubuntu in Docker Image 
# Based: https://blog.giantswarm.io/moving-docker-container-images-around/
# Version: 1.0.0
#https://www.quantstart.com/articles/Installing-Nvidia-cuda-on-Ubuntu-14-04-for-Linux-GPU-Computing
# https://github.com/NVIDIA/nvidia-docker/wiki/Installation

use strict;

my $cudnn_package = "https://cloud.onetipp.com/cudnn.tar.gz";

# apt-get 
system("apt-get update");
system("apt-get upgrade");
#system("apt-get dist-upgrade");
system("apt-get -o Dpkg::Options::='--force-confold' --force-yes -fuy dist-upgrade");

system("apt-get install -y build-essential");
system("apt-get install -y openssl libssl-dev");
system("apt-get install -y libopenblas-dev");

system("apt-get install -y nasm");
system("apt-get install -y g++ c++"); 
system("apt-get install -y cpp"); 
system("apt-get install -y curl");
system("apt-get install -y wget");
system("apt-get install -y joe");
system("apt-get install -y screen");

system("apt-get install -y python-setuptools python-dev");
system("apt-get install -y python-pip");
system("apt-get install -y perl");
system("pip install -U pip");

system("apt-get install -y bzip2 gzip pbzip2");

system("apt-get install -y cuda cuda-7-5 cuda-runtime-7-5");
system("apt-get install -y nvidia-cuda-toolkit");

#system("wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run");

# download nvidia cudnn package"
#system("wget -o /root/cudnn.tar.gz $cudnn_package");

It seems your PATH were not set up correctly when you installed Chainer.

First untar the cudnn-7.0-linux-x64-v4.0-rc.tgz archive file in the right directory (no need to copy), with:
$ sudo tar xvfz cudnn-7.0-linux-x64-v4.0-rc.tgz -C /usr/local

Set up your paths:
$ export CPATH=/usr/local/cuda/include:$CPATH
$ export LIBRARY_PATH=/usr/local/cuda/lib:$LIBRARY_PATH
$ export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH
(to have that persistent, do that in your .bashrc file and source it). Note that this is also needed for other frameworks.

Then install chainer with:
$ pip install --user chainer

And chainer will have cudnn support, you'll be able to have:
>>> import cupy.cudnn
>>>


11
down vote
accepted
If you use a newer version of Docker, you can use --cpuset="" in docker run to specify the CPU cores you want to allocate:

docker run --cpuset="0" [...]
If you use an older version of Docker (< 0.9), which uses LXC as the default execution environment, you can use --lxc-conf to configure the allocated CPU cores:

docker run --lxc-conf="lxc.cgroup.cpuset.cpus = 0" [...]
In both of those cases, only the first CPU core will be available to the docker container. Both of these options are documented here.

