【问题标题】:Error with tensorflow: scatter_nd_op_gpu.cu.o was not created张量流错误:未创建 scatter_nd_op_gpu.cu.o
【发布时间】:2018-09-26 19:31:09
【问题描述】:

我一直在尝试从源代码安装 Tensorflow,但出现此错误:

Error limit reached.
100 errors detected in the compilation of "/tmp/tmpxft_000076fb_00000000-7_scatter_nd_op_gpu.cu.cpp1.ii".
Compilation terminated.
ERROR: /home/rosgori/Python/tengpu/tensorflow/tensorflow/core/kernels/BUILD:4149:1: output 'tensorflow/core/kernels/_objs/scatter_nd_op_gpu/tensorflow/core/kernels/scatter_nd_op_gpu.cu.o' was not created
ERROR: /home/rosgori/Python/tengpu/tensorflow/tensorflow/core/kernels/BUILD:4149:1: not all outputs were created or valid
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 667.700s, Critical Path: 71.44s
FAILED: Build did NOT complete successfully

系统信息

  • 我是否编写了自定义代码(而不是使用 TensorFlow 中提供的股票示例脚本):否
  • 操作系统平台和发行版(例如,Linux Ubuntu 16.04):Ubuntu 16.04
  • TensorFlow 安装自(源代码或二进制文件):源代码
  • TensorFlow 版本(使用下面的命令):master
  • Python 版本:3.6.4
  • Bazel 版本(如果从源代码编译):0.12.0
  • GCC/编译器版本(如果从源代码编译):5.4.0
  • CUDA/cuDNN 版本:8.0 / 7.0
  • GPU 型号和内存:GeForce GT 740M; 2004MiB

复制的确切命令

bazel build --verbose_failures -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-msse4.1 --copt=-msse4.2 --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

当我说master时,我没有使用r1.8r1.7master 的时间戳:

from datetime import datetime
datetime.utcnow()

我得到:datetime.datetime(2018, 4, 16, 23, 30, 23, 844800)

所以我的问题是:

那个错误是什么意思?可以修吗?

编辑

有时我会明白:

20 errors detected in the compilation of "/tmp/tmpxft_000016a4_00000000-7_gather_functor_gpu.cu.cpp1.ii".
ERROR: /home/rosgori/Python/tengpu/tensorflow/tensorflow/core/kernels/BUILD:1208:1: output 'tensorflow/core/kernels/_objs/gather_functor_gpu/tensorflow/core/kernels/gather_functor_gpu.cu.o' was not created
ERROR: /home/rosgori/Python/tengpu/tensorflow/tensorflow/core/kernels/BUILD:1208:1: not all outputs were created or valid
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 157.766s, Critical Path: 35.22s
FAILED: Build did NOT complete successfully

【问题讨论】:

    标签: python tensorflow


    【解决方案1】:

    我通过 -:

    解决了这些问题
    1. 在我的 Ubuntu 16.04 上安装 gcc4.9

      根据https://www.tensorflow.org/install/install_sources 二进制构建包是使用 gcc4 构建的,因此 gcc5+ 存在一些不兼容问题

         sudo apt-get install python-software-properties
         sudo add-apt-repository ppa:ubuntu-toolchain-r/test
         sudo apt-get update
         sudo apt-get install gcc-4.9
         sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
         sudo apt-get install g++-4.9
         sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 50     
      

    然后在运行configure时将gcc的路径设为/usr/bin/gcc-4.9

    1. 编辑/tensorflow/core/platform/macros.h

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

      替换:

          #define TF_PREDICT_FALSE(x) (__builtin_expect(x, 0))
          #define TF_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
      

          #define TF_PREDICT_FALSE(x) (x)
          #define TF_PREDICT_TRUE(x) (x)
      

    【讨论】:

    • 我部分听从了您的建议(我没有安装 gcc-4.9),并成功构建了 .whl 文件。我应该将您的答案标记为正确答案吗?
    • 如果答案对您有帮助,您可以,但如果您不想这样做,那也很酷。
    【解决方案2】:

    在 bazel 构建推荐中添加:--cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"

    例如

    bazel build --config=opt --config=cuda --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" //tensorflow/tools/pip_package:build_pip_package
    

    【讨论】:

    • 欢迎来到 Stack Overflow!请不要只用源代码回答。尝试对您的解决方案如何工作提供一个很好的描述。请参阅:How do I write a good answer?。谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-21
    • 1970-01-01
    • 1970-01-01
    • 2017-08-04
    • 1970-01-01
    • 2018-07-06
    • 2017-02-11
    相关资源
    最近更新 更多