I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
问题:
安装TensorFlow(CPU版本),使用pip install tensorflow安装,安装一切顺利,但是在跑一个简单的程序时,遇到如下情况:
大概意思是:你的CPU支持AVX扩展,但是你安装的TensorFlow版本无法编译使用。
原因:
除了通常的算术和逻辑,现代CPU提供了许多低级指令,称为扩展,例如, SSE2,SSE4,AVX等来自维基百科:
高级矢量扩展(AVX)是英特尔在2008年3月提出的英特尔和AMD微处理器的x86指令集体系结构的扩展,英特尔首先通过Sandy Bridge处理器在2011年第一季度推出,随后由AMD推出Bulldozer处理器在2011年第三季度.AVX提供了新功能,新指令和新编码方案。
特别是,AVX引入了融合乘法累加(FMA)操作,加速了线性代数计算,即点积,矩阵乘法,卷积等。几乎所有机器学习训练都涉及大量这些操作,因此将会支持AVX和FMA的CPU(最高达300%)更快。该警告指出您的CPU确实支持AVX(hooray!)。
在此强调一下:
这只限于CPU。如果你有一个GPU,你不应该关心AVX的支持,因为大多数昂贵的操作将被分派到一个GPU设备上(除非明确地设置)。在这种情况下,您可以简单地忽略此警告。
那为什么会出现这种警告呢?
由于tensorflow默认分布是在没有CPU扩展的情况下构建的,例如SSE4.1,SSE4.2,AVX,AVX2,FMA等。默认版本(来自pip install tensorflow的版本)旨在与尽可能多的CPU兼容。另一个观点是,即使使用这些扩展名,CPU的速度也要比GPU慢很多,并且期望在GPU上执行中型和大型机器学习培训。
解决方法:
如果安装的是GPU版本
如果你有一个GPU,你不应该关心AVX的支持,因为大多数昂贵的操作将被分派到一个GPU设备上(除非明确地设置)。在这种情况下,您可以简单地忽略此警告:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
如果安装的是CPU版本(pip install tensorflow)
1.在代码中加入如下代码,忽略警告:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
2.编译TensorFlow源码
如果您没有GPU并且希望尽可能多地利用CPU,那么如果您的CPU支持AVX,AVX2和FMA,则应该从针对CPU优化的源构建tensorflow。在这个问题中已经讨论过这个问题,也是这个GitHub问题。 Tensorflow使用称为bazel的ad-hoc构建系统,构建它并不是那么简单,但肯定是可行的。在此之后,不仅警告消失,tensorflow性能也应该改善。
参考:
https://stackoverflow.com/questions/47068709/your-cpu-supports-instructions-that-this-tensorflow-binary-was-not-compiled-to-u?answertab=votes#tab-top
---------------------
作者:涛哥带你学编程
来源:CSDN
原文:https://blog.csdn.net/hq86937375/article/details/79696023
版权声明:本文为博主原创文章,转载请附上博文链接!
I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2的更多相关文章
- 2019-09-16 16:42:03.621946: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA Traceback (most recent cal
-- ::] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA ...
- 解决 warning I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
只需要加载如下代码: import os os.environ['
- I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 问题
临时解决版本进入python后只需下面命令 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
- I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
遇到了这个问题,意思是你的 CPU 支持AVX AVX2 (可以加速CPU计算),但你安装的 TensorFlow 版本不支持 解决:1. 如果是初学者 或者 没有太大计算速度的需求,在开头加上这两行 ...
- W tensorflow/core/platform/cpu_feature_guard.cc:45]
W tensorflow/core/platform/cpu_feature_guard.cc:] The TensorFlow library wasn't compiled to use SSE3 ...
- 解决tensorflow的"Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA Using TensorFlow backend."警告问题
问题描述 程序开始运行的时候报出警告:I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructio ...
- Tensorflow 运行警告提示 Your CPU supports instructions that this TensorFlow binary was not compiled to use
由于现在神经网络这个东西比较火,准确的说是深度学习这个东西比较火,我们实验室准备靠这个东西发几个CCF A类的文章,虽然我不太懂这东西,兴趣也一般都是毕竟要跟随主流的,于是今天安装起了 Tensorf ...
- Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
pycharm运行TensorFlow警告:Your CPU supports instructions that this TensorFlow binary was not compiled to ...
- 报错解决——Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
在导入tensorflow后,进行运算时,出现了报错Your CPU supports instructions that this TensorFlow binary was not compile ...
随机推荐
- python的开发环境配置-Eclipse-PyDev插件安装
安装PyDev插件的两种安装方法: 1.百度搜索PyDev 2.4.0.zip,下载后解压,得到Plugins和Feature文件夹,复制两文件夹到Eclipse目录,覆盖即可. 插件的版本要对应py ...
- linux 搜索文件
https://blog.csdn.net/json_ligege/article/details/72865645 1.find find是最常见和最强大的查找命令,你可以用它找到任何你想找的文 ...
- hdu4533 线段树维护分段函数
更新:x1,y1,x2,y2不用long long 会wa.. #include<iostream> #include<cstring> #include<cstdio& ...
- Mac上安装stf
一,安装 STF的依赖比较多,如下: Node.js >= 0.12ADB properly set upRethinkDB >= 2.2GraphicsMagick (for resiz ...
- DDD模型领域WF到领域层(十五)
实现超市的结算系统: 计算相应的优惠方式的接口 public interface ICompute { double GetResultTotalMoney(double TotalMoney); } ...
- sql分组获取第一条或者最小一条值
很多人都在问这个问题,现在记录一下 select id from test as a where id = (select min(b.id ) from test as b where a.pid ...
- 【算法】后缀自动机(SAM) 例题
算法介绍见:http://www.cnblogs.com/Sakits/p/8232402.html 广义SAM资料:https://www.cnblogs.com/phile/p/4511571.h ...
- linux shell cut 命令
cut命令 cut命令用于从文件或者标准输入中读取内容并截取每一行的特定部分并送到标准输出. 截取的方式有三种:一是按照字符位置,二是按照字节位置,三是使用一个分隔符将一行分割成多个field,并提取 ...
- UVA 11426 (欧拉函数&&递推)
题意:给你一个数N,求N以内和N的最大公约数的和 解题思路: 一开始直接想暴力做,4000000的数据量肯定超时.之后学习了一些新的操作. 题目中所要我们求的是N内gcd之和,设s[n]=s[n-1] ...
- jooq实践
用法 sql语句 SELECT AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, COUNT(*) FROM AUTHOR JOIN BOOK ON AUTHOR.ID = B ...