13

I ma trying to install tensorflow on Ubuntu and I am getting this message :

(base) k@k-1005:~/Documents/ClassificationTexte/src$ python tester.py 
Using TensorFlow backend.


RUN: 1
  1.1. Training the classifier...
LABELS: {'negative', 'neutral', 'positive'}
2019-12-10 11:58:13.428875: I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical operations:  SSE4.1 SSE4.2 AVX AVX2 FMA
To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags.
2019-12-10 11:58:13.432727: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3190585000 Hz
2019-12-10 11:58:13.433041: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5591c387b750 executing computations on platform Host. Devices:
2019-12-10 11:58:13.433098: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): Host, Default Version
2019-12-10 11:58:13.433182: I tensorflow/core/common_runtime/process_util.cc:115] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance.
Model: "model_1"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_1 (InputLayer)         (None, 8000)              0         
_________________________________________________________________
dense_1 (Dense)              (None, 3)                 24003     


But the script works and display the accuracy but this part above show before the runs. Do you have any idea , I install tensorflow on anaconda :

EMMAKENJI
  • 359
  • 2
  • 5
  • 14

2 Answers2

23

In case you are not interested seeing those errors use this before running your script

export TF_CPP_MIN_LOG_LEVEL=2

or

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

inside your script.

Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

Update: A little cleaner way inside your code: tf.get_logger().setLevel('ERROR')

y.selivonchyk
  • 8,987
  • 8
  • 54
  • 77
10

The above warning is thrown because TensorFlow library was originally compiled on different architecture machine and is not optimized for your particular architecture. Which means that it will continue to function, but you won't be getting max performance out of the library.

To get the max performance on your machine, you need to build TensorFlow on your machine.

Refer to the official documentation for the steps for building from source.

Official Docs: https://www.tensorflow.org/install/source

Rohit Lal
  • 2,791
  • 1
  • 20
  • 36
  • 1
    I have built my Tensorflow on the same machine and I still get this error. But I don't know how to find proper flags for my intel cpu to enable AVX2. I just can't find it anywhere, – Shilan Jun 11 '20 at 20:24
  • 1
    @Shilan in ./configure, when asked "Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]:" provide -mavx2 (and potentially others like -msse4.2 and -mfma) – Tyreal Jul 23 '20 at 14:10
  • @Tyreal So does that mean if I configure everything in configure file, I won’t need to flag them again when running train command? – Shilan Aug 02 '20 at 06:27
  • @Shilan Yes, that is correct. You only have the chance to add support for CPU instructions at build time. Once the package is created it will make use of the compiled flags, there is no option to enable support for specific instructions later on. – Tyreal Aug 03 '20 at 07:48