Skip to main content

diff-soup: differentiable, sparse-oriented unified PDE suite

License: BSD 3-Clause Docs arXiv

diff-soup is a software package written in JAX for modeling, simulation, and inference of (stiff) dynamical systems governed by ODEs, DAEs, and PDEs.

For modeling:

  • a Recipe API that states equations in math-like notation on structured and unstructured domains;
  • finite difference, finite volume and finite element discretizations;
  • sparse Jacobians assembled by automatic differentiation with graph coloring.

For simulation:

  • three variable-step, variable-order stiff integrators written in JAX, JNDF, JBDF and JIDA, for ODEs and DAEs up to index one;
  • sparse direct solves with NVIDIA cuDSS on the GPU, and KLU or dense solves on the CPU;
  • forward and reverse mode differentiation of every solve, to second order;
  • batched solves, with data and model parallelism across GPUs and cluster nodes.

For inference:

  • parameter estimation using least squares estimation, maximum likelihood estimation (MLE), and maximum a posteriori (MAP) estimation;
  • physically-constrained deep learning using differentiable simulation, with neural networks embedded inside the physical model.

The three modules of diff-soup

The modeling, simulation and inference modules of diff-soup, and the JAX and GPU features they are built on.

Installation

pip install "diff-soup[cu13]"   # CUDA 13, driver 580 or newer
pip install "diff-soup[cu12]"   # CUDA 12, driver 525 or newer
pip install diff-soup           # CPU only

Requires Linux on x86_64 or ARM (aarch64) and Python 3.12 or 3.13. The GPU backend needs an NVIDIA GPU of compute capability 8.0 or newer.

Turn on JAX's 64-bit mode with jax.config.update("jax_enable_x64", True) before building a problem.

Building from source is covered on the installation page.

Documentation

Available at https://stmorgenstern.github.io/diff-soup/.

Quick example

The two-dimensional Brusselator, a stiff reaction-diffusion system, on a 32 by 32 finite-volume grid with its walls held at the reaction steady state:

import diff_soup as ds
import jax
import jax.numpy as jnp

jax.config.update("jax_enable_x64", True)

n = 32
A, B, alpha = 1.0, 3.0, 1.0 / 50.0

spec = ds.problem("brusselator")
spec.domain("square", ds.domains.cartesian_grid_2d(n, n, 1.0, 1.0, method="fvm"))
spec.field("u", mass="differential",
           init=lambda x, y: A + jnp.sin(2 * jnp.pi * x) * jnp.sin(2 * jnp.pi * y))
spec.field("v", mass="differential", init=lambda x, y: jnp.full_like(x, B / A))

@spec.equations(writes=("u", "v"), reads=("u", "v"))
def brusselator(q):
    uuv = q.u**2 * q.v
    du = A + uuv - (B + 1.0) * q.u + alpha * q.ops.laplacian(q.u)
    dv = B * q.u - uuv + alpha * q.ops.laplacian(q.v)
    return {"u": du, "v": dv}

i, j = jnp.indices((n, n))
wall = ((i == 0) | (i == n - 1) | (j == 0) | (j == n - 1)).ravel()
spec.bc.dirichlet("u", on=wall, value=A)
spec.bc.dirichlet("v", on=wall, value=B / A)

problem = spec.build()
y0 = spec.assemble_state({})

sol = ds.pdesolve(problem, ds.JIDA(), (0.0, 10.0), y0)
u_end = sol.ys[-1][: n * n]
print(float(u_end.mean()))   # the average of u over the square at t = 10

The Brusselator solution

u and v of the same model on a 128 by 128 grid, from t = 0 to t = 10.

Acknowledgments

diff-soup builds on the following projects.

Time stepping
SUNDIALS: IDA and CVODE, whose step-size, error-weight and solver-reuse rules the integrators follow (Hindmarsh et al. 2005).
OrdinaryDiffEq.jl: the QNDF method the NDF integrator follows (Rackauckas and Nie 2017).
SciPy: BDF dense output and the bounded least-squares trust region.

Sparse direct solvers
SuiteSparse KLU: the CPU sparse LU (Davis and Palamadai Natarajan 2010).
SuperLU_MT: the threaded CPU sparse LU (Li 2005).
NVIDIA cuDSS: the GPU sparse direct solver.

JAX ecosystem
JAX: the array library and compiler diff-soup is written in.
Equinox: modules and PyTree tools.
Diffrax: the interfaces for saving output and events, which diff-soup mirrors.
jaxtyping: shape and dtype annotations.
Optax: first-order optimisers for the embedded neural networks.
BlackJAX: posterior sampling.

diff-soup is released under the BSD 3-Clause License, see LICENSE. Third-party licences and notices are listed in THIRD_PARTY_NOTICES.md.

Citation

If you use diff-soup, please cite the paper, arXiv:2610.37333.

@article{degnanmorgenstern2026diffsoup,
    title={diff-soup: {GPU}-native Differentiable Simulation and Inference for Large-scale Stiff Dynamical Systems},
    author={Samuel Degnan-Morgenstern and Martin Z. Bazant},
    journal={arXiv preprint arXiv:2610.37333},
    year={2026},
}

Metadata

Release files for diff-soup 1.2.0

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

Built distributions (wheels)

Table of built distributions (wheels) for diff-soup 1.2.0
File Actions
diff_soup-1.2.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.26+ x86-64 Details for diff_soup-1.2.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
diff_soup-1.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details for diff_soup-1.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
diff_soup-1.2.0-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.26+ x86-64 Details for diff_soup-1.2.0-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
diff_soup-1.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64, Linux glibc 2.17+ ARM64 Details for diff_soup-1.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Total release size: 35.7 MB

Release files / diff_soup-1.2.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL diff_soup-1.2.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 11.3 MB
Tags CPython 3.13 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9b637f75abd88af0b19baf8ee6b3e8581f6c4b5e5b55b55ddd21fcb156835ec6
BLAKE2b-256 checksum
How to use checksums
a4e77163a46ddddc0337afb0d740c692a1b2dc4bdb7da2467007b64c5ccd85c8
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 / diff_soup-1.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL diff_soup-1.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 6.5 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
e14ed41939d45bea36fc54b45d742c075239de2258f6bf86eb586331b4ed906d
BLAKE2b-256 checksum
How to use checksums
5fe8f6bab2355fe0483ec7f665d755855fb69d56417865c76f17e0e307e47861
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 / diff_soup-1.2.0-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL diff_soup-1.2.0-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 11.3 MB
Tags CPython 3.12 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6424668e14e53cd8082f4e8ef351eb18120603d792fee7974bb263a80e7fb867
BLAKE2b-256 checksum
How to use checksums
1816aede74cc4036ea0a4dd95f44308cac0d4a0593c99e4c800f9d87a36b342d
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 / diff_soup-1.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL diff_soup-1.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 6.5 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
2723424b45d9a7d93f26bb6b5f286615efde860676635c34222327ab0e478145
BLAKE2b-256 checksum
How to use checksums
3099930921220a85590a729667ec5532c003c84d9dbabd62335877284bac2e7f
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 diff-soup 1.2.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

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for diff_soup-1.2.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

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