这几天终于把tensorflow安装上了,中间遇到过不少的问题,这里记录下来。供大家想源码安装的参考。

安装环境:POWER8处理器,Docker容器Ubuntu14.04镜像。

Build Tensorflow for IBM POWER8 CPU from Source Code

1. My os environment
  14.04.1-Ubuntu SMP
  ppc64le
  gcc 4.8.4
  python 2.7.6

2. Install bazel and protobuf
  I only have openjdk-7. so I installed bazel 0.1.0, and bazel 0.1.0 needs protobuf v3.0.0-alpha-3, you can refer to “Build Bazel<v0.1.0> for IBM POWER8 CPU from Source Code" for the installation.

3. Install other dependencies
  sudo apt-get install python-pip python-dev python-numpy
  sudo apt-get install swig

4. get source code
  git clone --recurse-submodules https://github.com/tensorflow/tensorflow

5. modify ~/.bazelrc
  add build options #you can visit http://bazel.io/docs/bazel-user-manual.html to find these options' descriptions
  to build in standalone : --spawn_strategy=standalone --genrule_strategy=standalone
  to limit cpu and ram usage : --jobs=20 --ram_utilization_factor percentage=30

6. build source code

  ./configure (select GPU or CPU)
  bazel build -c opt  //tensorflow/cc:tutorials_example_trainer

7. Create the pip package and install
7.1 generate tensorflow whl package
  if you wan to use tensorflow in python, a pip package should be created
  $ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
  # or build with GPU support:
  $ bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
  after a night, a message displayed:
  Target //tensorflow/tools/pip_package:build_pip_package up-to-date:
  bazel-bin/tensorflow/tools/pip_package/build_pip_package
  INFO: Elapsed time: 32556.820s, Critical Path: 31793.39s

  bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

7.2 tensorflow whl package path
  opuser@nova:~/tensorflow/tensorflow$ ls /tmp/tensorflow_pkg/
  tensorflow-0.5.0-cp27-none-linux_ppc64le.whl
7.3 install whl package using pip
  opuser@nova:~/tensorflow/tensorflow$ sudo pip install /tmp/tensorflow_pkg/tensorflow-0.5.0-cp27-none-linux_ppc64le.whl
7.4 tensflow installed package path
  opuser@nova:~/tensorflow/tensorflow/tensorflow/models/image/mnist$ ls /usr/local/lib/python2.7/dist-packages
  tensorflow tensorflow-0.5.0.dist-info
7.5 train a mnist dataset(#sudo is needed)
  # You can alternatively pass the path to the model program file to the python interpreter.
  opuser@nova:~$ sudo python /usr/local/lib/python2.7/dist-packages/tensorflow/models/image/mnist/convolutional.py
  Succesfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
  Succesfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
  Succesfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
  Succesfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
  Extracting data/train-images-idx3-ubyte.gz
  Extracting data/train-labels-idx1-ubyte.gz
  Extracting data/t10k-images-idx3-ubyte.gz
  Extracting data/t10k-labels-idx1-ubyte.gz
  can't determine number of CPU cores: assuming 4
  I tensorflow/core/common_runtime/local_device.cc:40] Local device intra op parallelism threads: 4
  can't determine number of CPU cores: assuming 4
  I tensorflow/core/common_runtime/direct_session.cc:60] Direct session inter op parallelism threads: 4
  Initialized!
  Epoch 0.00
  Minibatch loss: 12.054, learning rate: 0.010000
  Minibatch error: 90.6%
  Validation error: 84.6%
  Minibatch loss: 3.289, learning rate: 0.010000
  ......

8. problems during compiling
<Error: gcc: internal compiler error: Killed, com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 4.
>
  This is due to the lack of cpu ram or swap. you can modify --jobs value or --ram_utilization_factor value . or check if there is any process that occupies large ram. and kill it. It happends to me that there may exist two bazel servers. so I need to kill one.

9. reference
tensorflow/tensorflow/g3doc/get_started/os_setup.md
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md

bazel-user-manual.html
http://bazel.io/docs/bazel-user-manual.html

cuda or cudnn version dismatch

https://github.com/tensorflow/tensorflow/issues/125

Google Tensorflow 源码编译(三):tensorflow<v0.5.0>的更多相关文章

  1. tensorflow 源码编译tensorflow 1.1.0到 tensorflow 2.0,ver:1.1.0rc1、1.4.0rc1、1.14.0-rc1、2.0.0b1

    目录 tensorflow-build table 更多详细过程信息及下载: tensorflow-build tensorflow 源码编译,提升硬件加速,支持cpu加速指令,suport SSE4 ...

  2. TensorFlow Python2.7环境下的源码编译(三)编译

    一.源代码编译 这里要为仅支持 CPU 的 TensorFlow 构建一个 pip 软件包,需要调用以下命令: $ bazel build --cxxopt="-D_GLIBCXX_USE_ ...

  3. Mac下使用源码编译安装TensorFlow CPU版本

    1.安装必要的软件 1.1.安装JDK 8 (1)JDK 8 can be downloaded from Oracle's JDK Page: http://www.oracle.com/techn ...

  4. centos7 源码编译安装TensorFlow CPU 版本

    一.前言 我们都知道,普通使用pip安装的TensorFlow是万金油版本,当你运行的时候,会提示你不是当前电脑中最优的版本,特别是CPU版本,没有使用指令集优化会让TensorFlow用起来更慢. ...

  5. windows10下如何进行源码编译安装tensorflow

    1.获取python3.5.x https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe 2.安装python3.5.x,默认安装即 ...

  6. Tensorflow源码编译常见问题点总结

    Tensorflow源码编译分两种:一种是本地源码编译,另一种是针对ARM平台的源码编译. 接下来分别介绍: 一.本地编译 本地编译时,使用的编译工具是本地GCC. 一般会碰到以下问题: 第1个:ex ...

  7. Google Tensorflow 源码编译(二):Bazel<v0.1.0>

    这几天终于把tensorflow安装上了,中间遇到过不少的问题,这里记录下来.供大家想源码安装的参考. 安装环境:POWER8处理器,Docker容器Ubuntu14.04镜像. Build Baze ...

  8. Google Tensorflow 源码编译(一):Protobuf<v3.0.0-alpha-3>

    这几天终于把tensorflow安装上了,中间遇到过不少的问题,这里记录下来.供大家想源码安装的参考. 安装环境:POWER8处理器,Docker容器Ubuntu14.04镜像. Build Prot ...

  9. Tensorflow源码编译,解决tf提示未使用SSE4.1 SSE4.2 AVX警告【转】

    本文转载自:https://blog.csdn.net/iTaacy/article/details/72799833 版权声明:欢迎转载,转载请注明出处! https://blog.csdn.net ...

随机推荐

  1. npm(cnpm)介绍

    1.npm(node package manager) nodejs的包管理器,用于node插件管理(安装.卸载.更新.管理依赖等); 2.使用npm安装安装插件: 1).命令提示符执行 npm in ...

  2. DES带IV向量加密解密工具

    链接:http://pan.baidu.com/s/1kVAV80J  密码:sgys 鉴于网上的DES加密解密都是不带IV向量的 我就自制了一个带IV向量的DES加密解密的小工具 © 2016-20 ...

  3. Node黑客开发的10个好习惯(2016)

    在2015年底之际,javascript开发者已经掌握了大量的工具.最后一次我们调查的时候,现代化的JS蓝图才刚刚出现.今天,我们很容易在JS的庞大生态系统中迷失,而成功的团队大部分时间都遵守着JS开 ...

  4. C# Substring的用法

    方法1  Substring(Int32) 从此实例检索子字符串. 子字符串在指定的字符位置开始并一直到该字符串的末尾. 方法2 Substring(Int32, Int32) 从此实例检索子字符串. ...

  5. Ruby学习笔记0708

    #!/usr/bin/env ruby class MegaGreeter attr_accessor :names # 初始化這個物件 def initialize(names = "Wo ...

  6. 折腾Ubuntu下的android studio

    ps:网速很慢,耗时一天多.先吐槽一下搭建很麻烦,毕竟现在在ubuntu上用as的人还不太多,很多步骤最好先自备梯子. 测试环境: ubuntu 14.04 LTS 64bit 安装的东西无非就是an ...

  7. IONIC 开发的Android应用程序签名(或重新签名)详解

    完全通过DOS命令来完成apk签名 给apk签名一共要用到3个工具,或者说3个命令,分别是:keytool.jarsigner和zipalign,下面是对这3个工具的简单介绍:            ...

  8. 解决python字典结构内存暴涨问题

    背景:当读取一个key value数据的时候,python的字典结构会造成内存使用扩10倍左右,无可容忍.此文解决这个问题 数据:word2vec训练的结果,word对应400维的词向量.词表共1.6 ...

  9. 安卓微信浏览器中location.href失效的问题

    在移动web中,经常会使用window.location.href去跳转页面,这个方法在绝大多数浏览器中都不会存在问题,但是在安卓手机的微信自带浏览器中,会出现一个奇怪的bug. window.loc ...

  10. linux常用vi命令

    1:vi +n filename :打开文件,并将光标置于第n行首 2:在底行模式下,输入:set nu显示行号3:将光标移动到248行,命令:248G,即在命令行模式下输入248shitf+g4:复 ...