LoginSignup
9
12

More than 5 years have passed since last update.

GeForce RTX 20 シリーズを載せたUbuntu 16.04にCUDA 9.2をインストール

Last updated at Posted at 2018-11-28

はじめに

2018年11月現在、PyTorchが正式にCUDA 10.0に対応していないため、CUDA 9.2をUbuntu 16.04にインストールする。このときに、NVIDIA GeForce RTX 20シリーズを載せていると問題が起きたため、解決方法を記載。

症状

NVIDIA GeForce RTX 20シリーズではDriver 410以降が必要。しかし、Driver 410をインストールしたあとに、CUDA 9.2をインストールすると強制的にDriver 396に下げられる。Driver 396ではGeForce RTX 20シリーズに対応していないため、ログインループに陥ってしまう。

環境

  • Ubuntu 16.04.5 LTS (Xenial Xerus)
  • NVIDIA GeForce RTX 2070
  • Bash 4.3.48

解決手順

大まかな流れ

  1. Driverをインストールせずに、CUDA 9.2をインストール

  2. CUDAと同時に自動的にインストールされたDriverを削除

  3. PPAからDriver 410をインストール

詳細な手順

1. はじめはNVIDIA Driverはインストールしない。

もし、インストールしている場合は以下のようにして、削除する。

terminal
$ sudo apt --purge remove nvidia-*  # Driverの削除
$ sudo apt --purge remove cuda-*  # CUDAの削除
$ sudo apt autoremove  # 不要になったファイルの削除

また、ログインループに陥っているときはctrl + alt + F1でCUIでログインしてから、上記のコマンドを実行する。
ctrl + alt + F7でGUIに戻れる。

2. CUDA 9.2をダウンロード

CUDA 9.2を下記サイトからダウンロード
https://developer.nvidia.com/cuda-92-download-archive
このとき、Installer Typeは「deb(local)」を選択。

3. CUDA 9.2をインストール

(例)

terminal
$ cd ~/Downloads
$ sudo dpkg -i cuda-repo-ubuntu1604-9-2-local_9.2.148-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub
$ sudo apt update
$ sudo apt install cuda

4. CUDAインストールと同時に自動的にインストールされたDriverを削除

terminal
$ dpkg -l | grep nvidia-*  # これでインストール済みのパッケージが表示される。
$ sudo apt --purge remove nvidia-*  # Driverの削除
$ dpkg -l | grep nvidia-*  # これで何も表示されなければ削除成功

5. CUDAのパスを設定

.bashrcなどに以下を追記

.bashrcなどに追記
# CUDA
export PATH=/usr/local/cuda-9.2/bin:${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64:${LD_LIBRARY_PATH}

6. PPAの追加

terminal
$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt update

7. Driver 410のインストール

terminal
$ sudo apt install nvidia-410

8. 再起動

terminal
$ reboot
9
12
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
9
12