转自 涛哥带你学编程

安装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

警告:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA相关推荐

  1. 去除警告:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

    去除警告:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 文章 ...

  2. 警告:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA(亲测)

    警告:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 转载:h ...

  3. 彻底解决“Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA”警告

    问题描述 在使用TensorFlow时,总是提醒"Your CPU supports instructions that this TensorFlow binary was not com ...

  4. tensorflow:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2

    ps:这跳出的是一个cpu警告,但我用的是gpu啊!!即使我安装合适版本的(编译过的)tensorflow来满足我cpu的AVX2扩展,也还是没对我的运行速度有太大提高(猜测),所以如果你是使用gpu ...

  5. Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2问题解决

    tensorflow运行遇到的问题: Your CPU supports instructions that this TensorFlow binary was not compiled to us ...

  6. Tensorflow警告:our CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2

    使用TensorFlow模块时,弹出错误Your CPU supports instructions that this TensorFlow binary was not compiled to u ...

  7. 报错:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2

    1.问题 写了一个简单的单层神经网络跑mnist手写数字集,结果每次fit都会出现dead kernel 很多dead kernel首先不要急着去网上搜dead kernel怎么解决,因为大家出现的原 ...

  8. 成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

    成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 目录 ...

  9. 成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2(二)

    成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2(二) ...

最新文章

  1. TCP/IP详解--第八章
  2. 为AD用户启用或禁用OCS 2007 R2帐户
  3. ImportError: No module named protobuf
  4. C++描述杭电OJ 2014. 青年歌手大奖赛_评委会打分 ||
  5. h5 nan_h5页面在不同ios设备上的问题总结
  6. 力扣 O(1) 时间插入、删除和获取随机元素 - 允许重复
  7. 分分钟写出Vue原理
  8. APP安全防护基本方法(混淆/签名验证/反调试)
  9. 搭建sendmail邮件服务器
  10. 美国网站服务器有哪些,可以搭建什么网站?
  11. 根本原因分析(RCA)
  12. FreeXGIS系列产品介绍
  13. Cadence 17.4将状态栏由黑底白字改为白底黑字
  14. 优秀的产品经理需要具备哪些能力?
  15. android动态请求权限
  16. ABAQUS学习(2):Abaqus求解好后导出点坐标/位移/应变
  17. 天邑ty1208z海思3798刷版本_天邑TY1208Z海思3798芯片强刷安卓系统固件rom刷机包下载...
  18. python安装dlib(已成功并且无出现报错AttributeError: module ‘dlib‘ has no attribute ‘get_frontal_face_detecetor
  19. 美术加艺考美术班:速写怎么练习效率最高?
  20. 关于计算机毕业后能从事的岗位,以及工作内容。

热门文章

  1. iphone13是双卡双待吗 苹果13支持5g网络吗
  2. 苹果手机双卡双待是哪一款_手机双卡双待信号有区别吗手机主卡、副卡这些区别,早知道为好!...
  3. vue封装一个弹幕组件
  4. 云服务器地域和可用区介绍
  5. WEB阶段7:综合练习-联系人管理系统-增删改查查询分页
  6. S5P6818裸机开发(2)-S5P6818 Boot Header解析
  7. 百亿富翁 (单调栈)
  8. splash下拉滚动条位置
  9. 【项目】健康项目day5总结
  10. python二维数组随机取行,组成新的数组