LoginSignup
0
0

More than 3 years have passed since last update.

超簡単 tensorflow gpu 環境構築

Last updated at Posted at 2020-04-03

tensorflow のGPU対応で、トラブルが発生している方も多いと思います。私も、その一人です。

例えば、tensorflow の公式サイトには、以下のように手順が示されていますが、GPU サポート、おいそれとはちゃんと動きません。以下、超簡単な手順です。ここでは、ubuntu 18.04 をクリーンインストールした場合を示します。

ubuntuをインストールした後、ドライバを自動でインストールします。

$ sudo ubuntu-drivers autoinstall`

再起動します。

$ sudo reboot

nvidia-smi で、GPUの同左確認をします。

$ nvidia-smi

Thu Oct 18 08:51:42 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.77 Driver Version: 390.77 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 108... Off | 00000000:01:00.0 On | N/A |
| 0% 57C P0 60W / 280W | 449MiB / 11178MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1055 G /usr/lib/xorg/Xorg 264MiB |
| 0 1250 G /usr/bin/gnome-shell 102MiB |
| 0 1762 G ...uest-channel-token=13825578612558098011 80MiB |
+-----------------------------------------------------------------------------+

pipをインストールします。

$sudo apt update
$sudo apt install python3-dev python3-pip

anacondaをインストールします。

anaconda最新版を、https://www.anaconda.com/download/#linux から、ダウンロードします。

ダウンロードしたフォルダに移動して、実行します。ファイル名は、ダウンロードしたものにしてください。

$bash Anaconda3-5.3.0-Linux-x86_64.sh

anaconda 仮想環境を作成します。

conda create -n myenv pip jupyterpython=3.7 

作成した環境に移動して、

conda activate myenv

ここがポイントです。
anaconda チャネルからインストールするだけ!様々なパッケージもインストールしてくれます。

conda install -c anaconda tensorflow-gpu

以上

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