LoginSignup
14
20

More than 3 years have passed since last update.

Ubuntu 20.04LTS + GPU に cuda, Anaconda, Tensorflow, Pytorch を入れる

Last updated at Posted at 2020-05-07

書くこと無いくらいに簡単に入りましたが、一応メモっときます。

手順

  1. Ubuntu 20.04LTS デスクトップをインストールする。
    https://jp.ubuntu.com/download
    インストール後の処理をして、ソフトウェアのアップデートが終わるのを待つ。

  2. Ubuntu デスクトップにログインして、左下のメニューを開くと、中に「ソフトウェアアップデート」というメニューがあるのでそれを開く。

  3. 開いたウィンドウの中に「追加のドライバ」というタブがある。GPU が認識されていれば「nvidiaのドライバを使う」という項目がいくつかあって、バージョンが選べる。適切なバージョン (GTX/RTX 系なら 440 で良いはず) を選んで「変更を適用」を押す。これで、待っていればインストールされる。

  4. ターミナルを開いて、下記コマンドを打つ。これで cuda が入る。

$ sudo apt update
$ sudo apt install nvidia-cuda-toolkit

2020/05/07 時点では cuda 10.1 が入る。違うバージョンを入れることもできる(みたい)。

  1. Anaconda をダウンロードする。 https://www.anaconda.com/

Get Start -> Install Anaconda Individual Edition -> Download -> Linux Python 3.7 64-Bit (x86) Installer を選んでダウンロード。

  1. ダウンロードしたフォルダで下記コマンドを実行 (ファイル名はバージョンによって微妙にかわってるかもしれない)
$ bash Anaconda3-2020.02-Linux-x86_64.sh

必要に応じて conda create -n tf などする。

  1. tensorflow-gpu をインストール
$ conda install tensorflow-gpu
  1. pytorch をインストールする。
$ conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

これで、GTX 2080, RTX 2080, GTX1660 あたりでは問題なく動きました。あとで、もうちょっと加筆します。

14
20
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
14
20