Skip to main content

dendra-solvers

Differentiable implicit solvers for Dendra, with native C++ CPU kernels and Metal kernels for Apple GPUs through PyTorch's MPS device.

Installation

pip install dendra-solvers

Python 3.10+ and PyTorch 2.12+ are required. When a compatible wheel is available, installation does not require a compiler. Stable-ABI wheels work across supported Python and PyTorch versions on the same operating system and CPU architecture.

For an HPC environment or custom PyTorch build, install PyTorch first and build the extension against that installation:

python -m pip install "torch>=2.12.0" "setuptools>=77.0.3,<82" ninja wheel
MAX_JOBS=1 python -m pip install --no-build-isolation --no-cache-dir \
  --no-deps --no-binary=dendra-solvers dendra-solvers

The build uses the C++ standard selected by your installed PyTorch. Use a C++20-capable compiler for current PyTorch releases. Stable-ABI builds do not need rebuilding just because PyTorch is upgraded; see installation and clean rebuilds for wheel availability, source builds, and upgrading older installations.

Useful build options:

  • DENDRA_NATIVE=1 enables host-specific compiler optimizations. Do not use it for redistributable builds.
  • DENDRA_OMP=1 enables OpenMP when its runtime is available.
  • MAX_JOBS=1 limits compilation concurrency on memory-constrained systems.

Devices and precision

The public solve functions select their backend from the numeric tensors' device. General Thomas, PCR, 3×3 block-Thomas, scalar/block DHS trees and packed multi-morphology DHS support CPU float32/float64 and MPS float32. The owning DHS plan and physical-increment interfaces support the same devices.

MPS requires an available PyTorch MPS device and torch.mps.compile_shader. dendra_solvers.is_mps_available() checks both without compiling a shader. Kernel compilation is lazy; CPU use does not initialize the Metal library. Float64, float16/bfloat16 and the dedicated SPD/consuming APIs are currently unsupported on MPS. CPU precision and SPD behavior are unchanged.

Keep immutable topology plans on CPU and place the numeric tensors on MPS:

import torch
from dendra_solvers import DHSPlan, dhs_solve_plan, is_mps_available

if not is_mps_available():
    raise RuntimeError("An available PyTorch MPS device is required")

parent = torch.tensor([-1, 0, 0], dtype=torch.int64, device="cpu")
order = torch.tensor([1, 2, 0], dtype=torch.int64, device="cpu")
layers = torch.tensor([0, 2, 3], dtype=torch.int64, device="cpu")
plan = DHSPlan(parent, order, layers)

d_mem = torch.full(
    (2, 3), 2.0, device="mps", dtype=torch.float32, requires_grad=True
)
a_geom = torch.tensor(
    [[0.0, 0.2, 0.3]], device="mps", dtype=torch.float32
).expand_as(d_mem)
rhs = torch.ones_like(d_mem)
voltage = dhs_solve_plan(d_mem, a_geom, rhs, plan)
torch.testing.assert_close(voltage, torch.full_like(voltage, 0.5))
voltage.square().sum().backward()
torch.testing.assert_close(d_mem.grad, torch.full_like(d_mem, -0.25))

General solvers retain their reverse/forward AD, higher-order and vmap interfaces on MPS. Numeric solves execute on the GPU; topology validation and ownership remain on CPU. See solver contracts for the supported APIs and transform usage for compilation.

Testing

For a development checkout:

python -m pip install "torch>=2.12.0" "setuptools>=77.0.3,<82" ninja wheel numpy pytest
MAX_JOBS=1 python -m pip install -v --no-build-isolation --no-deps -e .
python -c "import dendra_solvers._ext as ext; print(ext.__file__)"
python -m pytest -q -ra

Solver contracts and PyTorch transform usage are documented in docs/.

See Contributing for development tools, commit conventions, and versioning.

License

dendra-solvers is licensed under the BSD 3-Clause License.

Metadata

Release files for dendra-solvers 0.5.1

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

Source distribution (sdist)

Source distribution for dendra-solvers 0.5.1
File Size Uploaded Provenance Actions
dendra_solvers-0.5.1.tar.gz 135.7 kB With provenance Details for dendra_solvers-0.5.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for dendra-solvers 0.5.1
File Actions
dendra_solvers-0.5.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for dendra_solvers-0.5.1-cp310-abi3-win_amd64.whl
dendra_solvers-0.5.1-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details for dendra_solvers-0.5.1-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
dendra_solvers-0.5.1-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64, Linux glibc 2.24+ ARM64 Details for dendra_solvers-0.5.1-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
dendra_solvers-0.5.1-cp310-abi3-macosx_14_0_arm64.whl CPython 3.10 abi3 macOS 14.0+ ARM64 Details for dendra_solvers-0.5.1-cp310-abi3-macosx_14_0_arm64.whl

Total release size: 5.2 MB

Release files / dendra_solvers-0.5.1.tar.gz

Download URL dendra_solvers-0.5.1.tar.gz
Size 135.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d5036290d9103b1e5910cbdfc89847617f3c9fd392b526d7148d85b8fdf8f6f0
BLAKE2b-256 checksum
How to use checksums
954a3e8a5d7cb0a3cdc55732509170c1d5a76cdab33aba3c993c6f7d46312ac4
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 6, 2026.

Transparency log

Release files / dendra_solvers-0.5.1-cp310-abi3-win_amd64.whl

Download URL dendra_solvers-0.5.1-cp310-abi3-win_amd64.whl
Size 357.1 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7175d0cb301ea1ca3df3f59d45c0841f1c1460b71d8e71beea811479e80791ef
BLAKE2b-256 checksum
How to use checksums
b20e650f67e52166436505c4ebec6166545eaa139b4a9b4d716a95a679ce026a
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 6, 2026.

Transparency log

Release files / dendra_solvers-0.5.1-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL dendra_solvers-0.5.1-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 2.3 MB
Tags CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
828bc6607bb90be74260c7a84475e84b89a2a5e832f9c5ecee18fc89593a0103
BLAKE2b-256 checksum
How to use checksums
b3cf1c6defeefaebd0398b60d21636ad223b65fd693a6fe4f4900824c4bf6e9f
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 6, 2026.

Transparency log

Release files / dendra_solvers-0.5.1-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL dendra_solvers-0.5.1-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
41e91b7c176fd6faabe5d4e7603cb2ba72e019a65cf03839daec143fc965aaeb
BLAKE2b-256 checksum
How to use checksums
a034358261e4dca98b96bb9fb452a67dea0ff86065d966ec17f48d4653071e1e
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 6, 2026.

Transparency log

Release files / dendra_solvers-0.5.1-cp310-abi3-macosx_14_0_arm64.whl

Download URL dendra_solvers-0.5.1-cp310-abi3-macosx_14_0_arm64.whl
Size 201.5 kB
Tags CPython 3.10 abi3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
13bff7e3c352c6d92a44b7c2453ba891a3895a734b8e23c8f5cff643e8452b60
BLAKE2b-256 checksum
How to use checksums
c7ff0b5f28fb4d892cbeb634299e80f8fcbd482aba7f23947bb738455d34cb14
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 6, 2026.

Transparency log

Security for dendra-solvers 0.5.1

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 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for dendra_solvers-0.5.1.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 6, 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