“您的CPU支持该TensorFlow二进制文件未编译为使用的指令:AVX2”错误

时间:2018-07-26 06:33:07

标签: tensorflow

我在机器上安装了tensorflow gpu。 我在计算机上安装了CUDA工具包9.0和cuDNN 7.0。

当我走上台阶时 从https://www.tensorflow.org/install/install_windows中测试我的安装。 通过输入程序

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

但是出现以下错误“您的CPU支持该TensorFlow二进制文件未编译为使用的指令:AVX2”错误。

您能告诉我如何解决吗?

>>> 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!'

1 个答案:

答案 0 :(得分:3)

我也一直在想这个警告是什么意思。快速浏览之后,这是我发现的内容: Adveance Vector Extensions 是将整数运算扩展为浮点数的指令。 例如:FUSE MULTIPLY ADD

引用上述来源 “融合的乘法加法(有时称为FMA或fmadd)是一步执行的浮点乘法加法运算,并且进行了一次舍入。  也就是说,在未融合的乘法加法计算乘积b×c的过程中,将其四舍五入为N个有效位,将结果加到a,然后再四舍五入为N个有效位,那么融合的乘法加法将计算整个表达式b×c达到最大精度,然后将最终结果四舍五入为N个有效位。”

如果未在编译器中启用AVX,则a + bxc操作将在avx指令将其执行为一个操作单元的情况下依次执行。

默认情况下,tensorflow的构建标志似乎不包括对AVX指令的支持,因为configuration section在从源页面进行安装时已声明。

要抑制此警告,您必须从source构建张量流,并在配置部分使用其他这些附加标志

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

我怀疑默认情况下会忽略这些标志,因为并非所有的cpus都支持这些指令。

有关更多详细信息,请参见此answer和此github issue

编辑

Here是构建的详细列表,您可以根据所收到的警告(包括该警告)来使用构建。

相关问题