TensorFlow关于 SSE AVX的Warning问题

来源:互联网 发布:包月无限流量软件 编辑:程序博客网 时间:2024/06/06 07:02

从谷歌下载TensorFlow使用,在测试使用过程中,每次运行代码,都会输出一大堆的warning信息(见本文的最后部分),其大致意思是:本机CPU架构支持SSE、AVX等加速指令,而当前使用的TensorFlow库并没有充分利用这些指令集,如果能够使用开启了这些指令集的TensorFlow版本,则可以提高TensorFlow的执行效率。
就目前而言,查阅了谷歌的相关文档,提供的TensorFlow库还相对单一,没哟开启这么多指令集支持,其主要考虑的是让这些release版本的TensorFlow库可以安装在更多的计算机中使用,因为有很多老架构的cpu并不支持高级的指令集,比如AVX。
因此,如果想充分利用SSE和AVX来加速TensorFlow的CPU版本的运算,需要自己编译TensorFlow的源码。
另外,在StackOverflow中也找到了网友提供的用于暂时屏蔽这些warning输出的办法,如下:

import osos.environ['TF_CPP_MIN_LOG_LEVEL']='2'import tensorflow as tf

——————————-TensorFlow输出的关于CPU指令集SSE、AVX的warning信息————————————-

2017-08-01 17:14:18.620000: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.2017-08-01 17:14:18.620138: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.2017-08-01 17:14:18.620223: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.2017-08-01 17:14:18.620243: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.2017-08-01 17:14:18.620259: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.[array([ 14.], dtype=float32)]
阅读全文
0 0