From e4615b20d54391ee3aa8f9cc0f65aba67b23de19 Mon Sep 17 00:00:00 2001 From: Matt Hurd Date: Mon, 10 Feb 2025 12:58:23 -0800 Subject: [PATCH] Add .bazelrc configs to allow for internal remote caching PiperOrigin-RevId: 725317788 --- .bazelrc | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.bazelrc b/.bazelrc index d494829ae..18a43cfba 100644 --- a/.bazelrc +++ b/.bazelrc @@ -33,3 +33,59 @@ build:windows --linkopt=/OPT:REF build:windows --host_linkopt=/OPT:REF build:windows --linkopt=/OPT:ICF build:windows --host_linkopt=/OPT:ICF + +# ############################################################################# +# RBE config options below. These inherit the CI configs above and set the +# remote execution backend and authentication options required to run builds +# with RBE. Linux x86 and Windows builds use RBE. +# Based off of https://github.com/tensorflow/tensorflow/blob/master/.bazelrc +# ############################################################################# + +# Allow creation of resultstore URLs for any bazel invocation +build:resultstore --google_default_credentials +build:resultstore --bes_backend=buildeventservice.googleapis.com +build:resultstore --bes_instance_name="tensorflow-testing" +build:resultstore --bes_results_url="https://source.cloud.google.com/results/invocations" +build:resultstore --bes_timeout=600s + +build:avx_linux --copt=-mavx +build:avx_linux --host_copt=-mavx + +# Flag to enable remote config +common --experimental_repo_remote_exec + +# Make Bazel not try to probe the host system for a C++ toolchain. +build:rbe_base --config=resultstore +build:rbe_base --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 +build:rbe_base --define=EXECUTOR=remote +build:rbe_base --jobs=800 +build:rbe_base --remote_executor=grpcs://remotebuildexecution.googleapis.com +build:rbe_base --remote_timeout=3600 +build:rbe_base --spawn_strategy=remote,worker,standalone,local +# Attempt to minimize the amount of data transfer between bazel and the remote +# workers: +build:rbe_base --remote_download_toplevel +test:rbe_base --test_env=USER=anon + +build:rbe_linux --config=rbe_base +build:rbe_linux --action_env=PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" +# Non-rbe settings we should include because we do not run configure +build:rbe_linux --config=avx_linux +build:rbe_linux --linkopt=-lrt +build:rbe_linux --host_linkopt=-lrt +build:rbe_linux --linkopt=-lm +build:rbe_linux --host_linkopt=-lm + +build:rbe_linux_cpu --config=rbe_linux +# Linux cpu and cuda builds share the same toolchain now. +build:rbe_linux_cpu --host_crosstool_top="@local_config_cuda//crosstool:toolchain" +build:rbe_linux_cpu --crosstool_top="@local_config_cuda//crosstool:toolchain" +build:rbe_linux_cpu --extra_toolchains="@local_config_cuda//crosstool:toolchain-linux-x86_64" +build:rbe_linux_cpu --repo_env=CC="/usr/lib/llvm-18/bin/clang" +build:rbe_linux_cpu --repo_env=TF_SYSROOT="/dt9" +build:rbe_linux_cpu --extra_execution_platforms="@ml_build_config_platform//:platform" +build:rbe_linux_cpu --host_platform="@ml_build_config_platform//:platform" +build:rbe_linux_cpu --platforms="@ml_build_config_platform//:platform" +# Python config is the same across all containers because the binary is the same +build:rbe_linux_cpu --python_path="/usr/bin/python3" +common:rbe_linux_cpu --remote_instance_name=projects/tensorflow-testing/instances/default_instance