Search code examples
tensorflowbazelremote-executionbazel-rulesbuildfarm

Building TensorFlow with bazel-buildfarm


I'm trying to build TensorFlow from-source using remote execution+caching with bazel-buildfarm. I have setup a bazel-buildfarm server and worker using example configuration files @ https://github.com/bazelbuild/bazel-buildfarm (see examples/ directory).

I added the following rules to .bazelrc inside the source repo for TensorFlow (head of master):

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

Then I ran ./configure using options which I know succeed for local, non-remote build.

I started the TensorFlow build:

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

Shortly thereafter I get this error message:

...
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

Can anyone help me interpret this message? I'd like to figure out what is going on and how I can get TensorFlow to build using bazel-buildfarm.


Solution

  • Remove the --spawn_strategy and --genrule_strategy flags. Actions will use remote execution whenever available, and fallback to local or sandboxed options otherwise. It sounds like the genrule needs to run locally, but your flags are preventing it from doing so.