tensorflow 1.1.0を試してみた

tensorflow 1.1.0を試してみた

tensorflowに触れる機会があったので、ソースからのビルドを試してみた

参考にしたページ: http://blog.amedama.jp/entry/2017/03/08/223308
このページの手法ほぼそのままです

環境

  • MacBookPro 13inch 2015モデル
  • tensorflow 1.1.0
  • python 3.6.1(brewで導入)

1.1.0リリースノートで気になったこと

  • TensorFlow 1.1.0 will be the last time we release a binary with Mac GPU support. Going forward, we will stop testing on Mac GPU systems. We continue to welcome patches that maintain Mac GPU support, and we will try to keep the Mac GPU build working.

MacGPUサポートしたバイナリ出すのこれが最期だって。

ビルド時にやったこと(参考ページとの差分)

https://github.com/tensorflow/tensorflow/releases
から1.1.0のtar.gzをダウンロード

configure

  • 1.1.0ではconfig=optで追加するオプションをconfigureで聞いてきます
    デフォルトのmarch=nativeでいいはず
    XLA just-in-time compiler も有効化してみる

XLAはexperimental扱いです ビルドは30分ほどで完了

計測

march=native+XLA版

$ time python3 mnist_cnn.py
real 23m23.336s
user 63m39.019s
sys 13m32.681s

pipで入るバイナリ

$ time python3 mnist_cnn.py
real 34m48.798s
user 110m22.508s
sys 11m11.853s

結論

一回しか測ってないので正確ではありませんが、処理時間が2/3ほどになりました
CPUでいろいろ試す場合は自分でビルドする価値はあるかもです

おまけ:デスクトップで試してみた

$ time python3 mnist_cnn.py
real 2m21.907s
user 1m57.300s
sys 0m13.444s

1万円ちょいで買える安GPUでも10倍速かったです