Skip to main content

modax logo

modax

tests coverage lint 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 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   # the checks above, and a commit-message check

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

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.1.0
File Size Uploaded Provenance Actions
modax_solvers-0.1.0.tar.gz 135.6 kB With provenance Details for modax_solvers-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 242.3 kB

Release files / modax_solvers-0.1.0.tar.gz

Download URL modax_solvers-0.1.0.tar.gz
Size 135.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1bfbf3b413c44cefab8bf07ed9eb5525e164a2a4aafb39524b86aef5fdc6c75d
BLAKE2b-256 checksum
How to use checksums
ebcf22c222f6005262615197d8ed03a2237667bb9a8c8239a6120838c3414957
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.1.0-py3-none-any.whl

Download URL modax_solvers-0.1.0-py3-none-any.whl
Size 106.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b033a63a302da337b4a9a2fbb671b427bf35d0dc08ef33c7151d4b87c8dd621c
BLAKE2b-256 checksum
How to use checksums
6b7d4e5dbc2e9827dd3dc6048f9e127ca57332625e2a08f3442d33f6dace7d36
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.1.0

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