Skip to main content

modax logo

modax

tests coverage lint types PyPI Downloads Python JAX arXiv Conventional Commits License: MIT

Installation • Quickstart • Documentation • Paper • Citation

modax is a library of GPU-accelerated ODE solvers optimised for solving massive ensembles (1k-100k) of low-dimensional (<200D) ODE trajectories, built on JAX and Numba-CUDA-MLIR. Applications include: Bayesian parameter estimation, uncertainty quantification and the integration of physically uncoupled systems.

Every solver is compiled as a custom CUDA kernel using Numba-CUDA-MLIR. Each ODE trajectory is solved within its own CUDA thread and results are exposed to JAX as an XLA FFI custom call. Calls to modax therefore behave as ordinary JAX primitives. They are jit-traceable, auto-differentiable and a vmap over a single solve lowers to one native ensemble launch.

The documentation covers the solver API and explains how to use the library. The paper details the technical implementation, example applications and performance benchmarks against other GPU-accelerated ODE libraries in Julia and Python.

Installation

pip install "modax-solvers[cuda13]"   # or [cuda12]; Python 3.10 needs cuda12

There is no system library to install first: every dependency ships wheels, the AMD ordering included. A GPU is needed to run a solve. The Enzyme-derived Jacobians come from numba-enzyme-cuda, the CUDA-enabled fork of numba-enzyme, which carries its own LLVM 15 and Enzyme binaries and provides the numba_enzyme import package, so upstream numba-enzyme must not be installed alongside it. See wheels/README.md for what is in the wheel and why.

Any GPU of compute capability 7.0 or later runs it. On Blackwell (10.0 and up) the kernels and their Enzyme derivatives are compiled for sm_90, the newest target whose LLVM dialect Enzyme's LLVM 15 toolchain reads, and linked for the GPU itself; NUMBA_ENZYME_CUDA_CC overrides that target.

Quickstart

This example demonstrates a stiff decay chain A → B → C, solved for 1000 rate constants at once, with a declared sparsity pattern (i.e. which inputs affect which outputs):

import jax.numpy as jnp
import modax
import numpy as np


def ode_fn(y, t, p):  # tuples of scalars in and out
    return -p[0] * y[0], p[0] * y[0] - p[1] * y[1], p[1] * y[1]


sparsity = np.array([[1, 0, 0], [1, 1, 0], [0, 1, 1]], dtype=bool)
params = jnp.stack([jnp.logspace(0, 4, 1000), jnp.ones(1000)], axis=1)
y0 = jnp.array([1.0, 0.0, 0.0])
t_span = jnp.linspace(0.0, 10.0, 11)

# Rodas5P, the default method, suits a stiff system
y = modax.solve(ode_fn, y0, t_span, params, sparsity=sparsity)  # (1000, 11, 3)

Development

The repository uses uv:

git clone https://github.com/lawrenceberry/modax.git && cd modax
uv sync                 # CPU
uv sync --extra cuda13  # or --extra cuda12, for GPU

uv run pytest tests     # most tests skip themselves without a GPU
uv run ruff format && uv run ruff check --fix
uv run ty check
uv run pre-commit install   # the checks above, and a commit-message check

The documentation (Sphinx with MyST and autodoc) builds in an environment of its own, the package's CPU install plus the docs group:

export UV_PROJECT_ENVIRONMENT=.venv-docs
uv sync --no-default-groups --group docs
uv run --no-sync sphinx-autobuild docs docs/_build/html   # live preview
uv run --no-sync sphinx-build -W docs docs/_build/html    # what CI runs

Citation

If you use modax in your research, please cite the arXiv article:

@misc{berry2026acceleratingmassiveensemblesordinary,
      title={Accelerating massive ensembles of ordinary differential equations}, 
      author={Lawrence Berry and Will Handley and Oliver Hahn and Nils Schöneberg},
      year={2026},
      eprint={2609.35661},
      archivePrefix={arXiv},
      primaryClass={astro-ph.IM},
      url={https://arxiv.org/abs/2609.35661}, 
}

The authors of modax thank the open-source developers of JAX, Numba-CUDA-MLIR, diffrax, torchdiffeq and DiffEqGPU.jl, whose work provided both a foundational reference and points of comparison for this new library.

License

modax is released under the MIT License.

Metadata

Release files for modax-solvers 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modax-solvers 0.2.1
File Size Uploaded Provenance Actions
modax_solvers-0.2.1.tar.gz 136.7 kB With provenance Details for modax_solvers-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for modax-solvers 0.2.1
File Interpreter ABI Platform Actions
modax_solvers-0.2.1-py3-none-any.whl Python 3 none any Details for modax_solvers-0.2.1-py3-none-any.whl

Total release size: 243.4 kB

Release files / modax_solvers-0.2.1.tar.gz

Download URL modax_solvers-0.2.1.tar.gz
Size 136.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ed6599e7485d79c9eb5bec816f710dda0eb71a1c93792eab6fbb484da02cd9d9
BLAKE2b-256 checksum
How to use checksums
1028a8edc26b0303c06ecd5c029ed58c7928f90152f1bb1aa86826c7f439dcad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / modax_solvers-0.2.1-py3-none-any.whl

Download URL modax_solvers-0.2.1-py3-none-any.whl
Size 106.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3972cfd68c3ba44e67e910f86efc2429429ff94ae560d4bb6b26c65ef53ee63
BLAKE2b-256 checksum
How to use checksums
3410608d711112eebe9c9c390db85ca26fc6b556789c2db5752da91f08c61752
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for modax-solvers 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for modax_solvers-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page