0

I install tensorflow gpu on my machine. I install CUDA toolkit 9.0 and cuDNN 7.0 on my machine.

And when I go thru the steps from https://www.tensorflow.org/install/install_windows to test my installation. By entering the program

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()

But I get the following error "Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2" error.

Can you please tell me how can I fix it?

>>> sess = tf.Session()
2018-07-25 23:27:54.477511: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2018-07-25 23:27:55.607237: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1392] Found device 0 with properties:
name: Quadro M2000 major: 5 minor: 2 memoryClockRate(GHz): 1.1625
pciBusID: 0000:03:00.0
totalMemory: 4.00GiB freeMemory: 3.34GiB
2018-07-25 23:27:55.612178: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1471] Adding visible gpu devices: 0
2018-07-25 23:27:55.977046: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-07-25 23:27:55.980238: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:958]      0
2018-07-25 23:27:55.982308: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0:   N
2018-07-25 23:27:55.984488: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1084] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3069 MB memory) -> physical GPU (device: 0, name: Quadro M2000, pci bus id: 0000:03:00.0, compute capability: 5.2)
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
n179911
  • 19,547
  • 46
  • 120
  • 162

1 Answers1

3

I have also been wondering what this warning means. After making a quick tour, here is what i ve found: Adveance Vector Extensions are the instructions that extends integer operations to floating points numbers. Eg: FUSE MULTIPLY ADD.

citing from the above source "A fused multiply–add (sometimes known as FMA or fmadd) is a floating-point multiply–add operation performed in one step, with a single rounding. That is, where an unfused multiply–add would compute the product b×c, round it to N significant bits, add the result to a, and round back to N significant bits, a fused multiply–add would compute the entire expression a+b×c to its full precision before rounding the final result down to N significant bits."

if AVX is not enabled in your compiler, the operation a+bxc would be done sequential steps wheras avx instructions executes it into one operation unit.

It seems by default, the build flags of tensorflow, doesn't include the support for AVX instructions as the configuration section states in on install from source page.

To be able to suppress this warning, you have to build tensorflow from source and on the configuration part, use additional these additional flags

bazel build -c opt --copt=-mavx --copt=-mavx2

I suspect that these flags are omitted by default because not all cpus supports these instructions.

For more details, see this answer and this github issue.

EDIT

Here is an exaustive list of of build you can use depending on which warnings you are getting, including this one.

Eliethesaiyan
  • 2,327
  • 1
  • 22
  • 35
  • Thanks for the answer. How can I find out if my cpus supports these instructions. – n179911 Jul 26 '18 at 21:59
  • in windows probably with intel chips on, intel sde emulator might be the right tool,but probably probaly system info might also include such information on cpu section..sadly i don't use windows so there is no way i can confirm, for linux `cat /proc/cpuinfo | grep avx` will show you the type of avx installed ,how to use system info on windows 10 http://www.simplehow.tips/a/44/how-to-view-system-information-on-windows10 and for intel sde emulator https://software.intel.com/en-us/articles/intel-software-development-emulator – Eliethesaiyan Jul 27 '18 at 01:21
  • @Eliethesaiyan I had installed `bazel` using `Homebrew` and on running it, I got [this](https://drive.google.com/open?id=1rwd_COI55NYP5aGtiiCqjq21mAuqAUN_) , but it's still giving me the same warning. Also, how do I ensure that i've got rid of this problem? – asn Dec 31 '18 at 13:07