tensorflow - 在 IBM power8 上安装 TensorFlow

标签 tensorflow bazel protocol-buffers

我可以访问一台大型 IBM Power8 机器,并想在其上安装 TensorFlow。自然地,我尝试了快速 pip 安装,但失败了:

sudo pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl
tensorflow-0.6.0-cp27-none-linux_x86_64.whl is not a supported wheel on this platform.
Storing debug log for failure in /home/pv/.pip/pip.log

不幸的是,pip.log 包含的有用信息很少。

/usr/bin/pip run on Sat Feb  6 17:29:34 2016
tensorflow-0.6.0-cp27-none-linux_x86_64.whl is not a supported wheel on this platform.
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
    InstallRequirement.from_line(name, None))
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 168, in from_line
    raise UnsupportedWheel("%s is not a supported wheel on this platform." % wheel.filename)
UnsupportedWheel: tensorflow-0.6.0-cp27-none-linux_x86_64.whl is not a supported wheel on this platform.

接下来我尝试的是从源代码构建 TensorFlow。无济于事,我所有的尝试都以一些 cannot execute binary file: Exec format error 消息结束,例如:

/usr/local/bin/bazel: line 86: /usr/local/lib/bazel/bin/bazel-real: cannot execute binary file: Exec format error

然后我尝试从源代码编译 Bazel,这也导致了类似的硬错误。

me@machine:~/bazel-0.1.5$ ./compile.sh
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO:    ./compile.sh compile /path/to/bazel
🍃  Building Bazel from scratch.
Compiling Java stubs for protocol buffers...
third_party/protobuf/protoc-linux-x86_32.exe -Isrc/main/protobuf/ --java_out=/tmp/bazel.T9C83cNa/src src/main/protobuf/android_studio_ide_info.proto
scripts/bootstrap/buildenv.sh: line 63: third_party/protobuf/protoc-linux-x86_32.exe: cannot execute binary file: Exec format error
pv@sardonis:~/bazel-0.1.5$ ^C

但是我找到了这个链接 http://www.cnblogs.com/rodenpark/p/5007744.html这解释了如何在 Power8 机器上从源代码构建 Protobuf 编译器。这在他的其他主题 http://www.cnblogs.com/rodenpark/p/5007846.html 中描述的修改之后有效。我设法至少开始了编译过程。但现在它因大量错误而崩溃,每个错误本身似乎都不那么严重,但大量错误使它看起来真的毫无希望,我将它们发布在 http://pastebin.com/KjkseaGx 上。供引用。

所以……我快没灵感了。如何使 TensorFlow 在 Power8 机器上运行?

最佳答案

安装 bazel 0.2.0-ppc

tf@ubuntu16:~$ git clone https://github.com/ibmsoe/bazel
tf@ubuntu16:~/bazel$ git checkout v0.2.0-ppc
tf@ubuntu16:~/bazel$ ./compile.sh

安装 tensorflow

tf@ubuntu16:~$ git clone --recurse-submodules https://github.com/tensorflow/tensorflow
tf@ubuntu16:~/tensorflow$ git checkout  v0.10.0rc0
tf@ubuntu16:~/tensorflow$ git commit -m"v0.10.0rc0"
tf@ubuntu16:~/tensorflow$ git cherry-pick ce70f6cf842a46296119337247c24d307e279fa0
tf@ubuntu16:~/tensorflow$ git cherry-pick f1acb3bd828a73b15670fc8019f06a5cd51bd564
tf@ubuntu16:~/tensorflow$ git cherry-pick 9b6215a691a2eebaadb8253bd0cf706f2309a0b8
tf@ubuntu16:~/tensorflow$ ./configure
tf@ubuntu16:~/tensorflow$ bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

在这里你会遇到一个错误,像这样

ERROR: /home/tf/.cache/bazel/_bazel_tf/b2f766da603b0bed56d4c1d0b178456a/external/farmhash_archive/BUILD:5:1: Executing genrule @farmhash_archive//:configure failed: bash failed: error executing command /bin/bash -c ... (remaining 1 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1. /home/tf/.cache/bazel/_bazel_tf/b2f766da603b0bed56d4c1d0b178456a/tensorflow/external/farmhash_archive/farmhash-34c13ddfab0e35422f4c3979f360635a8c050260 /home/tf/.cache/bazel/_bazel_tf/b2f766da603b0bed56d4c1d0b178456a/tensorflow /tmp/tmp.XdCPQefJyZ /home/tf/.cache/bazel/_bazel_tf/b2f766da603b0bed56d4c1d0b178456a/tensorflow/external/farmhash_archive/farmhash-34c13ddfab0e35422f4c3979f360635a8c050260 /home/tf/.cache/bazel/_bazel_tf/b2f766da603b0bed56d4c1d0b178456a/tensorflow

你必须如下编辑 config.guess 来为 ppc64le 插入一个节

tf@ubuntu16:~/.cache/bazel/_bazel_tf/b2f766da603b0bed56d4c1d0b178456a/external/farmhash_archive/farmhash-34c13ddfab0e35422f4c3979f360635a8c050260$ vi config.guess
    *:BSD/OS:*:*)
        echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
        exit ;;
+    ppc64le:Linux:*:*)
+      echo powerpc64le-unknown-linux-gnu
+      exit ;;
    *:FreeBSD:*:*)
        case ${UNAME_MACHINE} in
tf@ubuntu16:~/tensorflow$ bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
tf@ubuntu16:~/tensorflow$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
tf@ubuntu16:~/tensorflow$ sudo pip install /tmp/tensorflow_pkg/tensorflow*.whl
tf@ubuntu16:~/tensorflow/bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfi
tf@ubuntu16:~/tensorflow$ mkdir _python_build
tf@ubuntu16:~/tensorflow$ cd _python_build
tf@ubuntu16:~/tensorflow/_python_build$ ln -s ~/tensorflow/bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/tensorflow/* .
tf@ubuntu16:~/tensorflow/_python_build$ ln -s ~/tensorflow/tools/* .
tf@ubuntu16:~/tensorflow/_python_build$ python  __init__.py develop

关于tensorflow - 在 IBM power8 上安装 TensorFlow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35330084/

相关文章:

c++ - 在 protobuf 对象上调用析构函数

python - 在 Tensorflow 中的 MNIST 上训练具有一个隐藏层的全连接网络

python - tensorflow 集线器 : Stuck while importing a model

machine-learning - 如何禁用keras警告?

Bazel-如何获取目标的所有传递源

c++ - Bazel 使用 OpenCV 3.3 依赖项构建

Tensorflow 构建错误

go - Cloud EndPoint GRPC 不匹配原型(prototype)定义

node.js - gRPC Node 服务器: how to load protobuf file from a different Git repo?

tensorflow - Tensorflow中哪个函数与Pytorch中的expand_as类似