Skip to content

Commit 6c0e0fb

Browse files
committed
introduce rbe env var to decide when to use rbe flags
1 parent 1767756 commit 6c0e0fb

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

.github/workflows/build_artifacts.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ jobs:
159159

160160
steps:
161161
- uses: actions/checkout@v3
162+
- name: Enable RBE on platforms where its supported
163+
run: |
164+
os=$(uname -s | awk '{print tolower($0)}')
165+
arch=$(uname -m)
166+
167+
if [[ ($os == "linux" || $os =~ "msys_nt" ) && $arch == "x86_64" ]]; then
168+
echo "JAXCI_BUILD_ARTIFACT_WITH_RBE=1" >> $GITHUB_ENV
169+
fi
162170
# Halt for testing
163171
- name: Wait For Connection
164172
uses: google-ml-infra/actions/ci_connection@main

ci/build_artifacts.sh

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ arch=$(uname -m)
4040

4141
# Adjust the values when running on Windows x86 to match the config in
4242
# .bazelrc
43-
if [[ $os =~ "msys_nt" ]] && [[ $arch == "x86_64" ]]; then
43+
if [[ $os =~ "msys_nt" && $arch == "x86_64" ]]; then
4444
os="windows"
4545
arch="amd64"
4646
fi
@@ -54,26 +54,17 @@ if [[ " ${allowed_artifacts[@]} " =~ " ${artifact} " ]]; then
5454

5555
# For bazel builds, use the "rbe_" config for Linux x86/Windows and "ci_" for other platforms
5656
bazelrc_config="${os}_${arch}"
57-
if ( [[ "$os" == "linux" ]] && [[ "$arch" == "x86_64" ]] ) || [[ "$os" == "windows" ]]; then
58-
bazelrc_config="rbe_$bazelrc_config"
57+
if [[ "$JAXCI_BUILD_ARTIFACT_WITH_RBE" == 1 ]]; then
58+
bazelrc_config="rbe_${bazelrc_config}"
5959
else
60-
bazelrc_config="ci_$bazelrc_config"
60+
bazelrc_config="ci_${bazelrc_config}"
6161
fi
6262

63-
# Build the jaxlib CPU artifact
64-
if [[ "$artifact" == "jaxlib" ]]; then
65-
python build/build.py build --wheels="jaxlib" --bazel_options=--config="$bazelrc_config" --python_version=$JAXCI_HERMETIC_PYTHON_VERSION --verbose
63+
if [[ ("$artifact" == "jax-cuda-plugin") || ("$artifact" == "jax-cuda-pjrt") ]]; then
64+
bazelrc_config="${bazelrc_config}_cuda"
6665
fi
6766

68-
# Build the jax-cuda-plugin artifact
69-
if [[ "$artifact" == "jax-cuda-plugin" ]]; then
70-
python build/build.py build --wheels="jax-cuda-plugin" --bazel_options=--config="${bazelrc_config}_cuda" --python_version=$JAXCI_HERMETIC_PYTHON_VERSION --verbose
71-
fi
72-
73-
# Build the jax-cuda-pjrt artifact
74-
if [[ "$artifact" == "jax-cuda-pjrt" ]]; then
75-
python build/build.py build --wheels="jax-cuda-pjrt" --bazel_options=--config="${bazelrc_config}_cuda" --verbose
76-
fi
67+
python build/build.py build --wheels="$artifact" --bazel_options=--config="$bazelrc_config" --python_version=$JAXCI_HERMETIC_PYTHON_VERSION --verbose
7768

7869
# If building `jaxlib` or `jax-cuda-plugin` or `jax-cuda-pjrt` for Linux, we
7970
# run `auditwheel show` to verify manylinux compliance.

ci/envs/default.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export JAXCI_XLA_COMMIT=${JAXCI_XLA_COMMIT:-}
3636
# Controls the location where the artifacts are stored.
3737
export JAXCI_OUTPUT_DIR="$(pwd)/dist"
3838

39+
# When enabled, artifacts will be built with RBE.
40+
export JAXCI_BUILD_ARTIFACT_WITH_RBE=${JAXCI_BUILD_ARTIFACT_WITH_RBE:-0}
41+
3942
# #############################################################################
4043
# Docker specific environment variables.
4144
# #############################################################################

0 commit comments

Comments
 (0)