LoginSignup
4
3

More than 5 years have passed since last update.

Deep Learning 用 Workstation 構築記録 その3(OS / ドライバ / CUDA&cuDNN インストール)

Last updated at Posted at 2017-05-31

その2で水路設計を公開する予定でしたが、先にその3として Fedora 25 で GeForce GTX 1080 Ti を利用する手順を公開します。
その2は近日公開予定。

BIOS(UEFI)設定

nVidia Display Driver をインストールする際に、Secure Bootが有効になっているとMicrosoftが署名したドライバしかインストールできなくなる為、SecuerBootの設定を変更します。
[UEFI] -> [Advanced Mode] -> [Boot] -> [Secure Boot]

OS Type

Default: Windows UEFI mode
Change: Other OS

OS のインストール

今回、環境を Docker で運用する為、OS は Fedora 25 Workstation を選択しました。
ダウンロードはこちら
上記 UEFI の設定さえ変えておけば、インストールには何も困りません。
ええ、インストールは。
なお、以下は特に断りがない限り、全て root ユーザで実行しています。

エラー対応

Data Link Layer Error

LiveCD の起動中から常に以下のエラーが発生します。

PCIe Bus Error severity=Corrected type=Data Link Layer id=0008

対応方法

カーネルオプションに以下を追加します。
pci=noaer

sed -i -e '/GRUB_CMDLINE_LINUX/s/"*$/ pci=noaer"/g' /etc/default/grub
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

これは、エラーでコンソールが埋め尽くされてしまう為のエラー出力抑止であり、暫定対応になります。

SCHED Error

カーネルアップデートを行うと、nouveau(nVidia製VGAのコミュニティ版ドライバー)が SCHED_ERROR を吐いて最終的にはフリーズしてしまう。

対応方法

カーネルオプションに以下を追加します。
nouveau.modeset=0

sed -i -e '/GRUB_CMDLINE_LINUX/s/"*$/ nouveau\.modeset=0"/g' /etc/default/grub
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

これにより、コミュニティ版のドライバー(nouveau)のモードセッティング(Kernel Mode Setting)を無効化します。

基本設定

SELinux 無効化
vi /etc/selinux/config
SELINUX=disabled
su nopassword
vi /etc/pam.d/su
auth        sufficient  pam_wheel.so trust use_uid
auth        required    pam_wheel.so use_uid
エラー対応

上記「エラー対応」を実施し、再起動します。

shutdown -r now
OS Update
dnf -y update
shutdown -r now

nVidia Video Driver インストール

グラフィックボードの確認
lspci |grep -E "VGA"

05:00.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1)
06:00.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1)
09:00.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1)
0a:00.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1)

きちんと4発分の GeForce GTX 1080 Ti が認識されている事を確認します。

前提パッケージのインストール
dnf -y install kernel-devel kernel-headers gcc dkms acpid

( kernel-devel, gcc は既にインストール済み)

LINUX X64 (AMD64/EM64T) DISPLAY DRIVER のダウンロード

ここから、システムに必要なドライバをダウンロードします。
これ以降は NVIDIA-Linux-x86_64-381.22.run を元に記事を記載します。適宜読み替えてください。

chmod +x NVIDIA-Linux-x86_64-381.22.run
nouveau の無効化
echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
sed -i -e '/GRUB_CMDLINE_LINUX/s/"*$/ rd.driver\.blacklist=nouveau"/g'
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
dnf remove xorg-x11-drv-nouveau
initramfs の再作成
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
dracut /boot/initramfs-$(uname -r).img $(uname -r)
Runlevel 3 (multi-user.target) に切り替え
systemctl set-default multi-user.target
shutdown -r now

nVidia 純正ドライバーのインストール
./NVIDIA-Linux-x86_64-381.22.run
既存ドライバーのアンインストール確認(再インストールの場合)

There appears to already be a driver installed on your system (version: 381.22). As part of installing this driver (version: 381.22), the existing driver will be uninstalled. Are you sure you want to continue?

-> Yes
DKMS 利用の確認

Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later.

-> Yes
libglvnd 上書きの確認

An incomplete installation of libglvnd was found. Do you want to install a full copy of libglvnd? This will overwrite any existing libglvnd libraries.

-> Install and overwrite existing files
X 設定上書きの確認

Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X? Any pre-existing X configuration file will be backed up.

-> Yes
インストール完了

Your X configuration file has been successfully updated. Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 381.22) is now complete.

Runlevel 5 (graphical.target) ヘ戻す
systemctl set-default graphical.target
reboot

CUDA のインストール

ダウンロード

ここからダウンロードします。

プラットフォームの選択

スクリーンショット 2017-05-31 21.41.35.png

リポジトリのダウンロード

スクリーンショット 2017-05-31 21.44.19.png

インストール

リポジトリのインストール
rpm -ivh cuda-repo-fedora23-8.0.61-1.x86_64.rpm
CUDA インストール
dnf clean all
dnf -y install cuda
cat << 'EOS_' >> /etc/profile

# Add cuda for all user
PATH=$PATH:/usr/local/cuda/bin
export PATH
EOS_
shutdown -r now
CUDA インストール確認
nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61

cuDNN インストール

ダウンロード

ここからダウンロードします。
( nVidia で Developers Account を作成する必要がありますので、先ずは作成しましょう)

スクリーンショット 2017-05-31 22.06.38.png
CUDA 8.0 版を選択します。

スクリーンショット 2017-05-31 22.09.09.png
cuDNN v6.0 Library for Linux をクリックしてダウンロードします。

インストール

tar zxvf cudnn-8.0-linux-x64-v6.0-tgz
mv cuda/include/* /usr/local/cuda/include/.
mv cuda/lib64/* /usr/local/cuda/lib64/.
ldconfig

これで、OS のインストール、ドライバのインストール、CUDA のインストールの全てが終わりました。

(追記)nVidia Video Driver 再インストール

再起動後、Xorgが起動しないという問題が発生しました。
その場合はドライバの再インストールを実行して再起動してください。

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