jaxDecomp: JAX Library for 3D Domain Decomposition and Parallel FFTs

jaxDecomp: JAX Library for 3D Domain Decomposition and Parallel FFTs - Published in JOSS (2026)

https://github.com/differentiableuniverseinitiative/jaxdecomp

Science Score: 92.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: acm.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

cuda hpc jax xla
Last synced: 11 days ago · JSON representation ·

Repository

JAX reimplementation and bindings for the NVIDIA cuDecomp library

Basic Info
  • Host: GitHub
  • Owner: DifferentiableUniverseInitiative
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage: https://jaxdecomp.readthedocs.io
  • Size: 53.7 MB
Statistics
  • Stars: 56
  • Watchers: 5
  • Forks: 2
  • Open Issues: 3
  • Releases: 17
Topics
cuda hpc jax xla
Created over 3 years ago · Last pushed 13 days ago
Metadata Files
Readme Changelog Contributing License Citation

README.md

jaxDecomp: JAX Library for 3D Domain Decomposition and Parallel FFTs

Build Code Formatting Tests MIT License Documentation DOI

Important Version 0.2.0 includes a pure JAX backend that no longer requires MPI. For multi-node runs, MPI and NCCL backends are still available through cuDecomp.

JAX reimplementation and bindings for NVIDIA's cuDecomp library (Romero et al. 2022), enabling multi-node parallel FFTs and halo exchanges directly in low-level NCCL/CUDA-Aware MPI from your JAX code.

Important Starting from version 0.2.8, jaxDecomp supports JAX's Shardy partitioner, which can be activated via jax.config.update('jax_use_shardy_partitioner', True). This partitioner is enabled by default in JAX 0.7.x and later versions. Shardy support is an internal implementation change and users should not expect any behavioral differences outside of what the JAX sharding mechanism provides, as explained in the JAX Shardy migration documentation.


Usage

Below is a simple code snippet illustrating how to perform a 3D FFT on a distributed 3D array, followed by a halo exchange. For demonstration purposes, we force 8 CPU devices via environment variables:

```python import os os.environ["XLAFLAGS"] = "--xlaforcehostplatformdevicecount=8" os.environ["JAXPLATFORMNAME"] = "cpu"

import jax from jax.sharding import Mesh, PartitionSpec as P, NamedSharding, AxisType import jaxdecomp

Create a 2x4 mesh of devices on CPU

pdims = (2, 4) mesh = jax.makemesh(pdims, axisnames=('x', 'y') , axis_types=(AxisType.Auto, AxisType.Auto)) sharding = NamedSharding(mesh, P('x', 'y'))

Create a random 3D array and enforce sharding

a = jax.random.normal(jax.random.PRNGKey(0), (1024, 1024, 1024)) a = jax.lax.withshardingconstraint(a, sharding)

Parallel FFTs

karray = jaxdecomp.fft.pfft3d(a) recarray = jaxdecomp.fft.pifft3d(a)

Parallel halo exchange

exchanged = jaxdecomp.haloexchange(a, haloextents=(16, 16), halo_periods=(True, True)) ```

All these functions are JIT-compatible and support automatic differentiation (with some caveats).

See also: - Basic Usage - Distributed LPT Example

Important Multi-node FFTs work with both JAX and cuDecomp backends\ For CPU with JAX, Multi-node is supported starting JAX v0.5.1 (with gloo backend)


Running on an HPC Cluster

On HPC clusters (e.g., Jean Zay, Perlmutter), you typically launch your script with: bash srun python your_script.py or bash mpirun -n 8 python your_script.py

See the Slurm README and template script for more details.


Using cuDecomp (MPI and NCCL)

For other features, compile and install with cuDecomp enabled as described in install:

```python import jaxdecomp

Optionally select communication backends (defaults to NCCL)

jaxdecomp.config.update('halocommbackend', jaxdecomp.HALOCOMMMPI) jaxdecomp.config.update('transposecommbackend', jaxdecomp.TRANSPOSECOMMMPI_A2A)

Then specify 'backend="cudecomp"' in your FFT or halo calls:

karray = jaxdecomp.fft.pfft3d(globalarray, backend='cudecomp') recarray = jaxdecomp.fft.pifft3d(karray, backend='cudecomp') exchangedarray = jaxdecomp.haloexchange( paddedarray, haloextents=(16, 16), haloperiods=(True, True), backend='cudecomp' ) ```

Install

1. Pure JAX Version (Easy / Recommended)

jaxDecomp is on PyPI:

  1. Install the appropriate JAX wheel:
    • GPU: bash pip install --upgrade "jax[cuda]"
    • CPU: bash pip install --upgrade "jax[cpu]"
  2. Install jaxdecomp: bash pip install jaxdecomp

This setup uses the pure-JAX backend—no MPI required.

2. JAX + cuDecomp Backend (Advanced)

If you need to use MPI instead of NCCL for GPU, you can build from GitHub with cuDecomp enabled. This requires the NVIDIA HPC SDK. Ensure nvc, nvc++, and nvcc are in your PATH, CUDA, MPI, and NCCL shared libraries are on LD_LIBRARY_PATH, and set CC=nvc and CXX=nvc++ before building.

bash pip install -U pip pip install git+https://github.com/DifferentiableUniverseInitiative/jaxDecomp -Ccmake.define.JD_CUDECOMP_BACKEND=ON

Alternatively, clone the repository locally and install from your checkout:

bash git clone https://github.com/DifferentiableUniverseInitiative/jaxDecomp.git --recursive cd jaxDecomp pip install -U pip pip install . -Ccmake.define.JD_CUDECOMP_BACKEND=ON

  • If CMake cannot find NVHPC, set: bash export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$NVCOMPILERS/$NVARCH/22.9/cmake and then install again.

If jax complains about incompatiliby with CuSparse or any other library, the easiest way to solve this is by installing jax localy by running pip install jax[cuda-local] and then installing jaxDecomp with cuDecomp support.


Machine-Specific Notes

IDRIS Jean Zay HPE SGI 8600 supercomputer

As of February 2026, loading modules in this exact order works:

```bash module load nvidia-compilers/25.1 cuda/12.6.3 openmpi/4.1.6-cuda nccl/2.26.2-1-cuda cudnn cmake

Install JAX

pip install --upgrade "jax[cuda-local]"

Install jaxDecomp with cuDecomp

export CMAKEPREFIXPATH=$NVHPCROOT/cmake # sometimes needed pip install git+https://github.com/DifferentiableUniverseInitiative/jaxDecomp -Ccmake.define.JDCUDECOMP_BACKEND=ON ```

Note: If using only the pure-JAX backend, you do not need NVHPC.

Important for JeanZay users Make sure to load the correct architucture module before loading the nvidia-compilers module. For example for A100 you need to load module load arch/a100 first. You also need to set the CXXFLAGS to export CXXFLAGS="-tp=zen2 -noswitcherror" if you are using the H100 or A100 partition or if you are using AMD CPUs in general. More info in Jean Zay documentation.

NERSC Perlmutter HPE Cray EX supercomputer

As of November 2022:

```bash module load PrgEnv-nvhpc python export CRAYACCELTARGET=nvidia80

Install JAX

pip install --upgrade "jax[cuda]"

Install jaxDecomp w/ cuDecomp

export CMAKEPREFIXPATH=/opt/nvidia/hpcsdk/Linuxx8664/22.5/cmake pip install git+https://github.com/DifferentiableUniverseInitiative/jaxDecomp -Ccmake.define.JDCUDECOMP_BACKEND=ON ```


Backend Configuration (cuDecomp Only)

By default, cuDecomp uses NCCL for inter-device communication. You can customize this at runtime:

```python import jaxdecomp

Choose MPI or NVSHMEM for halo and transpose ops

jaxdecomp.config.update('transposecommbackend', jaxdecomp.TRANSPOSECOMMMPIA2A) jaxdecomp.config.update('halocommbackend', jaxdecomp.HALOCOMM_MPI) ```

This can also be managed via environment variables, as described in the docs.


Autotune Computational Mesh (cuDecomp Only)

The cuDecomp library can autotune the partition layout to maximize performance:

```python automesh = jaxdecomp.autotune(shape=[512,512,512])

'automesh' is an optimized partition layout.

You can then create a JAX Sharding spec from this:

from jax.sharding import PositionalSharding sharding = PositionalSharding(automesh) ```


License: This project is licensed under the MIT License.

For more details, see the examples directory and the documentation. Contributions and issues are welcome!

Owner

  • Name: Differentiable Universe Initiative
  • Login: DifferentiableUniverseInitiative
  • Kind: organization
  • Location: Earth

JOSS Publication

jaxDecomp: JAX Library for 3D Domain Decomposition and Parallel FFTs
Published
May 16, 2026
Volume 11, Issue 121, Page 8852
Authors
Wassim Kabalan ORCID
Université Paris Cité, CNRS, Astroparticule et Cosmologie, F-75013 Paris, France
François Lanusse ORCID
Université Paris-Saclay, Université Paris Cité, CEA, CNRS, AIM, 91191, Gif-sur-Yvette, France, Flatiron Institute, Center for Computational Astrophysics, 162 5th Avenue, New York, NY 10010, USA
Alexandre Boucaud
Université Paris Cité, CNRS, Astroparticule et Cosmologie, F-75013 Paris, France
Eric Aubourg
Université Paris Cité, CNRS, Astroparticule et Cosmologie, F-75013 Paris, France
Editor
Patrick Diehl ORCID
Tags
Jax CUDA HPC FFT Simulations

Citation (CITATION.cff)

cff-version: 1.2.0
message: 'If you use this software, please cite it as below.'
type: software
title: 'jaxDecomp: JAX Library for 3D Domain Decomposition and Parallel FFTs'
doi: 10.5281/zenodo.18512020
authors:
  - family-names: "Kabalan"
    given-names: "Wassim"
    orcid: "https://orcid.org/0009-0001-6501-4564"
  - family-names: "Lanusse"
    given-names: "Francois"
    orcid: "https://orcid.org/0000-0001-7956-0542"
repository-code: 'https://github.com/DifferentiableUniverseInitiative/jaxDecomp'
url: 'https://jaxdecomp.readthedocs.io'
abstract: >-
  JAX reimplementation and bindings for NVIDIA's cuDecomp library,
  enabling multi-node parallel FFTs and halo exchanges directly in
  low-level NCCL/CUDA-Aware MPI from JAX code. jaxDecomp provides
  both a pure JAX backend for easy deployment and an optional
  cuDecomp backend for advanced MPI/NCCL communication patterns.
  All functions are JIT-compatible and support automatic differentiation.
keywords:
  - JAX
  - domain decomposition
  - parallel FFT
  - distributed computing
  - MPI
  - NCCL
  - GPU computing
  - cuDecomp
  - halo exchange
  - HPC
license: MIT
version: 0.2.9
date-released: '2025-01-01'

GitHub Events

Total
  • Release event: 14
  • Delete event: 36
  • Pull request event: 92
  • Fork event: 1
  • Issues event: 29
  • Watch event: 21
  • Issue comment event: 28
  • Push event: 157
  • Pull request review comment event: 14
  • Pull request review event: 5
  • Create event: 34
Last Year
  • Release event: 1
  • Delete event: 13
  • Pull request event: 35
  • Fork event: 1
  • Issues event: 11
  • Watch event: 8
  • Issue comment event: 10
  • Push event: 42
  • Pull request review comment event: 14
  • Pull request review event: 3
  • Create event: 10

Committers

Last synced: 2 months ago

All Time
  • Total Commits: 342
  • Total Committers: 4
  • Avg Commits per committer: 85.5
  • Development Distribution Score (DDS): 0.307
Past Year
  • Commits: 44
  • Committers: 3
  • Avg Commits per committer: 14.667
  • Development Distribution Score (DDS): 0.045
Top Committers
Name Email Commits
Wassim KABALAN w****v@g****m 237
EiffL f****l@g****m 103
Henry Schreiner h****i@g****m 1
Copilot 1****t 1

Issues and Pull Requests

Last synced: 13 days ago

All Time
  • Total issues: 22
  • Total pull requests: 123
  • Average time to close issues: 3 months
  • Average time to close pull requests: 10 days
  • Total issue authors: 7
  • Total pull request authors: 3
  • Average comments per issue: 2.32
  • Average comments per pull request: 1.23
  • Merged pull requests: 109
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 5
  • Pull requests: 27
  • Average time to close issues: about 2 months
  • Average time to close pull requests: about 1 hour
  • Issue authors: 3
  • Pull request authors: 2
  • Average comments per issue: 3.2
  • Average comments per pull request: 0.04
  • Merged pull requests: 21
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ASKabalan (9)
  • EiffL (5)
  • MoraruMaxim (3)
  • hai4john (2)
  • romerojosh (1)
  • cwoolfo1 (1)
  • dforero0896 (1)
Pull Request Authors
  • ASKabalan (107)
  • EiffL (14)
  • henryiii (2)
Top Labels
Issue Labels
bug (3) enhancement (1) notification (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 715 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 11
  • Total maintainers: 1
pypi.org: jaxdecomp

JAX bindings for the cuDecomp library

  • Homepage: https://github.com/DifferentiableUniverseInitiative/jaxDecomp
  • Documentation: https://jaxdecomp.readthedocs.io/
  • License: MIT License Copyright (c) 2022 Differentiable Universe Initiative Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.3.0
    published 4 months ago
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 715 Last month
Rankings
Dependent packages count: 10.1%
Average: 33.6%
Dependent repos count: 57.1%
Maintainers (1)
Last synced: 27 days ago

Dependencies

setup.py pypi