Building from source¤
The native backend is built with CMake against the public FFI headers shipped
with jaxlib. It borrows XLA's NCCL communicator through the Collectives C
extension.
Requirements¤
- Linux on
x86_64oraarch64; - Docker OR
- Python 3.12 or later;
- a CUDA 12.9 or CUDA 13 development toolkit, including
nvcc; - CMake 3.26 or later, Ninja, Git, and a C++17 compiler;
- the matching cuSOLVERMp and NCCL development headers and libraries.
CMake fetches a pinned Abseil release for internal status handling.
Build the backend¤
Docker¤
The backend can be built inside NVIDIA's CUDA development images, the same
images CI uses for the release wheels, so no local CUDA toolkit is needed. Run
the command from the root of the JAXMg repository. It writes the backend into
src/jaxmg/cu12/ or src/jaxmg/cu13/ in your checkout; the Python environment
and the CMake build tree stay inside the container. No GPU is needed.
CUDA 12:
docker run --rm -v "$PWD":/jaxmg -w /jaxmg \
nvidia/cuda:12.9.1-devel-rockylinux8 bash -euc '
dnf install -y git python3.12
python3.12 -m venv /opt/venv
source /opt/venv/bin/activate
pip install cmake ninja "jax==0.11.2" \
"nvidia-cusolvermp-cu12==0.10.0.27368" "nvidia-nccl-cu12==2.32.6"
JAXMG_BUILD_DIR=/tmp/build ./build_native_backend.sh
'
CUDA 13:
docker run --rm -v "$PWD":/jaxmg -w /jaxmg \
nvidia/cuda:13.0.2-devel-rockylinux8 bash -euc '
dnf install -y git python3.12
python3.12 -m venv /opt/venv
source /opt/venv/bin/activate
pip install cmake ninja "jax==0.11.2" \
"nvidia-cusolvermp-cu13==0.10.0.27368" "nvidia-nccl-cu13==2.32.6"
JAXMG_BUILD_DIR=/tmp/build ./build_native_backend.sh
'
Custom¤
From the JAXMg repository, prepare a Python environment and install the
minimum supported FFI headers and the dependencies for your CUDA version.
Point CUDA_HOME at a matching CUDA toolkit; if it is unset, the script uses CUDA_ROOT and then /usr/local/cuda.
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install cmake ninja 'jax==0.11.2' \
'nvidia-cusolvermp-cu12==0.10.0.27368' 'nvidia-nccl-cu12==2.32.6'
CUDA_HOME=/path/to/cuda-12.9 ./build_native_backend.sh
For CUDA 13:
python -m pip install cmake ninja 'jax==0.11.2' \
'nvidia-cusolvermp-cu13==0.10.0.27368' 'nvidia-nccl-cu13==2.32.6'
CUDA_HOME=/path/to/cuda-13 ./build_native_backend.sh
src/jaxmg/cu12/libjaxmg_xla_comm_backend.so or the corresponding cu13
directory.
CUDA architectures¤
The default build includes the following supported GPU architectures and PTX for forward compatibility:
CUDA 12
sm_70,sm_80,sm_90,sm_120,compute_90
CUDA 13
sm_80,sm_90,sm_120,compute_90
JAXMG_CUDA_ARCHITECTURES='90' JAXMG_BUILD_JOBS=8 ./build_native_backend.sh
In the Docker commands, set these variables on the ./build_native_backend.sh line instead.
Package and test¤
Install the source checkout after building the backend:
python -m pip install -e '.[cuda12]'
The cache and FFI contract tests use fake library calls and run without a GPU:
JAXMG_RUN_NATIVE_TESTS=ON ./build_native_backend.sh
Numerical validation still requires GPUs. GitHub Actions builds both CUDA backends and packages them into one Python-independent wheel per architecture; Jenkins tests the same x86_64 wheel with the supported JAX runtimes. See CONTRIBUTING.md for the test and release workflows.