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

问题描述 投票:35回答:3

我是第一次运行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.
python python-3.x tensorflow
3个回答
52
投票

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

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

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


15
投票

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

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

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

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


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.

© www.soinside.com 2019 - 2024. All rights reserved.