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 ...
随机推荐
- 吴裕雄--天生自然 JAVA开发学习:MySQL 连接
CREATE TABLE `websites` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` char(20) NOT NULL DEFAULT '' ...
- CSS样式表---------第三章:样式属性
三.样式属性 1.背景与前景 background-color:#90; ------------背景色,样式表优先级高. background-image:url(路径)-------------- ...
- 向通用自动驾驶部门Cruise投资22.5亿美元,软银打得什么主意?
5月29日,加利福尼亚州的一辆特斯拉Model S撞上停在路边的警车.据透露,当时这辆特斯拉正处于自动辅助驾驶即Autopilot模式.而在今年,这已经不是第一次特斯拉自动驾驶模式出问题了.此外,Ub ...
- mysql idb文件过大
分开 保存,每个数据库有自己的 innodb_file_per_table=1
- [LC] 79. Word Search
Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from l ...
- function_exists (),method_exists()与is_callable()的区别
is_callable()函数要高级一些,它接受字符串变量形式的方法名作为 第一个参数,如果类方法存在并且可以调用,则返回true.如果要检测类中的方法是否能被调用,可以给函数传递一个数组而不是类的方 ...
- R内的gsub()函数
今天遇到了一个问题就是,如果数据里面有逗号,那么如何转换他们.就像下面的这样: > exercise9_1$地区生产总值 [1] 16,251.93 11,307.28 24,515.76 11 ...
- Mac 环境docker 安装jenkins
网上很多的教程是讲的是Linux 上的Docker安装Jenkins,但是我用的是Mac,所以参考之前的前辈写的文章,记录一下自己的安装过程.非常感谢参考文章的前辈写的文章. 参考Docker安装Je ...
- 吴裕雄--天生自然 PYTHON数据分析:威斯康星乳腺癌(诊断)数据分析(续一)
drop_list1 = ['perimeter_mean','radius_mean','compactness_mean','concave points_mean','radius_se','p ...
- Flask添加新命令
代码: import click from flask import Flask app = Flask(__name__) @app.cli.command() def hg(): click.ec ...