|
6 | 6 | > directory are stable and appropriate documentation around its usage is in |
7 | 7 | > place. |
8 | 8 |
|
9 | | -******************************************************************************** |
10 | | - |
11 | | -The CI folder contains the configuration files and scripts used to build, test, |
12 | | -and upload JAX artifacts. |
13 | | - |
14 | | -## JAX's Official CI and Build/Test Scripts |
15 | | - |
16 | | -JAX's official CI jobs run the scripts in this folder. The CI scripts require |
17 | | -an env file to be set in `JAXCI_ENV_FILE` that sets various configuration settings. |
18 | | -These "env" files are structured by their build type. For e.g., |
19 | | -`ci/envs/build_artifacts/jaxlib` contains the configs for building the `jaxlib` |
20 | | -package. The scripts are intended to be used across different platforms and |
21 | | -architectures and currently supports the following systems: Linux x86, |
22 | | -Linux Arm64, Mac x86, Mac Arm64, Windows x86. |
23 | | - |
24 | | - |
25 | | -If you would like to test these scripts, follow the instructions below. |
26 | | - |
27 | | -### Choose how you would like to build: |
28 | | -<details> |
29 | | -<summary> Build CLI </summary> |
30 | | - |
31 | | -Follow the instructions below to invoke the build CLI to build a JAX artifact |
32 | | -of your choice. The CLI can build the `jaxlib`, `jax-cuda-plugin`, and the |
33 | | -`jax-cuda-pjrt` artifacts. Note that all commands are meant to be run from the |
34 | | -root of this repository. |
35 | | - |
36 | | -By default, the CLI runs in local mode and will pick the "local_" configs in |
37 | | -the `ci/.bazelrc` file. On Linux systems, Bazel defaults to using GCC |
38 | | -as the default compiler. To change this, add `--use_clang` to your command. This |
39 | | -requires Clang to be present on the system and in the path. If your Clang binary |
40 | | -is not on the path, set its path using `--clang_path`. |
41 | | - |
42 | | -**Build Modes** |
43 | | - |
44 | | -If you want to run with the configs that the CI builds use, switch the mode by |
45 | | -setting `--mode=ci`. Please note CI mode has a dependency on a custom toolchain |
46 | | -that JAX uses. The build expects this toolchain to be present on the system. As |
47 | | -such, CI mode is usually run from within a Docker container. See `JAXCI_DOCKER_IMAGE` |
48 | | -inside `ci/build_artfacts` to know which image we use for each platform. |
49 | | - |
50 | | -**RBE support** |
51 | | - |
52 | | -If you are running this on a Linux x86 or a Windows machine, you have the option |
53 | | -to use RBE to speed up the build. Please note this requires permissions to JAX's |
54 | | -remote worker pool and RBE configs. To enable RBE, set `--use_rbe` to you command. |
55 | | - |
56 | | -**Changing Python version** |
57 | | - |
58 | | -If you would like to change the Python version of the artifact, add |
59 | | -`--python_version=<python_version>` to your command. E.g. `--python_version=3.11`. |
60 | | -By default, the CLI uses Python 3.12. |
61 | | - |
62 | | -**Local XLA dependency** |
63 | | - |
64 | | -JAX artifacts built by the CLI depend on XLA version pinned in JAX's |
65 | | -`workspace.bzl`. If would like to depend on the XLA from your local system, |
66 | | -set `--local_xla_path` to its path. |
67 | | - |
68 | | -**Dry Run** |
69 | | - |
70 | | -If you would like to just invoke a dry run, add `--dry_run` to your command. |
71 | | -This will print the `bazel` command that the CLI would have ended up invoking. |
72 | | - |
73 | | -**Some example invocations** |
74 | | - |
75 | | -1. For building `jaxlib`, run `python ci/cli/build.py jaxlib` |
76 | | -2. For building `jax-cuda-plugin` for Python 3.11, run `python ci/cli/build.py jax-cuda-pjrt --python_version=3.11` |
77 | | -3. For building `jax-cuda-pjrt` for Python 3.10 with RBE, run `python ci/cli/build.py jax-cuda-pjrt --use_rbe --python_version=3.10` |
78 | | - |
79 | | -</details> |
80 | | - |
81 | | -<details> |
82 | | -<summary> Shell Script </summary> |
83 | | - |
84 | | -The artifact building script (`ci/build_artifacts.sh`) invokes the build CLI, |
85 | | -`ci/cli/build.py` which in turn invokes the bazel command that builds the |
86 | | -requested JAX artifact. Follow the instructions below to invoke the CI script |
87 | | -to build a JAX artifact of your choice. These scripts can build the `jax`, |
88 | | -`jaxlib`, `jax-cuda-plugin`, and the `jax-cuda-pjrt` artifacts. Note that all |
89 | | -commands are meant to be run from the root of this repository. |
90 | | - |
91 | | -**Docker (soft prerequisite)** |
92 | | - |
93 | | -The CI scripts are recommended to be run in Docker where possible. This ensures |
94 | | -the right build environment is set up before we can build the artifact. If you |
95 | | -would like to disable Docker, run: |
96 | | - |
97 | | -``` |
98 | | -export JAXCI_SETUP_DOCKER=0 |
99 | | -export JAXCI_CLI_BUILD_MODE=local |
100 | | -``` |
101 | | - |
102 | | -**Changing Python version** |
103 | | - |
104 | | -By default, the build will use Python 3.12. If you would like to change this, |
105 | | -set `JAXCI_HERMETIC_PYTHON_VERSION`. E.g.`export JAXCI_HERMETIC_PYTHON_VERSION=3.11` |
106 | | - |
107 | | -**RBE support** |
108 | | - |
109 | | -If you are running this on a Linux x86 or a Windows machine, you have the option |
110 | | -to use RBE to speed up the build. Please note this requires permissions to JAX's |
111 | | -remote worker pool and RBE configs. To enable RBE, run `export JAXCI_BUILD_ARTIFACT_WITH_RBE=1`. |
112 | | - |
113 | | -**How to run the script** |
114 | | - |
115 | | -``` |
116 | | -1. Set JAXCI_ENV_FILE to one of the envs inside ci/build_artifacts based the |
117 | | -artifact you want to build. |
118 | | -E.g. export JAXCI_ENV_FILE=ci/envs/build_artifacts/jaxlib |
119 | | -2. Run: bash ci/build_artifacts.sh |
120 | | -``` |
121 | | - |
122 | | -**Known Bugs** |
123 | | - |
124 | | -1. Building `jax` fails due to Python missing the `build` dependency. |
125 | | -2. Auditwheel script fails on Linux Arm64's Docker image due to Python missing |
126 | | -the `auditwheel` dependency |
127 | | -3. If RBE is used to build the target for Windows, building the wheel fails |
128 | | -due to a permission denied error. |
129 | | - |
130 | | -</details> |
| 9 | +******************************************************************************** |
0 commit comments