用Bazel编译Tensorflow

用Bazel编译Tensorflow,tensorflow,compilation,bazel,Tensorflow,Compilation,Bazel,在运行./configure之后,我尝试使用下面的shell命令行从主分支的头部编译tensorflow 1.3 sudo bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.1 --copt=-msse4.2 --config=cuda -k --verbose_failures //tensorflow/tools/pip_package:build_pip

在运行./configure之后,我尝试使用下面的shell命令行从主分支的头部编译tensorflow 1.3

sudo bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.1 --copt=-msse4.2 --config=cuda -k --verbose_failures //tensorflow/tools/pip_package:build_pip_package
我最终得到了以下错误

At global scope:cc1plus: warning: unrecognized command line option '-Wno-self-assign'
Target //tensorflow/tools/pip_package:build_pip_package failed to build 
INFO: Elapsed time: 3834.785s, Critical Path: 196.95s FAILED: Build did NOT complete successfully
这些是它最初发出的警告

WARNING: /home/pranav/tensorflow_install/tensorflow/tensorflow/core/BUILD:1634:1: in includes attribute of cc_library rule //tensorflow/core:framework_headers_lib: '../../external/nsync/public' resolves to 'external/nsync/public' not below the relative path of its package 'tensorflow/core'. This will be an error in the future. Since this rule was created by the macro 'cc_header_only_library', the error might have been caused by the macro implementation in /home/pranav/tensorflow_install/tensorflow/tensorflow/tensorflow.bzl:911:30
WARNING: /home/pranav/tensorflow_install/tensorflow/tensorflow/contrib/learn/BUILD:15:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:exporter': No longer supported. Switch to SavedModel immediately.
WARNING: /home/pranav/tensorflow_install/tensorflow/tensorflow/contrib/learn/BUILD:15:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:gc': No longer supported. Switch to SavedModel immediately.
INFO: Analysed target //tensorflow/tools/pip_package:build_pip_package (208 packages loaded).
然后是大量的信息。我不确定这是否有用

巴泽尔版本:

Build label: 0.5.4
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Aug 25 10:00:00 2017 (1503655200)
Build timestamp: 1503655200
Build timestamp as int: 1503655200
我读了一些答案来运行以下代码

$ bazel query --output=build 'somepath("//tensorflow/core:version_info_gen",  "//tensorflow/tools/git:gen/spec.json")'
它给了我这个,也许这会有帮助

# /home/pranav/tensorflow_install/tensorflow/tensorflow/core/BUILD:1546:1
genrule(
  name = "version_info_gen",
  generator_name = "version_info_gen",
  generator_function = "tf_version_info_genrule",
  generator_location = "tensorflow/core/BUILD:1546",
  srcs = ["//tensorflow/tools/git:gen/spec.json", "//tensorflow/tools/git:gen/head", "//tensorflow/tools/git:gen/branch_ref"],
  tools = ["//tensorflow/tools/git:gen_git_source.py"],
  outs = ["//tensorflow/core:util/version_info.cc"],
  cmd = "$(location //tensorflow/tools/git:gen_git_source.py) --generate $(SRCS) \"$@\"",
  local = True,
)
此外,“我编写的bazel命令”>log.txt不会用终端输出填充文本文件

如果你们想要更多的信息来帮助我。建议我一种将终端输出复制到文本文件的方法,这样我就可以将其上传到github上并提供链接。 我还使用--explain将所有解释写入一个文件。如果你愿意,我也可以上传。 我还尝试了--local_resources 2048、.5,1.0来减少内存分配,以防出现内存问题。还是不行。
提前非常感谢。

运行
bazel build后,能否粘贴bazel的整个输出。。。pip_包
?你只显示了警告,我猜实际错误在上面。你使用什么编译器和它的什么版本?我不确定我是否理解你问的是什么编译器。我有gcc(Ubuntu5.4.0-6ubuntu1~16.04.4)5.4.0 20160609和pip版本9.0.1输出中没有任何错误。实际输出太大,无法在这里发布。给我一个写文件的方法,我让它工作了。问题是试图编译XLA JIT。由于某种原因,它没有编译并关闭,而在我的计算机中没有显示任何错误。如果没有这些,它现在可以正常工作了。感谢您在运行
bazel构建后粘贴整个bazel输出。。。pip_包
?你只显示了警告,我猜实际错误在上面。你使用什么编译器和它的什么版本?我不确定我是否理解你问的是什么编译器。我有gcc(Ubuntu5.4.0-6ubuntu1~16.04.4)5.4.0 20160609和pip版本9.0.1输出中没有任何错误。实际输出太大,无法在这里发布。给我一个写文件的方法,我让它工作了。问题是试图编译XLA JIT。由于某种原因,它没有编译并关闭,而在我的计算机中没有显示任何错误。如果没有这些,它现在可以正常工作了。谢谢