14

I just installed Tensorflow 1.0.0 using pip. When running, I get warnings like the one shown below.

W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.

I get 5 more similar warning for SSE4.1, SSE4.2, AVX, AVX2, FMA.

Despite these warnings the program seems to run fine.

Abhai Kollara
  • 665
  • 1
  • 7
  • 17
  • Have you tried doing what the warning says ? e.g.: compiling it to use sse3 instructions? – PinkFluffyUnicorn Feb 16 '17 at 10:30
  • 1
    Kind of a noob here, how do I do that ? – Abhai Kollara Feb 16 '17 at 11:12
  • 6
    The whole point of installing the software using pip is not to have to build it. I got the same error since I updated TF from r0.12 to r1.0 via pip. – Fanta Feb 17 '17 at 11:44
  • It would seem that the PIP build for the GPU is bad as well, as I get the warnings with the GPU version and the GPU installed.. It seems the Google people are being very aggressive about closing out questions even if wrong. It is quite clear that the Pip build should not generate theses errors..(the prior release did not.) Most if not ALL modern (last 4yrs CPU's have the instructions) – dartdog Mar 03 '17 at 20:27
  • 1
    I bit the bullet and built for my native CPU. Aside from the warnings going away, the performance increase was dramatic, training a small RNN: 339 seconds using pip install version. 187 seconds after building for my system. I've never built a package custom for my system before and I didn't find it difficult (just slightly time consuming). – Patrick Coady Apr 06 '17 at 00:22
  • It seems to me that The Google build team should build TF Pip packages for modern CPU's particularly (or at least for) for the GPU version, as the people using their GPU's are more than likely to have modern CPU's as well... That way the Pip install would just take care of it. Having to build from scratch is a pain.. but ultimately a solution (as Patrick Coady points out) – dartdog May 26 '17 at 17:42
  • I have compiled TF to support those instructions. In case you need those build, you can download them from https://github.com/lakshayg/tensorflow-build – lakshayg Jul 08 '17 at 03:50

7 Answers7

6

export TF_CPP_MIN_LOG_LEVEL=2 solved the problem for me on Ubuntu.

https://github.com/tensorflow/tensorflow/issues/7778

Ajay Singh
  • 1,251
  • 14
  • 17
5

My proposed way to solve the problem:

#!/usr/bin/env python3
import os
import tensorflow as tf
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

Should work at least on any Debian or Ubuntu systems.

jcamdr
  • 316
  • 3
  • 5
2

I don't know much about C, but I found this

bazel build --linkopt='-lrt' -c opt --copt=-mavx --copt=-msse4.2 --copt=-msse4.1 --copt=-msse3-k //tensorflow/tools/pip_package:build_pip_package

How you build you program?

Christian Frei
  • 471
  • 4
  • 18
1

It seems that even if you don't have a compatible (i.e. Nvidia) GPU, you can actually still install the precompiled package for tensorflow-gpu via pip install tensorflow-gpu. It looks like in addition to the GPU support it also supports (or at least doesn't complain about) the CPU instruction set extensions like SSE3, AVX, etc. The only downside I've observed is that the Python wheel is a fair bit larger: 90MB for tensorflow-gpu instead of 42MB for plain tensorflow.

On my machine without an Nvidia GPU I've confirmed that tensorflow-gpu 1.0 runs fine without displaying the cpu_feature_guard warnings.

0

It would seem that the PIP build for the GPU is bad as well as I get the warnings with the GPU version and the GPU installed...

dartdog
  • 10,432
  • 21
  • 72
  • 121
  • This DOES answer the question and I further updated it in a comment above,, The PIP installation should not be generating this error.. I guess I'll need to open it in GitHub The error seems to apply to both the GPU version and the CPU version,, as I have the GPU version with the latest processors both Intel coreI7 and Nvidia (1070) Someone is getting way over Aggressive about deleting useful info. – dartdog Mar 03 '17 at 20:35
0

Those are simply warnings. They are just informing you if you build TensorFlow from source it can be faster on your machine.

Those instructions are not enabled by default on the builds available I think to be compatible with more CPUs as possible.

123
  • 315
  • 1
  • 6
  • 10
0

As 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
Aashish Kumar
  • 2,771
  • 3
  • 28
  • 43