7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ubuntu18.04にCUDA9.0をインストールする

Posted at

このドキュメントの内容

  • Ubuntu 18.04にCUDA9.0をインストールする手順のメモ.

前提

  • OS: Ubuntu 18.04
  • GPU: GeForce GTX 1080

手順

nvidia-driverのインストール

$sudo apt install nvidia-driver-390

CUDA9.0のインストール

  • nvidiaの公式サイトからdebファイルをダウンロードします。
  • 以下のurlにアクセスして環境を選んでいくとdebファイルのダウンロードリンクが表示されます。
  • https://developer.nvidia.com/cuda-90-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=debnetwork
  • ubuntu 18.04 向けのリンクしかないですが、代わりに ubuntu 16.04向けを選んでおけば大丈夫な模様。
  • 以下のように、表示されたurlからwgetしても動作します。
$wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb

先程のURLにインストールコマンドが書いてあるので実行する。
ただし、sudo apt-get install cudaするとCUDA10.1がインストールされるので、cuda-9-0を指定してインストールする。

$sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
$sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
$sudo apt-get update
$sudo apt-get install cuda-toolkit-9-0

再起動して動作確認

$sudo reboot
$nvidia-smi

PATHの設定

bashrcに以下を追記し, source ~/.bashrc.

export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"

動作確認

$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176

以上.

7
4
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
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?