37

I am running TensorFlow for the first time using some example code. I got the following warnings when running my code. Does anybody know why this happened, and how to fix it?

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.
C. Peck
  • 3,641
  • 3
  • 19
  • 36
Jsleshem
  • 715
  • 1
  • 10
  • 31
  • the w is short for warning...how are you running it...? – Eliethesaiyan Mar 31 '17 at 08:28
  • 10
    would it kill TF to distribute 2 different versions? (its just matter of a build settings for them, now I should install (and learn) 800% overhead to recompile from source). – Boppity Bop Jun 04 '17 at 15:52
  • 3
    I have compiled TF with those instructions. You can download the binaries from https://github.com/lakshayg/tensorflow-build – lakshayg Jul 10 '17 at 03:25
  • 1
    Possible duplicate of [How to compile Tensorflow with SSE4.2 and AVX instructions?](https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions) – Peter Cordes Sep 03 '17 at 00:00
  • This answer has useful related info: https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions – calycolor Oct 27 '17 at 19:52
  • Please check this [answer](https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions/46426188#46426188). It may help. – Sreeragh A R Nov 16 '17 at 03:59

3 Answers3

54

Those are warnings (as indicated by the W after the colon. Errors have an E there).

The warnings refer to the fact that your CPU supports SSE Instructions, which allow some fast in-hardware-parallel operations. Enabling these operations is a compile-time operation (i.e. to use SSE you need to build the library from the source enabling the specific SSE version you're targeting), in which case you might take a look at this question.

Note, however, that SSE support influences only the computation speed. Tensorflow will work with or without SSE, but it might take longer for your code to run. Note, also, that this influences only the CPU. If you're using the GPU build of Tensorflow, all the operations run on the GPU will not benefit of SSE instructions.

GPhilo
  • 18,519
  • 9
  • 63
  • 89
15

To hide those warnings, you could do this before your actual code.

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

for detailed discussion, please refer here https://github.com/tensorflow/tensorflow/issues/7778

I hope, it can be a help for the other. :)

nanangarsyad
  • 690
  • 14
  • 23
  • Sorry I am coming from an old question, but can you explain specifically what this does? Thanks! (I want to understand it before I upvote it) – Jsleshem Aug 16 '17 at 19:16
  • 2
    basically it was setting up the environment variable on your system using python instead on manually set it. e.g. on cmd (if you're windows user) by doing this `set TF_CPP_MIN_LOG_LEVEL=2` will do. The point is, if you wanted to hide the warning you could do that. **here's more detailed explanation about that env variable: ** TF_CPP_MIN_LOG_LEVEL is a TensorFlow environment variable responsible for the logs, to silence INFO logs set it to 1, to filter out WARNING 2 and to additionally silence ERROR logs (not recommended) set it to 3. Hope it can be a help for you :) – nanangarsyad Aug 17 '17 at 00:39
  • Thanks, that makes a lot more sense! – Jsleshem Aug 17 '17 at 13:58
  • Wouldn't his silence *all* warnings though? That's quite some overkilling to hide just one warning int the output. Also, how does the environment variable relate to `tf.logging.set_logging_level()`? does the function override the variable or is it the other way around? – GPhilo Aug 28 '17 at 09:28
3

This isn't an error, just warnings saying if you build TensorFlow from the source it can be faster on your machine.

And just like the warnings say, you should only compile TF with these flags if you need to make TF faster.

You can use TF environment variable TF_CPP_MIN_LOG_LEVEL and it works as follows:

  • It defaults to 0, displaying all logs
  • To filter out INFO logs set it to 1
  • WARNINGS additionally, 2
  • and to additionally filter out ERROR logs set it to 3

So you can do the following to silence the warnings:

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

For more detail discussion you see How to compile tensorflow using SSE4.1, SSE4.2, and AVX.

Aashish Kumar
  • 2,771
  • 3
  • 28
  • 43