tensorflow源代码方式安装
本文介绍tensorflow源代码方式安装。安装的系统为 Ubuntu 15.04。
获取TensorFlow源代码
git clone --recurse-submodules https://github.com/tensorflow/tensorflow
使用 --recurse-submodules 选项来获取 TensorFlow 需要依赖的 protobuf 库文件。
安装 Bazel
遵从以下指令来安装 bazel 依赖。bazel 安装文件:下载地址
bazel 缺省需要使用JDK1.8,如你使用JDK1.7,请下载相应的安装包。
安装 Bazel 其他所需依赖:
sudo apt-get install pkg-config zip g++ zlib1g-dev unzip
执行如下命令来安装Bazel:
chmod +x PATH_TO_INSTALL.SH
./PATH_TO_INSTALL.SH --user
记住把 PATH_TO_INSTALL.SH 替换为你下载的Bazel安装文件名,如:
./bazel-0.1.4-installer-linux-x86_64.sh --user
安装其他依赖
sudo apt-get install python-numpy swig python-dev
配置安装
运行 tensorflow 根目录下的 configure 脚本。这个脚本会要求你输入 python 解释器的安装路径,并允许你可选择安装CUDA库。
如果不安装CUDA,则这一步主要是定位python和numpy头文件所在位置:
./configure
Please specify the location of python. [Default is /usr/bin/python]:
如果要安装CUDA,则除了指定 python 外,还需指定 CUDA 安装位置:
./configure
Please specify the location of python. [Default is /usr/bin/python]:
Do you wish to build TensorFlow with GPU support? [y/N] y
GPU support will be enabled for TensorFlow Please specify the location where CUDA 7.0 toolkit is installed. Refer to
README.md for more details. [default is: /usr/local/cuda]: /usr/local/cuda Please specify the location where the cuDNN v2 library is installed. Refer to
README.md for more details. [default is: /usr/local/cuda]: /usr/local/cuda Setting up Cuda include
Setting up Cuda lib64
Setting up Cuda bin
Setting up Cuda nvvm
Configuration finished
构建支持GPU的Tensorflow
在tensorflow 根目录下执行如下命令:
$ bazel build -c opt --config=cuda --spawn_strategy=standalone //tensorflow/cc:tutorials_example_trainer $ bazel-bin/tensorflow/cc/tutorials_example_trainer --use_gpu
# Lots of output. This tutorial iteratively calculates the major eigenvalue of
# a 2x2 matrix, on GPU. The last few lines look like this.
000009/000005 lambda = 2.000000 x = [0.894427 -0.447214] y = [1.788854 -0.894427]
000006/000001 lambda = 2.000000 x = [0.894427 -0.447214] y = [1.788854 -0.894427]
000009/000009 lambda = 2.000000 x = [0.894427 -0.447214] y = [1.788854 -0.894427]
Note that "--config=cuda" is needed to enable the GPU support.
tensorflow源代码方式安装的更多相关文章
- (转载)CentOS6下 源代码方式安装openERP7.0
CentOS6下 源代码方式安装openERP7.0 安装背景 :CPU32 bit,CentOS 6.4版本,openERP7.0,linux shell为bash,PostgreSQL9.2 1. ...
- Linux下基于源代码方式安装MySQL 5.6
MySQL为开源数据库,因此能够基于源代码实现安装.基于源代码安装有很多其它的灵活性. 也就是说我们能够针对自己的硬件平台选用合适的编译器来优化编译后的二进制代码.依据不同的软件平台环境调整相关的编译 ...
- ubuntu16.04 tensorflow pip 方式安装
首先,需要知道 tensorflow 1.5版本以上包括 1.5版本 的GPU类型都是需要安装 cuda9.0的, tensorflow-gpu 1.4版本是可以使用cuda 8.0. ...
- 树莓派通过apt方式安装opencv库
1.安装opencv 开始之前进行必要的更新工作. sudo apt-get update 安装opencv. sudo apt-get install libcv-dev 安 ...
- ubuntu1604使用源码方式安装ruby2.5.0
本文介绍ubutntu1604环境下源代码方式安装ruby 版本2.5.0 如果内存小于2G可以开启虚拟内存,下面的命令开启4G虚拟内存 sudo dd if=/dev/zero of=/swap b ...
- ubuntu 14.04 下利用apt-get方式安装opencv
转载,请注明出处:http://blog.csdn.net/tina_ttl 目录(?)[+] 标签(空格分隔): Linux学习 OpenCV ubuntu 1404 下利用apt-get方式安装O ...
- tensorflow的Virtualenv安装方式安装
本文介绍了如何在ubuntu上以virtualenv方式安装tensorflow. 安装pip和virtualenv: # Ubuntu/Linux 64-bit sudo apt-get insta ...
- Tensorflow[源码安装时bazel行为解析]
0. 引言 通过源码方式安装,并进行一定程度的解读,有助于理解tensorflow源码,本文主要基于tensorflow v1.8源码,并借鉴于如何阅读TensorFlow源码. 首先,自然是需要去b ...
- 第四百一十六节,Tensorflow简介与安装
第四百一十六节,Tensorflow简介与安装 TensorFlow是什么 Tensorflow是一个Google开发的第二代机器学习系统,克服了第一代系统DistBelief仅能开发神经网络算法.难 ...
随机推荐
- AUTO_INCREMENT列在InnoDB里如何工作
如果你为一个表指定AUTO_INCREMENT列,在数据词典里的InnoDB表句柄包含一个名为自动增长计数器的计数器,它被用在为该列赋新值.自动增长计数器仅被存储在主内存中,而不是存在磁盘上. Inn ...
- HDU 1242 Rescue(BFS),ZOJ 1649
题目链接 ZOJ链接 Problem Description Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The ...
- 一步一步学EF系列1【Fluent API的方式来处理实体与数据表之间的映射关系】
EF里面的默认配置有两个方法,一个是用Data Annotations(在命名空间System.ComponentModel.DataAnnotations;),直接作用于类的属性上面,还有一个就是F ...
- Matlab - 矩阵元素引用
>> A = [ ; ; ] A = 1. 选择第m行n列的元素 >> A(,) ans = 2. 选择第i列所有元素 >> A(:,) ans = 3. 选择第j ...
- CentOS系统更换软件安装源aliyun的
CentOS系统更换软件安装源第一步:备份你的原镜像文件,以免出错后可以恢复. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS ...
- RegOpenKey(注册表定位器) 1.5 中文免费绿色版
软件名称: RegOpenKey(注册表定位器) 1.5 中文免费绿色版 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win7 / Vista / Win2003 / WinXP / Wi ...
- C# 中的局部static变量
其实这问题没什么可讨论的,C#不支持局部静态变量. 但还是想了一下C#为什么不支持局部静态变量,以下均是个人想法. C++和C支持局部静态变量,也就是在一个函数的内部声明一个静态变量,这种变量的特定如 ...
- TODO:小程序的使用体验
TODO:小程序的使用体验 2017.01.09小程序如期而至,话说十年前的今天2007.01.09是第一代iPhone发布日期. 清晨朋友圈发了一张小程序的截图,很多朋友问用什么版本的微信才有小程序 ...
- python2.7学习记录之四
1.从raw_input()读取的内容永远以字符串的形式返回,把字符串和整数比较就不会得到期待的结果,必须先用int()把字符串转换为我们想要的整型 2.list增加元素 为 append() 3.d ...
- HOSTS文件修改后不起作用的原因
如果是通过记事本修改,其实是没有问题的,如果有问题,网上搜到的是ipconfig /flushdns之类的 如果是批量程序写的,那就要小心了, 一定要ANSI(美标格式的,忘了英文是什么来着) 保存后 ...