tensorflow - 无法在 Ubuntu 18.04 上从源代码编译 Tensorflow
问题描述
当我尝试从源代码编译 TensorFlow 时,出现以下错误。我正在使用 GPU Docker 映像来运行构建。理论上,它已经设置了所有正确的依赖项。
主机是 Ubuntu 18.04。我在两台具有最新 Nvidia 驱动程序的不同机器上收到此问题。一个有 1080 TI,另一个有 1060 nvidia 卡。
基于 tensorflow/tensorflow:1.11.0-devel-gpu 构建 docker 镜像。
我以交互模式运行它并运行 ./configure。
这是配置:
./configure
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.15.0 installed.
Please specify the location of python. [Default is /usr/bin/python]:
Found possible Python library paths:
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
Please input the desired Python library path to use. Default is [/usr/local/lib/python2.7/dist-packages]
Do you wish to build TensorFlow with jemalloc as malloc support? [Y/n]: y
jemalloc as malloc support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]: y
Google Cloud Platform support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Hadoop File System support? [Y/n]: y
Hadoop File System support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Amazon AWS Platform support? [Y/n]: y
Amazon AWS Platform support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Apache Kafka Platform support? [Y/n]: y
Apache Kafka Platform support will be enabled for TensorFlow.
Do you wish to build TensorFlow with XLA JIT support? [y/N]: y
XLA JIT support will be enabled for TensorFlow.
Do you wish to build TensorFlow with GDR support? [y/N]: y
GDR support will be enabled for TensorFlow.
Do you wish to build TensorFlow with VERBS support? [y/N]: y
VERBS support will be enabled for TensorFlow.
Do you wish to build TensorFlow with nGraph support? [y/N]: y
nGraph support will be enabled for TensorFlow.
Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: n
No OpenCL SYCL support will be enabled for TensorFlow.
Please specify the location where CUDA 9.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
Please specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
Please specify the location where TensorRT is installed. [Default is /usr/lib/x86_64-linux-gnu]:
Please specify the location where NCCL 2 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
Do you want to use clang as CUDA compiler? [y/N]: n
nvcc will be used as CUDA compiler.
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]:
Do you wish to build TensorFlow with MPI support? [y/N]: n
No MPI support will be enabled for TensorFlow.
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]:
Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n
Not configuring the WORKSPACE for Android builds.
Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See tools/bazel.rc for more details.
--config=mkl # Build with MKL support.
--config=monolithic # Config for mostly static monolithic build.
Configuration finished
root@17ed0ddbe2a4:/tensorflow#
这是我得到的错误。
ERROR: /root/.cache/bazel/_bazel_root/68a62076e91007a7908bc42a32e4cff9/external/ngraph_tf/BUILD.bazel:19:1: C++ compilation of rule '@ngraph_tf//:ngraph_tf' failed (Exit 1)
In file included from external/org_tensorflow/tensorflow/core/framework/common_shape_fns.h:22:0,
from external/org_tensorflow/tensorflow/core/framework/resource_mgr.h:24,
from external/org_tensorflow/tensorflow/core/common_runtime/device.h:43,
from external/org_tensorflow/tensorflow/core/common_runtime/device_set.h:23,
from external/org_tensorflow/tensorflow/core/common_runtime/optimization_registry.h:25,
from external/ngraph_tf/src/ngraph_encapsulate_pass.cc:23:
external/org_tensorflow/tensorflow/core/util/tensor_format.h: In function 'tensorflow::TensorShape tensorflow::ShapeFromFormat(tensorflow::TensorFormat, tensorflow::int64, tensorflow::gtl::ArraySlice<long long int>, tensorflow::int64)':
external/org_tensorflow/tensorflow/core/util/tensor_format.h:501:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (format == FORMAT_NHWC_VECT_W && dim == spatial.size() - 1) {
^
external/ngraph_tf/src/ngraph_encapsulate_pass.cc: In member function 'tensorflow::Status ngraph_bridge::NGraphEncapsulatePass::EncapsulateFunctions(tensorflow::Graph*)':
external/ngraph_tf/src/ngraph_encapsulate_pass.cc:393:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (i < node->requested_inputs().size()) {
^
external/ngraph_tf/src/ngraph_encapsulate_pass.cc:414:42: error: 'class absl::string_view' has no member named 'ToString'
cluster_idx, tensor_id.first.ToString(), tensor_id.second));
^
In file included from external/org_tensorflow/tensorflow/core/platform/default/logging.h:24:0,
from external/org_tensorflow/tensorflow/core/platform/logging.h:25,
from external/org_tensorflow/tensorflow/core/lib/core/refcount.h:22,
from external/org_tensorflow/tensorflow/core/platform/tensor_coding.h:21,
from external/org_tensorflow/tensorflow/core/framework/resource_handle.h:19,
from external/org_tensorflow/tensorflow/core/framework/allocator.h:24,
from external/org_tensorflow/tensorflow/core/common_runtime/device.h:35,
from external/org_tensorflow/tensorflow/core/common_runtime/device_set.h:23,
from external/org_tensorflow/tensorflow/core/common_runtime/optimization_registry.h:25,
from external/ngraph_tf/src/ngraph_encapsulate_pass.cc:23:
external/org_tensorflow/tensorflow/core/util/tensor_format.h: In instantiation of 'T tensorflow::GetTensorDim(tensorflow::gtl::ArraySlice<T>, tensorflow::TensorFormat, char) [with T = long long int; tensorflow::gtl::ArraySlice<T> = absl::Span<const long long int>]':
external/org_tensorflow/tensorflow/core/util/tensor_format.h:452:47: required from here
external/org_tensorflow/tensorflow/core/util/tensor_format.h:420:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
CHECK(index >= 0 && index < dimension_attributes.size())
^
external/org_tensorflow/tensorflow/core/platform/macros.h:87:47: note: in definition of macro 'TF_PREDICT_FALSE'
#define TF_PREDICT_FALSE(x) (__builtin_expect(x, 0))
^
external/org_tensorflow/tensorflow/core/util/tensor_format.h:420:3: note: in expansion of macro 'CHECK'
CHECK(index >= 0 && index < dimension_attributes.size())
^
external/org_tensorflow/tensorflow/core/util/tensor_format.h: In instantiation of 'T tensorflow::GetFilterDim(tensorflow::gtl::ArraySlice<T>, tensorflow::FilterTensorFormat, char) [with T = long long int; tensorflow::gtl::ArraySlice<T> = absl::Span<const long long int>]':
external/org_tensorflow/tensorflow/core/util/tensor_format.h:461:54: required from here
external/org_tensorflow/tensorflow/core/util/tensor_format.h:435:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
CHECK(index >= 0 && index < dimension_attribute.size())
^
external/org_tensorflow/tensorflow/core/platform/macros.h:87:47: note: in definition of macro 'TF_PREDICT_FALSE'
#define TF_PREDICT_FALSE(x) (__builtin_expect(x, 0))
^
external/org_tensorflow/tensorflow/core/util/tensor_format.h:435:3: note: in expansion of macro 'CHECK'
CHECK(index >= 0 && index < dimension_attribute.size())
^
Target //tensorflow/tools/pip_package:build_pip_package failed to build
我对 1.10 图像也有同样的问题。或者尝试直接在主机上从源代码构建 1.10 或 1.11。
解决方案
推荐阅读
- google-cloud-ml - Google Cloud ML Engine:访问在线预测日志
- javascript - 动态变化的道具
- loops - 宏从现有程序中的数据表运行迭代
- c# - 每个解决方案的编辑和继续选项
- css - CSS 中的伪元素和弹性框
- python - scrapy无法配合python3.7
- php - WordPress 高级自定义字段 Pro Globals Select
- go - 如何使用无服务器框架处理手动调用的 AWS lambda
- sql-server-2008 - 如何使用 SELECT 处理并发?
- javascript - iPhone X 上带有 chrome 的 navigator.mediaDevices.getUserMedia 出现问题