TensorFlow未编译为使用SSE(等)指令,但这些指令可用

时间:2017-03-31 07:18:23

标签: python python-3.x tensorflow

我第一次运行TensorFlow并使用一些示例代码。运行我的代码时出现此错误。有谁知道为什么会这样,以及如何解决它?谢谢!

2017-03-31 02:12:59.346109: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.
2017-03-31 02:12:59.346968: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.
2017-03-31 02:12:59.346975: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow libbrary wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
2017-03-31 02:12:59.346979: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-03-31 02:12:59.346983: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-03-31 02:12:59.346987: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-03-31 02:12:59.346991: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-03-31 02:12:59.346995: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.

3 个答案:

答案 0 :(得分:52)

这些是警告,而不是错误(由冒号后的W表示。错误在那里有E

警告指的是您的CPU支持SSE Instructions这一事实,它允许一些快速的硬件并行操作。启用这些操作是一个编译时操作(即使用SSE,您需要从源代码构建库,启用您正在定位的特定SSE版本),在这种情况下,您可能take a look at this question

但请注意,SSE支持仅影响计算速度。 Tensorflow可以使用或不使用SSE,但运行代码可能需要更长时间。 另请注意,这仅影响CPU。如果你正在使用Tensorflow的GPU版本,那么在GPU上运行的所有操作都不会受益于SSE指令。

答案 1 :(得分:15)

要隐藏这些警告,您可以在实际代码之前执行此操作。

import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf

有关详细讨论,请参阅此处https://github.com/tensorflow/tensorflow/issues/7778

我希望,它可以帮助对方。 :)

答案 2 :(得分:3)

这不是一个错误,只是警告说如果你从源代码构建TensorFlow,它可以在你的机器上更快。

就像警告说的那样,如果你需要加快TF的速度,你应该只用这些标志编译TF。

您可以使用TF环境变量TF_CPP_MIN_LOG_LEVEL,它的工作原理如下:

  • 默认为0,显示所有日志
  • 要过滤掉INFO日志,请将其设置为1
  • WARNINGS另外,2
  • 并另外过滤掉ERROR日志,将其设置为3

因此,您可以执行以下操作来消除警告:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf

有关详情,请参阅How to compile tensorflow using SSE4.1, SSE4.2, and AVX.