LoginSignup
8
8

More than 5 years have passed since last update.

Ubuntu 16.10 をインストールしてChainerを入れる

Last updated at Posted at 2017-01-23

新しいGTX 1080 搭載のデスクトップPCを買って、 Ubuntu 16.10 を入れて、Chainerをインストールしたのでメモです。
ちなみに、16.04 で無いのは、インストールしたPCのマザーボードのWiFiが、16.10でしか使えないためです。

ブータブルUSBドライブの作り方

ここではMacでのやり方です。
基本的に以下に従う。
https://www.ubuntu.com/download/desktop/create-a-usb-stick-on-macos

※ 2018/01/29更新:ツールをEtcherに変更

  1. Ubuntu をダウンロード https://www.ubuntu.com/download/desktop
  2. Etcher をダウンロードしてインストール https://etcher.io/
  3. USBドライブをさす
  4. Etcher を起動、ディスクイメージを選択し、先ほどダウンロードしたISOを選択
  5. ドライブでUSBドライブのものを選択
  6. OKをクリック
  7. 完了までかなり時間がかかるので待ちましょう(15分ほど)

以下、お好みで

$ sudo apt install screen ssh git
$ gsettings set org.gnome.Vino require-encryption false # mac の vnc からつながらないため

NVIDIAドライバのインストール

参考: http://qiita.com/IshitaTakeshi/items/3efce820986f4560765d
参考:公式ドキュメント https://developer.nvidia.com/compute/cuda/8.0/prod/docs/sidebar/CUDA_Installation_Guide_Linux-pdf

1. Nouveau kernel driver をdisableにする

  • /etc/modprobe.d/blacklist-nouveau.conf を作成
blacklist nouveau
options nouveau modeset=0
$ sudo update-initramfs -u
$ sudo reboot

2. ドライバインストール

以下から、ドライバをダウンロード。
http://www.nvidia.com/Download/index.aspx?lang=en-us
GTX1080 の場合は、以下のように設定して検索すれば良い。

スクリーンショット 2017-07-02 17.32.32.png

$ sudo service lightdm stop # x を止める
$ sudo ./NVIDIA-Linux-x86_64-375.26.run

CUDAをインストール

1. cuda のインストール時に、gcc 5.2 を求められるので、5系を入れる。(ただ、これは不要だったかも)

$ sudo apt install gcc-5 g++-5
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

参考: http://qiita.com/IshitaTakeshi/items/3efce820986f4560765d

2. https://developer.nvidia.com/cuda-toolkit から、runfile をダウンロード

3. bashrc にパスを追加

export CUDA_ROOT=/usr/local/cuda
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/lib
export CPATH=$CPATH:/usr/loca/cuda/include
export CUDA_INC_DIR=/usr/local/cuda/bin:$CUDA_INC_DIR

4. cudaをインストール

chmod +x cuda_8.0.27_linux-run
sudo sh ./cuda_8.0.27_linux-run --override

5. 以下のように選択。ドライバーは先ほど入れているのでここでは入れない。

accept/decline/quit: accept

You are attempting to install on an unsupported configuration. Do you wish to continue?
(y)es/(n)o [ default is no ]: y

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 367.48?
(y)es/(n)o/(q)uit: n  #<==== ここは no!

Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: y

Enter Toolkit Location
 [ default is /usr/local/cuda-8.0 ]:

Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y

Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: y

Enter CUDA Samples Location
 [ default is /home/XXXX ]

6. 再起動

$ sudo reboot

CuDDN

1. https://developer.nvidia.com/cudnn からバイナリをダウンロード

2. 解凍してコピー

tar xzf cudnn-8.0-linux-x64-v5.1.tgz
sudo cp -a cuda/lib64/* /usr/local/lib/
sudo cp -a cuda/include/* /usr/local/include/
sudo ldconfig

chainer インストール

$ sudo apt install git
$ sudo apt install python-pip python3-pip
$ sudo pip3 install chainer
8
8
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
8
8