4

I have the following code:

import tensorflow as tf

print("Hello")

And the output is:

This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Hello # This is printed about 5 seconds after the message

I had looked into the meaning of the message in this thread and in this one, but failed to make it disappear (and to run any program in less than 5 seconds). Any help would be greatly appreciated.

Noah Carter
  • 87
  • 1
  • 2
  • 7

1 Answers1

6

The message is just telling you that certain optimizations are on for you by default and if you want even more optimizations you can recompile TF to get even more performant optimizations.

By default they compile using AVX2 which isn’t the fastest AVX, but it is the most compatible.

If you don’t need to enable those (which you probably don’t) then you can just ignore the informational message knowing that you are getting some optimizations for your runs utilizing the oneDNN CPU optimizations.

TonyM
  • 366
  • 1
  • 4
  • Thanks for your useful answer (among no others). I got the same message and I recently installed my setup with a Nvidia GPU. Does this message indicate that Tensorflow might not be doing its best with my GPU by using this CPU instructions? – Maurício Collaça Jan 17 '23 at 19:06
  • 1
    You should likely be good to go with GPU usage. When a GPU is requested it should use that flow if available. When it’s doing cpu based tasks it will just be using the AVX2 instructions. Mostly it’s just a heads up type warning, not particular to your code path or usage of the tool. If you want, you can general see GPU utilization in windows task manager or using nvidia-smi on Linux (for nvidia GPUs obviously :)) – TonyM Jan 18 '23 at 20:38