2019年4月15日 更新

Azure で tensorflow-gpu ~tensorflow-gpu 導入編~

3,582 view お気に入り 0

はじめに


今回は,Azure で tensorflow-gpu ~仮想マシン作成編~ (https://lp-tech.net/articles/XjVg6) で作成した仮想マシンに tensorflow-gpu を導入する手順についての記事となります.

tensorflow-gpu をインストールの手順は,大きく4つの項目に分けられます.
・Anaconda をインストール (https://bit.ly/2O9zMsK)
・CUDA Toolkit 9.0 をインストール (https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html)
・cuDNN をインストール (https://developer.nvidia.com/cudnn)
・tensorflow-gpu をインストール (https://www.tensorflow.org/install/install_linux)

Anaconda をインストール


まず,下記のコマンドを実行して Anaconda をインストールしましょう.
$ wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh
$ sh Anaconda3-5.2.0-Linux-x86_64.sh

#---- 以下は実行結果です.

Please, press ENTER to continue
>>> ⏎

Do you accept the license terms? [yes|no]
[no] >>> yes

Anaconda3 will now be installed into this location:
/home/taiki/anaconda3
    - Press ENTER to confirm the location
    - Press CTRL-C to abort the installation
    - Or specify a different location below
[/home/taiki/anaconda3] >>> ⏎

Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /home/taiki/.bashrc ? [yes|no]
[no] >>> yes

Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]
>>> no
Install anaconda
.

CUDA Toolkit 9.0 をインストール


仮想マシンの GPU がCUDA に対応するかを確認するため,下記のコマンドを実行します.GPU が http://developer.nvidia.com/cuda-gpus のリストの中にあれば,仮想マシンのGPU は CUDA に対応しています.今回使用した仮想マシンの GPU は Tesla M60 でした.
$ lspci | grep -i nvidia

#---- 以下は実行結果です.

18e4:00:00.0 VGA compatible controller: NVIDIA Corporation GM204GL [Tesla M60] (rev a1) 
Verify You Have a CUDA-Capable GPU


CUDA Toolkit を利用する際に,gcc compiler が必要になります.なので,以下のコマンドを実行して gcc がインストールされているかを確認しましょう.今回は,インストールされていなかったようです.
$ gcc --version

#---- 以下は実行結果です.

Command 'gcc' not found, but can be installed with:
sudo apt install gcc
Verify the System Has gcc Installed


以下のコマンドを実行して gcc をインストールしましょう.
$ sudo apt install gcc
Install gcc


CUDA ドライバのインストール時に,kernel header と開発パッケージをインストールする必要があります.そこで,下記のコマンドを実行して,インストールを行いましょう.今回は,既に最新バージョンがインストールされていたようです.
33 件

関連する記事 こんな記事も人気です♪

Python × TensorFlow ② ~TensorFlow を扱う上で必要な知識「定数・変数」~

Python × TensorFlow ② ~TensorFlow を扱う上で必要な知識「定数・変数」~

TensorFlow を扱う上で必要な以下3つの知識のうち「定数と変数」について解説していきたいと思います.
井上 大輝 | 8,901 view
Azure + Tensorflow + Kerasで画像認識

Azure + Tensorflow + Kerasで画像認識

クラウドでGPUを使ったディープラーニングを実行するための環境構築法をまとめました。
山田涼太 | 5,606 view

この記事のキーワード

この記事のキュレーター

井上 大輝 井上 大輝