LoginSignup
11
12

More than 5 years have passed since last update.

TensorFlowをTitan未満のGPUで使うには

Last updated at Posted at 2015-12-05

TensorFlowが対応しているGPU

TensorFlow は、公式には "NVidia Compute Capability" が3.5以上のGPUにのみ対応しています。つまり基本的にはTitan以上のGPUにしか対応していません。この事は https://www.tensorflow.org/get_started/os_setup.html#installation-for-linux の "Optional: Install CUDA (GPUs on Linux)" にて以下のように説明されています。

TensorFlow GPU support requires having a GPU card with NVidia Compute Capability >= 3.5. Supported cards include but are not limited to:

  • NVidia Titan
  • NVidia Titan X
  • NVidia K20
  • NVidia K40

したがって、例えば現在(12.7.2015)配布されているGPU向けのTensorFlowのバイナリを用いてインストールを行った場合、たとえばGTX 960などの対応外のGPUを用いるとエラーが発生してしまいます。

しかし、同ページの "Enabling Cuda 3.0" にて説明されている "unofficial settings" を用いることで、 "NVidia Compute Capability" が3.0のGPU向けにTensorFlowをインストールすることができます。

注意点

注意点として、 "unofficial" とあるだけに、互換性の無いライブラリが多くあり、大部分がテスト・サポートされていないようです。これは、インストール時(「手順」のステップ2)にて出る次のような注意で確認できます。

WARNING: You are configuring unofficial settings in TensorFlow. Because some
external libraries are not backward compatible, these settings are largely
untested and unsupported.

手順

実際にインストールするには以下の手順に従います。

公式サイト ( https://www.tensorflow.org/versions/master/get_started/os_setup.html )に従い以下の手順でソースからビルドします:

  1. "Installing from sources" の "Configure the installation" の手前までを実行
  2. "Enabling Cuda 3.0" に従って ./configure 時に「非公式設定」 ("unofficial settings") を有効にする
  3. "Create the pip package and install" に従ってpip wheelを作成し、TensorFlowをインストール
    • (この手順はpyenv, virtualenv等仮想環境にインストールしたい場合行う。システムのpythonにTensorFlowをインストールする場合、pip packageは作らず "Build your target with GPU support" の通りに従う。)

筆者は、この設定でGeforce GTX 960, Ubuntu 15.04 にて動作確認をしました。(動作確認は https://github.com/woodrush/neural-art-tf を実行して行いました。)

11
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
11
12