Skip to main content

Modular Automatic Differentiation and Data-Enhanced Neural-network INteracting Graph

Project description

MADDENING

Modular Automatic Differentiation and Data-Enhanced Neural-network INteracting Graph

📖 Documentation: https://microrobotica.org/maddening/ 🧩 Part of the Microrobotics Simulation Framework (MADDENING · MIME · MICROROBOTICA).

A JAX-based modular simulation framework for multi-physics. Designed as the computational backbone of MIME (MIcrorobotics Multiphysics Engine).

Regulatory disclaimer: MADDENING is research software. It is not a medical device as defined by EU MDR (EU 2017/745) and is not intended for clinical use. When used in a regulated product, MADDENING is classified as SOUP (Software of Unknown Provenance) under IEC 62304. See docs/regulatory/ for details.

What It Does

MADDENING manages a simulation graph where each node simulates one aspect of a physical system (fluid dynamics, rigid body mechanics, heat transfer, etc.) and edges represent coupling between them. The entire graph step is JIT-compiled into a single XLA computation via JAX, making the simulation fully differentiable and GPU-accelerated.

Core capabilities:

  • Graph-based multi-physics — nodes are independent JAX programs coupled by typed edges
  • Fully differentiablejax.grad through entire coupled simulations (verified through 1000-step rollouts)
  • Iterative coupling — Gauss-Seidel and Jacobi with convergence acceleration (Aitken, IQN-ILS, IQN-IMVJ)
  • Multi-rate timestepping — each node at its own timestep, GCD-based base rate
  • Adaptive timestepping — Richardson extrapolation with PI controller
  • Neural surrogates — train MLP/DeepONet/FNO surrogates from simulation data, hot-swap into the graph
  • Cloud deployment — provision GPU VMs via SkyPilot, stream rendered viewports via WebRTC
  • Multi-job — distribute subgraphs across VMs with ZMQ-based rendezvous coordination

Package structure:

maddening/
├── core/                 # Graph manager, node ABC, edge spec, schedule
│   ├── coupling/         # Iterative coupling, convergence, acceleration, spatial mapping
│   ├── simulation/       # Adaptive dt, checkpoint, integrators, calibration, profiler
│   └── compliance/       # Metadata, stability, anomaly tracking, audit, UQ
├── nodes/                # Built-in nodes (Ball, Table, Spring, Heat, LBM, HeartPump, RigidBody)
├── surrogates/           # Neural surrogate framework (architectures, training, validation)
├── cloud/                # Cloud orchestration (SkyPilot, providers, coordinator, streaming)
│   └── multigpu/         # Device mesh, partitioning, sharded nodes, coordinator
├── viz/                  # Visualization (renderer ABC, relay, runner, backends)
├── api/                  # FastAPI server (REST + WebSocket + server-side rendering)
└── usd/                  # OpenUSD integration (graph serialization, geometry)

Installation

pip install maddening                    # CPU (base)
pip install maddening[cuda12]            # GPU with CUDA 12
pip install maddening[cuda12,viz]        # GPU + matplotlib plots
pip install maddening[server,cuda12]     # GPU simulation server
pip install maddening[runpod]            # Cloud deploy to RunPod
Extra What it adds
cuda12 / tpu GPU / TPU acceleration
viz Matplotlib renderers
terminal Rich terminal renderer
api FastAPI HTTP/WS server
network ZeroMQ remote transport
surrogates Neural surrogate training (equinox + optax)
runpod / lambda / aws / gcp Cloud deploy via SkyPilot
server Bundle: FastAPI + ZMQ + rich + matplotlib
cloud All supported cloud providers
all Everything

Works with both pip and uv. See docs/user_guide/installation.md for the full guide.

Quick Start

import jax.numpy as jnp
from maddening import GraphManager, SimulationNode

class BounceNode(SimulationNode):
    @property
    def requires_halo(self) -> bool:
        return False  # pointwise (no spatial neighbors)

    def initial_state(self):
        return {"position": jnp.array(5.0), "velocity": jnp.array(0.0)}

    def update(self, state, boundary_inputs, dt):
        new_vel = state["velocity"] + -9.81 * dt
        new_pos = state["position"] + new_vel * dt
        new_vel = jnp.where(new_pos < 0, jnp.abs(new_vel) * 0.8, new_vel)
        new_pos = jnp.maximum(new_pos, 0.0)
        return {"position": new_pos, "velocity": new_vel}

gm = GraphManager()
gm.add_node(BounceNode(name="ball", timestep=0.01))
gm.compile()
final_state, history = gm.run_scan_with_history(n_steps=500)

See docs/user_guide/quickstart.md for the full tutorial.

Cloud Deployment

Pre-built Docker image with JAX CUDA, GStreamer, and all server dependencies:

pip install maddening[runpod]
# Set up ~/.maddening/cloud_credentials.yaml (see examples/cloud/config/)
from maddening.cloud.launcher import CloudLauncher

launcher = CloudLauncher()
job = launcher.launch("job_config.yaml")  # provisions GPU VM
job.ssh_run("python3 my_simulation.py")   # run directly on GPU
job.teardown()

Docker image: ghcr.io/microrobotics-simulation-framework/maddening-cloud:latest

For MIME Developers

MADDENING is designed to be extended by MIME. See:

License

LGPL-3.0-or-later. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maddening-0.2.0.tar.gz (787.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maddening-0.2.0-py3-none-any.whl (479.3 kB view details)

Uploaded Python 3

File details

Details for the file maddening-0.2.0.tar.gz.

File metadata

  • Download URL: maddening-0.2.0.tar.gz
  • Upload date:
  • Size: 787.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for maddening-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2c8b487be9ec1d51169616ce05cb2dd31f4292e0564d8e2898c03654487d8bf5
MD5 42dfb7054751930d631a4aac216f0171
BLAKE2b-256 ad3909c40d1539c94c1aa40a578981e56192108f423c7c549242b7d5ea5f5e35

See more details on using hashes here.

Provenance

The following attestation bundles were made for maddening-0.2.0.tar.gz:

Publisher: publish.yml on Microrobotics-Simulation-Framework/MADDENING

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file maddening-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: maddening-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 479.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for maddening-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3aee604efd55676b436b48640c6e16d65d1ca1cb0f52edb43fe9f4324b86e71
MD5 f984fcfde90aed5cf8a6e533ca929f86
BLAKE2b-256 8de75603b1d4a2ea3a7276a1658025ab8088c3fadcb73117c0697651b5c08336

See more details on using hashes here.

Provenance

The following attestation bundles were made for maddening-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Microrobotics-Simulation-Framework/MADDENING

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page