【问题标题】:installing TensorFlow on the IBM power8在 IBM power8 上安装 TensorFlow
【发布时间】:2016-02-11 03:05:55
【问题描述】:

我可以访问一台大型 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。
  • 但我做到了!我在上面添加了明确的错误消息,也许这会给你更多信息?对我来说,看起来我也需要编译 protobuf,因为 third_party/protobuf/protoc-linux-x86_32.exe 可能不是正确的编译器。我使用了bazel.io/docs/install.html 的说明,我也尝试了源的 tar.gz。那我该怎么办呢?
  • 另外,我尝试的另一件事是将 protoc-linux-x86_32.exe 替换为 /usr/local/bin/protoc 的符号链接,该链接随我的发行版一起提供(版本为 libprotoc 3.0.0到protoc --version)。然而,这导致了类似的错误负载:pastebin.com/HN0MQiC4
  • 我在这里专门发起了一个关于 Bazel 的新话题:stackoverflow.com/questions/35381648/… 最好先解决这部分问题。
  • IBM 为 Tensorflow、torch 和其他深度学习平台预构建了二进制文件。说明可在他们的网站上找到。

标签: tensorflow bazel protocol-buffers


【解决方案1】:

安装 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

安装张量流

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

在这里你会遇到类似这样的错误

错误:/home/tf/.cache/bazel/_bazel_tf/b2f766da603b0bed56d4c1d0b178456a/external/farmhash_archive/BUILD:5:1: 执行 genrule @farmhash_archive//:configure failed: bash failed: error execution command /bin/bash - c ...(跳过剩余的 1 个参数):com.google.devtools.build.lib.shell.BadExitStatusException:进程以状态 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 P>

您必须如下编辑 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

【讨论】:

    【解决方案2】:

    使用 miniconda:

    安装 miniconda:

    wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux--ppc64le.sh -O miniconda.sh
    
    bash miniconda.sh
    

    接受条件并允许将 conda 添加到 PATH

    rm miniconda.sh
    echo export IBM_POWERAI_LICENSE_ACCEPT=yes >> ~/.bashrc
    source ~/.bashrc
    

    这将在终端上添加(基础)。将正确的频道添加为第一优先级

    conda config --add default_channels https://repo.anaconda.com/pkgs/main
    conda config --prepend channels https://public.dhe.ibm.com/ibmdl/export/pub/software/server/ibm-ai/conda/
    

    创建环境(最好不要在基础上安装包)

    conda create -n ai python=3.7
    conda activate ai
    conda install --strict-channel-priority tensorflow-gpu
    

    有关 IBM Power 8 和 Anaconda 上 miniconda 的更多信息:IBM Source & Anaconda Source

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    • 2010-12-09
    • 2017-08-21
    • 2016-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多