Skip to main content

modax logo

modax

tests coverage lint PyPI Downloads Python JAX arXiv 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 numpy as np
from modax.rodas5P import solve


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)

y = 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   # runs the three checks above on every commit

The documentation builds in an environment of its own, since syncing the docs group into the default one replaces the project's packages:

UV_PROJECT_ENVIRONMENT=.venv-docs uv sync --only-group docs --no-install-project
UV_PROJECT_ENVIRONMENT=.venv-docs uv run --no-sync mkdocs serve

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}, 
}

License

modax is released under the MIT License.

Metadata

Release files for modax-solvers 0.0.6

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.0.6
File Size Uploaded Provenance Actions
modax_solvers-0.0.6.tar.gz 89.0 kB With provenance Details for modax_solvers-0.0.6.tar.gz

Built distribution (wheel)

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

Total release size: 154.1 kB

Release files / modax_solvers-0.0.6.tar.gz

Download URL modax_solvers-0.0.6.tar.gz
Size 89.0 kB
Tags Source
SHA-256 checksum
How to use checksums
49cf833e69830035bc48f7e1304c99ed6ee48303e2044106f435d5ed4746a658
BLAKE2b-256 checksum
How to use checksums
ca1922edd740ace81abf06f4fde97d0fce72ab81540f631f831810abbc6fcc3f
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 5, 2026.

Transparency log

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

Download URL modax_solvers-0.0.6-py3-none-any.whl
Size 65.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e811f46fc3f7276431158fc7341627893f32bef2cb0043240ae0fe78a63311d
BLAKE2b-256 checksum
How to use checksums
e517fbc0f3c1548428663bb97d764e3fd55ef177cfe25c2cb5dab9b67b2e2d2e
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 5, 2026.

Transparency log

Security for modax-solvers 0.0.6

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.0.6.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 5, 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