从源代码构建的 Tensorflow 重新训练速度不快?
Tensorflow build from source not faster for retraining?
2015 年初,我在我可爱的 MBP 上 运行 Tensorflow,仅 CPU。
我决定使用 Bazel 构建一个 Tensorflow 版本以加快速度:SSE4.1、SSE4.2、AVX、AVX2 和 FMA。
bazel build --copt=-march=native //tensorflow/tools/pip_package:build_pip_package
但是使用新安装重新训练 Inception v3 模型并没有更快,它使用的时间完全相同。
这很奇怪,因为在使用训练有素的初始模型进行推理时,我的速度提高了 12%。训练 MNIST 示例的速度提高了 30%。
那么有没有可能我们在进行再训练时没有获得任何速度优势?
我也像 here 解释的那样为固定器构建了 Bazel,结果相同。
我的./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
谢谢,
格特
MNIST 示例大部分时间都在矩阵乘积内。
另一方面,典型的 CNN 大部分时间都在卷积中。
TF 在 CPU 上对其矩阵乘积使用 Eigen,据我所知,这是非常优化的,这也是您看到明显加速的原因。
如果我的信息是最新的,CPU 上的卷积并未优化。他们浪费时间复制数据,所以可以用矩阵乘法来处理。所以,当后者加速时,影响较小。
2015 年初,我在我可爱的 MBP 上 运行 Tensorflow,仅 CPU。 我决定使用 Bazel 构建一个 Tensorflow 版本以加快速度:SSE4.1、SSE4.2、AVX、AVX2 和 FMA。
bazel build --copt=-march=native //tensorflow/tools/pip_package:build_pip_package
但是使用新安装重新训练 Inception v3 模型并没有更快,它使用的时间完全相同。 这很奇怪,因为在使用训练有素的初始模型进行推理时,我的速度提高了 12%。训练 MNIST 示例的速度提高了 30%。
那么有没有可能我们在进行再训练时没有获得任何速度优势?
我也像 here 解释的那样为固定器构建了 Bazel,结果相同。
我的./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
谢谢,
格特
MNIST 示例大部分时间都在矩阵乘积内。
另一方面,典型的 CNN 大部分时间都在卷积中。
TF 在 CPU 上对其矩阵乘积使用 Eigen,据我所知,这是非常优化的,这也是您看到明显加速的原因。
如果我的信息是最新的,CPU 上的卷积并未优化。他们浪费时间复制数据,所以可以用矩阵乘法来处理。所以,当后者加速时,影响较小。