TensorFlow CPU环境 SSE/AVX/FMA 指令集编译
TensorFlow CPU环境 SSE/AVX/FMA 指令集编译
sess.run()出现如下Warning
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.
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.
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.
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.
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.
# 通过pip install tensorflow 来安装tf在 sess.run() 的时候可能会出现
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.
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.
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.
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.
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.
这说明你的machine支持这些指令集但是TensorFlow在编译的时候并没有加入这些指令集,需要手动编译才能够介入这些指令集。
# 1. 下载最新的 TensorFlow
$ git clone https://github.com/tensorflow/tensorflow # 2. 安装 bazel
# mac os
$ brew install bazel # ubuntu
$ sudo apt-get update && sudo apt-get install bazel # Windows
$ choco install bazel # 3. Install TensorFlow Python dependencies
# 如果使用的是Anaconda这部可以跳过 # mac os
$ pip install six numpy wheel
$ brew install coreutils # 安装coreutils for cuda
$ sudo xcode-select -s /Applications/Xcode.app # set build tools # ubuntu
sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel
sudo apt-get install libcupti-dev # 4. 开始编译TensorFlow # 4.1 configure
$ cd tensorflow # cd to the top-level directory created
# configure 的时候要选择一些东西是否支持,这里建议都选N,不然后面会包错,如果支持显卡,就在cuda的时候选择y
$ ./configure # configure # 4.2 bazel build
# CUP-only
$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package # GPU support
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package # 4.3生成whl文件
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg # 5 安装刚刚编译好的pip 包
# 这里安装的时候官方文档使用的是sudo命令,如果是个人电脑,不建议使用sudo, 直接pip即可。
$ pip install /tmp/tensorflow_pkg/tensorflow-{version}-none-any.whl # 6 接下来就是验证你是否已经安装成功
$ python -c "import tensorflow as tf; print(tf.Session().run(tf.constant('Hello, TensorFlow')))"
# 然后你就会看到如下输出
b'Hello, TensorFlow' # 恭喜你,成功编译了tensorflow,Warning也都解决了!
报错解决
Do you wish to build TensorFlow with MKL support? [y/N] y
MKL support will be enabled for TensorFlow
Do you wish to download MKL LIB from the web? [Y/n] y
Darwin is unsupported yet
# 这里MKL不支持Darwin(MAC),因此要选择N ERROR: /Users/***/Documents/tensorflow/tensorflow/core/BUILD:1331:1: C++ compilation of rule '//tensorflow/core:lib_hash_crc32c_accelerate_internal' failed: cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 32 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
clang: error: no such file or directory: 'y'
clang: error: no such file or directory: 'y' # 这里是因为在configure的时候有些包不支持但是选择了y,因此记住一点所有的都选n
转载:https://www.jianshu.com/p/b1faa10c9238
TensorFlow CPU环境 SSE/AVX/FMA 指令集编译的更多相关文章
- Tensorflow Cpu不支持AVX
Tensorflow从1.6开始从AVX编译二进制文件,所以如果你的CPU不支持AVX 你需要 从源码编译 下载旧版 从源码编译比较麻烦,如果你是初学的话,我建议使用旧版. 安装旧版: pip3 in ...
- 编译TensorFlow CPU指令集优化版
编译TensorFlow CPU指令集优化版 如题,CPU指令集优化版,说的是针对某种特定的CPU型号进行过优化的版本.通常官方给的版本是没有针对特定CPU进行过优化的,有网友称,优化过的版本相比优化 ...
- centos7 源码编译安装TensorFlow CPU 版本
一.前言 我们都知道,普通使用pip安装的TensorFlow是万金油版本,当你运行的时候,会提示你不是当前电脑中最优的版本,特别是CPU版本,没有使用指令集优化会让TensorFlow用起来更慢. ...
- 深度学习(TensorFlow)环境搭建:(三)Ubuntu16.04+CUDA8.0+cuDNN7+Anaconda4.4+Python3.6+TensorFlow1.3
紧接着上一篇的文章<深度学习(TensorFlow)环境搭建:(二)Ubuntu16.04+1080Ti显卡驱动>,这篇文章,主要讲解如何安装CUDA+CUDNN,不过前提是我们是已经把N ...
- Ubuntu 16.04 TensorFlow CPU 版本安装
1.下载Anaconda,官方网站.我下载的时Python 2.7 64bit版本: 2.安装执行命令 bash Anaconda2-4.2.0-Linux-x86_64.sh 设置好目录后等 ...
- TensorFlow实验环境搭建
初衷: 由于系统.平台的原因,网上有各种版本的tensorflow安装教程,基于linux的.mac的.windows的,各有不同,tensorflow的官网也给出了具体的安装命令.但实际上,即使te ...
- 深度学习Tensorflow生产环境部署(下·模型部署篇)
前一篇讲过环境的部署篇,这一次就讲讲从代码角度如何导出pb模型,如何进行服务调用. 1 hello world篇 部署完docker后,如果是cpu环境,可以直接拉取tensorflow/servin ...
- 虚拟机 Ubuntu18.04 tensorflow cpu 版本
虚拟机 Ubuntu18.04 tensorflow cpu 版本 虚拟机VMware 配置: 20G容量,可扩充 2G内存,可扩充 网络采用NAT模式 平台:win10下的Ubuntu18.04 出 ...
- Windows下Anaconda安装 python + tensorflow CPU版
下载安装Anaconda 首先下载Anaconda,可以从清华大学的镜像网站进行下载. 安装Anaconda,注意安装时不要将添加环境变量的选项取消掉. 安装完成之后,在安装目录下cmd,输入: co ...
随机推荐
- winform显示word、ppt和pdf,用一个控件显示
思路:都以pdf的格式展示,防止文件拷贝,所以要把word和ppt转换为pdf:展示用第三方组件O2S.Components.PDFView4NET.dll,破解版的下载链接:https://pan. ...
- 04-Java 对象和类
Java作为一种面向对象语言.支持以下基本概念: 多态 继承 封装 抽象 类 对象 实例 方法 重载 本节我们重点研究对象和类的概念. 对象:对象是类的一个实例(对象不是找个女朋友),有状态和行为.例 ...
- Fiddler发送post请求 出现503
- [Windows] Windows API 串口通信
Windows 中通过Windows API 进行串口通信主要有以下步骤: 打开串口 配置串口 读写串口 关闭串口 打开串口 关键API: CreateFile Windows 中进行设备的操作,第一 ...
- Linux文件与目录管理,常用命令总结
绝对路径: 以根目录 / 开始的相对路径: 相对于当前路径的写法 $PATH: 可执行文件路径的变量(出现在该变量下的文件可以在系统的任何目录下都可以执行) 获取路径的文件名: basen ...
- Django使用DjangoUeditor教程
文章目录 1.将下在DjangoUeditor解压2.将解压的文件夹复制到项目的根目录中,这里使用的是虚拟环境3.进入到DjangoUedior3-master文件下,执行离线安装命令 python ...
- python-django框架-电商项目-项目部署_20191127
python-django框架-电商项目-项目部署: uwsgi作为web服务器: 在pycharm中启动项目:使用python manage.py runserver 这个runserver是dja ...
- 使用Cron表达式创建定时任务
CronTriggerCronTrigger功能非常强大,是基于日历的作业调度,而SimpleTrigger是精准指定间隔,所以相比SimpleTrigger,CroTrigger更加常用.CroTr ...
- jQuery选择器的效率问题
jQuery提供了功能强大,并兼容多种css版本的选择器,不过发现很多同学在使用选择器时并未注重效率的问题. a) 尽量使用Id选择器,jQuery选择器使用的API都是基于getElementByI ...
- npm参考手册
一 权限操作 npm允许通过scope组织私有包,通过team细化权限控制 npm官方仓储有两种类型的包,普通包和scope包 普通包特征: - 只能公有,谁都可以下载使用 - 仅可以通过所有者(ow ...