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.

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

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.5
File Size Uploaded Provenance Actions
modax_solvers-0.0.5.tar.gz 86.0 kB With provenance Details for modax_solvers-0.0.5.tar.gz

Built distribution (wheel)

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

Total release size: 150.1 kB

Release files / modax_solvers-0.0.5.tar.gz

Download URL modax_solvers-0.0.5.tar.gz
Size 86.0 kB
Tags Source
SHA-256 checksum
How to use checksums
574ad0042090db394549f053db10b72e231a5ff84fb87c327e71d0c449476f78
BLAKE2b-256 checksum
How to use checksums
282b8d42beba1d15014d258b05326bef47604ec131b9c0c9292155ed48032ddb
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.5-py3-none-any.whl

Download URL modax_solvers-0.0.5-py3-none-any.whl
Size 64.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d34a4f4950103b7bc4ee278fc89a1d52ec98d5e6c2d9c96259266e4fa3cacf21
BLAKE2b-256 checksum
How to use checksums
82d2206884689faee1496b054ac5445c88183a0eb8b6e2ec14af5ce15d386846
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.5

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