首页 > 解决方案 > 使用 bazel-buildfarm 构建 TensorFlow

问题描述

我正在尝试使用远程执行+缓存和 bazel-buildfarm 从源代码构建 TensorFlow。我已经使用示例配置文件 @ https://github.com/bazelbuild/bazel-buildfarm设置了一个 bazel-buildfarm 服务器和工作程序(参见examples/目录)。

我在 TensorFlow 的源代码库中向 .bazelrc 添加了以下规则(主管负责人):

build --spawn_strategy=remote
build --genrule_strategy=remote
build --strategy=Javac=remote 
build --strategy=Closure=remote
build --remote_executor=grpc://<bazel-buildfarm-server>:8980

然后我./configure使用我知道本地非远程构建成功的选项运行。

我开始了 TensorFlow 构建:

bazel build —config=opt —config=cuda --config=v2 //tensorflow/tools/pip_package:build_pip_package

此后不久,我收到此错误消息:

...
ERROR: /tensorflow/tensorflow/core/util/BUILD:345:1: Executing genrule //tensorflow/core/util:version_info_gen failed: No usable spawn strategy found for spawn with mnemonic Genrule.  Your --spawn_strategy, --genrule_strategy or --strategy flags are probably too strict. Visit https://github.com/bazelbuild/bazel/issues/7480 for migration advice
Target //tensorflow/tools/pip_package:build_pip_package failed to build

谁能帮我解释这个消息?我想弄清楚发生了什么以及如何让 TensorFlow 使用 bazel-buildfarm 进行构建。

标签: tensorflowbazelremote-executionbazel-rulesbuildfarm

解决方案


删除--spawn_strategy--genrule_strategy标志。操作将在可用时使用远程执行,否则将回退到本地或沙盒选项。听起来 genrule 需要在本地运行,但是您的标志阻止它这样做。


推荐阅读