1

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.

esw405
  • 23
  • 3

1 Answers1

1

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.

Jin
  • 12,748
  • 3
  • 36
  • 41
  • Excellent! I tried it and it looks to be working, although my worker has 72 cores and it doesn't seem to be using hardly any. Is this something that should be set in config file -- how much parallelism a worker is allowed to use? – esw405 Feb 26 '20 at 20:58
  • Try --jobs=100. – Jin Feb 26 '20 at 21:30
  • --jobs=100 on the worker invocation or when initiating the build? – esw405 Feb 26 '20 at 21:47
  • When initiating the build. The default number of jobs may be too low to saturate the workers. – Jin Feb 26 '20 at 22:07
  • would you be able to take a look at this post I made to follow up on our discussion here? https://stackoverflow.com/questions/60439138/bazel-buildfarm-specifying-concurrency-of-worker – esw405 Feb 27 '20 at 18:15