2017-05-27 99 views
2

2015年初,我一直在我可愛的MBP上運行Tensorflow,僅限CPU。 我決定與Bazel一起構建一個Tensorflow版本,以加快速度:SSE4.1,SSE4.2,AVX,AVX2和FMA。Tensorflow從源代碼建立不再更快的再培訓?

bazel build --copt=-march=native //tensorflow/tools/pip_package:build_pip_package 

但是,使用新安裝再培訓Inception v3模型不會更快,它使用完全相同的時間量。 這很奇怪,因爲在訓練的啓動模型中進行推理時,速度提高了12%。培訓MNIST的例子要快30%。

那麼我們是否有可能在再培訓中獲得任何速度優勢?

我也做了一個巴澤爾建立一個像解釋here,同樣的結果。

我的./configure:

Please specify the location of python. [Default is /Users/Gert/Envs/t4/bin/python]: Users/Gert/Envs/t4/bin/python3 
Invalid python path. Users/Gert/Envs/t4/bin/python3 cannot be found 
Please specify the location of python. [Default is /Users/Gert/Envs/t4/bin/python]: ls 
Invalid python path. ls cannot be found 
Please specify the location of python. [Default is /Users/Gert/Envs/t4/bin/python]: lslss 
Invalid python path. lslss cannot be found 
Please specify the location of python. [Default is /Users/Gert/Envs/t4/bin/python]: /rt/Envs/t4/bin/python3^C 
(t4) Gerts-MacBook-Pro:tensorflow root# 
(t4) Gerts-MacBook-Pro:tensorflow root# ./configure 
Please specify the location of python. [Default is /Users/Gert/Envs/t4/bin/python]: /Users/Gert/Envs/t4/bin/python3 
Please specify optimization flags to use during compilation [Default is -march=native]: 
Do you wish to use jemalloc as the malloc implementation? (Linux only) [Y/n] n 
jemalloc disabled on Linux 
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] n 
No Google Cloud Platform support will be enabled for TensorFlow 
Do you wish to build TensorFlow with Hadoop File System support? [y/N] n 
No Hadoop File System support will be enabled for TensorFlow 
Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N] n 
No XLA JIT support will be enabled for TensorFlow 
Found possible Python library paths: 
    /Users/Gert/Envs/t4/lib/python3.4/site-packages 
Please input the desired Python library path to use. Default is [/Users/Gert/Envs/t4/lib/python3.4/site-packages] 

Using python library path: /Users/Gert/Envs/t4/lib/python3.4/site-packages 
Do you wish to build TensorFlow with OpenCL support? [y/N] n 
No OpenCL support will be enabled for TensorFlow 
Do you wish to build TensorFlow with CUDA support? [y/N] n 
No CUDA support will be enabled for TensorFlow 
Configuration finished 

感謝,

格特

+0

完全連接MNIST或conv? – MaxB

+0

這一個:https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/mnist/mnist_softmax.py – GMath

回答

4

的MNIST例如花費大量的時間矩陣產品內部。另一方面,典型的CNN在卷積中花費大部分時間。據我所知,TF使用Eigen作爲CPU上的矩陣產品,這是非常優化的,以及你看到明顯加速的原因。

如果我的信息是最新的,那麼CPU上的卷積並不是最優化的。他們浪費時間複製數據,所以可以通過矩陣乘法來處理。所以,後者加速時影響不大。