Skip to content

Commit be77781

Browse files
committed
change how ci mode flags are parsed
1 parent 22f0c0c commit be77781

File tree

3 files changed

+18
-41
lines changed

3 files changed

+18
-41
lines changed

build/build.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def add_build_cuda_with_clang_argument(parser: argparse.ArgumentParser):
110110
action="store_true",
111111
help="""
112112
Should CUDA code be compiled using Clang? The default behavior is to
113-
compile CUDA with NVCC. Ignored if --ci_mode is set, we always build
113+
compile CUDA with NVCC. Ignored if --use_ci_bazelrc_flags is set, we always build
114114
CUDA with NVCC in CI builds.
115115
""",
116116
)
@@ -203,20 +203,11 @@ def add_global_arguments(parser: argparse.ArgumentParser):
203203
def add_artifact_subcommand_global_arguments(parser: argparse.ArgumentParser):
204204
"""Adds all the global arguments that applies to the artifact subcommands."""
205205
parser.add_argument(
206-
"--ci_mode",
206+
"--use_ci_bazelrc_flags",
207207
action="store_true",
208208
help="""
209209
When set, the CLI will assume the build is being run in CI or CI like
210-
environment and will use the "ci_" configs in the .bazelrc.
211-
""",
212-
)
213-
214-
parser.add_argument(
215-
"--request_rbe",
216-
action="store_true",
217-
help="""
218-
If set, the build will try to use RBE if it is supported for the
219-
platform. Requires --ci_mode to be set.
210+
environment and will use the "rbe_/ci_" configs in the .bazelrc.
220211
""",
221212
)
222213

@@ -261,7 +252,7 @@ def add_artifact_subcommand_global_arguments(parser: argparse.ArgumentParser):
261252
type=str,
262253
default="",
263254
help="""
264-
Path to the Clang binary to use. Ignored if --ci_mode is set as we use
255+
Path to the Clang binary to use. Ignored if --use_ci_bazelrc_flags is set as we use
265256
a custom Clang toolchain in that case.
266257
""",
267258
)
@@ -440,16 +431,12 @@ async def main():
440431
wheel_cpus[args.target_cpu] if args.target_cpu is not None else arch
441432
)
442433

443-
# If running in CI mode, we use the "ci_"/"rbe_" configs in the .bazelrc.
434+
# If running in CI, we use the "ci_"/"rbe_" configs in the .bazelrc.
444435
# These set a custom C++ Clang toolchain and the CUDA compiler to NVCC
445-
# When not running in CI mode, we detect the path to Clang binary and pass it
436+
# When not running in CI, we detect the path to Clang binary and pass it
446437
# to Bazel to use as the C++ compiler. NVCC is used as the CUDA compiler
447438
# unless the user explicitly sets --config=build_cuda_with_clang.
448-
if args.ci_mode:
449-
logging.debug(
450-
"Running in CI mode. Run the CLI with --help for more details on what"
451-
" this means."
452-
)
439+
if args.use_ci_bazelrc_flags:
453440
bazelrc_config = utils.get_bazelrc_config(
454441
os_name, arch, args.command, args.request_rbe
455442
)

build/tools/utils.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def get_cuda_major_version():
203203
return None
204204

205205

206-
def get_bazelrc_config(os_name: str, arch: str, artifact: str, request_rbe: bool):
206+
def get_ci_bazelrc_config(os_name: str, arch: str, artifact: str):
207207
"""Returns the bazelrc config for the given architecture and OS.
208208
209209
Used in CI builds to retrieve either the "ci_"/"rbe_" configs from the
@@ -212,23 +212,13 @@ def get_bazelrc_config(os_name: str, arch: str, artifact: str, request_rbe: bool
212212

213213
bazelrc_config = f"{os_name}_{arch}"
214214

215-
# If a build is requesting RBE, the CLI will use RBE if the host system supports
216-
# it, otherwise it will use the "ci_" (non RBE) config.
217-
if request_rbe:
218-
if (os_name == "linux" and arch == "x86_64") or (
219-
os_name == "windows" and arch == "amd64"
220-
):
221-
bazelrc_config = "rbe_" + bazelrc_config
222-
else:
223-
logger.warning(
224-
"RBE is not supported on %s_%s. Using the non RBE, ci_%s_%s, config"
225-
" instead.",
226-
os_name,
227-
arch,
228-
os_name,
229-
arch,
230-
)
231-
bazelrc_config = "ci_" + bazelrc_config
215+
# If building on Linux x86 or Windows, use the "rbe_" flags otherwise use
216+
# the "ci_" (non-rbe) flags
217+
if (os_name == "linux" and arch == "x86_64") or (
218+
os_name == "windows" and arch == "amd64"
219+
):
220+
221+
bazelrc_config = "rbe_" + bazelrc_config
232222
else:
233223
bazelrc_config = "ci_" + bazelrc_config
234224

ci/build_artifacts.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ fi
2525

2626
# Build the jaxlib CPU artifact
2727
if [[ "$JAXCI_BUILD_JAXLIB" == 1 ]]; then
28-
python build/build.py jaxlib --ci_mode --request_rbe --python_version=$JAXCI_HERMETIC_PYTHON_VERSION --verbose
28+
python build/build.py jaxlib --use_ci_bazelrc_flags --python_version=$JAXCI_HERMETIC_PYTHON_VERSION --verbose
2929
fi
3030

3131
# Build the jax-cuda-plugin artifact
3232
if [[ "$JAXCI_BUILD_PLUGIN" == 1 ]]; then
33-
python build/build.py jax-cuda-plugin --ci_mode --request_rbe --python_version=$JAXCI_HERMETIC_PYTHON_VERSION --verbose
33+
python build/build.py jax-cuda-plugin --use_ci_bazelrc_flags --python_version=$JAXCI_HERMETIC_PYTHON_VERSION --verbose
3434
fi
3535

3636
# Build the jax-cuda-pjrt artifact
3737
if [[ "$JAXCI_BUILD_PJRT" == 1 ]]; then
38-
python build/build.py jax-cuda-pjrt --ci_mode --request_rbe --verbose
38+
python build/build.py jax-cuda-pjrt --use_ci_bazelrc_flags --verbose
3939
fi
4040

4141
# After building `jaxlib`, `jaxcuda-plugin`, and `jax-cuda-pjrt`, we run

0 commit comments

Comments
 (0)