Skip to main content

dinox

dinox is a JAX implementation of Reduced Basis Derivative Informed Neural Operators, built for high performance in single-GPU environments where all training data fits in GPU memory.

The library is designed primarily for PDE learning workflows based on:

  • FEniCS 2019.1
  • Jacobians computed via hippylib
  • Subspace methods provided by bayesflux

Overview

dinox provides:

  • Reduced basis neural operator architectures
  • Derivative-informed training using PDE Jacobians
  • GPU-accelerated implementations in JAX and Equinox
  • Integration with FEniCS-discretized PDEs

Getting Started

See the hyperelasticity tutorial for a complete walkthrough of the RB-DINO pipeline: problem setup, data generation, training with L2 vs H1 loss, and surrogate evaluation.

Note on tutorial: The tutorial requires access to the files in dinox/examples. Then one can open examples/DINO_Tutorial.ipynb to view the tutorial. We recommend the user perform these steps:

git clone --depth 1 --filter=blob:none --sparse https://github.com/dinoSciML/dinox.git
cd dinox
git sparse-checkout set examples

dinox and LazyDINO

dinox is central to the repo lazydino_tutorial, which implements a tutorial jupyter notebook for the methods described in the paper: LazyDINO

Coupled parameter and observation bases

Use dimension_reduction_type="coupled" to fit a parameter basis and an observation basis together. With Gaussian prior covariance $C$ and noise covariance $\Gamma$, BayesFlux alternately updates the two bases using sampled forward Jacobians in prior- and noise-whitened coordinates. Each requested pair of ranks gets its own fit. The algorithm and its information-theoretic interpretation are described by Chen, Arnaud, Baptista and Zahm.

from dinox.data_generating import generate_latent_data_for_dino_training

data = generate_latent_data_for_dino_training(
    N_trains=[64], key=7, dimension_reduction_type="coupled",
    model_obj=sampler, N_multiprocessing=0,
    input_output_dim_pairs=[(8, 3), (12, 4)],
    N_encodec_computation=100, N_test=16, N_val=16,
    save_path=data_path,
)
reduced_jacobians = data[(8, 3)]["train"]["encoded_Jacobians"]  # (64, 3, 8)

Here sampler implements the BayesFlux Gaussian sampler interface and supplies its prior and observation-noise precisions. The existing hIPPYlib workflow also accepts model_name and a positive N_multiprocessing. The usual DINO training and loading functions read the generated data from data_path / "coupled". Load encodec_dict.hkl there for the physical encoders, decoders and convergence history for each pair. Set coupled_max_iterations or coupled_tolerance to control the alternating solve.

For sample rows, the parameter and observation coordinates are x @ input_encoder and y @ output_encoder. The target derivative is output_encoder.T @ J @ input_decoder. The observation encoder whitens the projected noise, so the reduced Gaussian likelihood uses identity noise covariance. If using centered coordinates, apply the same offsets to the training samples and to new parameters and observations. In particular, a nonzero prior mean maps to prior_mean @ input_encoder in the uncentered coordinates.

Important: FEniCS & Hippylib Environment Required

dinox depends on bayesflux[hippylib], which requires:

  • hippylib
  • FEniCS 2019.1

FEniCS has system-level dependencies and cannot be installed via pip alone.

You must first create a conda environment with FEniCS 2019.1 before installing dinox.


Installation

Prerequisites

  • NVIDIA driver >= 525 (check with nvidia-smi)
  • conda or mamba

Note on CUDA libraries: You do not need to install CUDA Toolkit, cuDNN, or cuSPARSE via conda or your system package manager. The pip wheels for JAX and CuPy bundle their own CUDA 12 runtime libraries. Installing system CUDA alongside pip-bundled CUDA is the most common source of GPU detection failures.

Step 1 — Create a FEniCS 2019.1 environment

conda create -n fenics-2019.1_env -c conda-forge fenics==2019.1.0 python=3.11
conda activate fenics-2019.1_env

Step 2 — Fix LD_LIBRARY_PATH (critical for GPU)

A system-level or conda-set LD_LIBRARY_PATH pointing to a CUDA installation will conflict with the CUDA libraries bundled in the JAX and CuPy pip wheels, causing errors like Unable to load cuSPARSE.

unset LD_LIBRARY_PATH

Step 3 — Install GPU-enabled JAX

pip install "jax[cuda12]" cupy-cuda12x nvidia-curand-cu12

Step 4 — Install dinox

# With CuPy GPU support (recommended)
pip install dinox[cupy]

# Without CuPy
pip install dinox

Step 5 — Verify GPU

python -c "import jax; print('JAX devices:', jax.devices())"
python -c "import cupy; print('CuPy GPU count:', cupy.cuda.runtime.getDeviceCount())"

You should see your NVIDIA GPU listed. If JAX shows only CpuDevice, check that LD_LIBRARY_PATH is unset (see Step 2).


GPU Support

  • Designed for single-GPU workflows where all data fits in GPU memory
  • Requires CUDA 12-enabled JAX (pip install "jax[cuda12]") — the pip wheel bundles its own CUDA runtime
  • Optional CuPy arrays for GPU operations via dinox[cupy]
  • Without GPU, CPU fallback is automatic

Development

conda create -n fenics-2019.1_env -c conda-forge fenics==2019.1.0 python=3.11
conda activate fenics-2019.1_env

pip install "jax[cuda12]" cupy-cuda12x nvidia-curand-cu12
unset LD_LIBRARY_PATH  # or use the permanent conda hook above
pip install -e ".[dev]"

This installs:

  • dinox (editable)
  • development tools (pytest, black, flake8, isort)
  • bayesflux[hippylib]
  • hippylib
  • all required JAX dependencies

Requirements

  • Python >= 3.10
  • FEniCS 2019.1 (via conda)
  • JAX >= 0.7.0 (for GPU: pip install "jax[cuda12]")
  • NVIDIA driver >= 525 (for GPU)
  • Optional: CuPy for GPU array operations (pip install dinox[cupy])

Troubleshooting

Problem Solution
Unable to load cuSPARSE unset LD_LIBRARY_PATH before running Python
No such file: libcurand.so pip install nvidia-curand-cu12
JAX shows only CpuDevice Ensure jax[cuda12] was installed (not just jax) and LD_LIBRARY_PATH is unset
nvidia-smi not found Install or update NVIDIA driver (>= 525)
JAX/CuPy CUDA version conflict Do not conda install cudatoolkit — let pip wheels provide CUDA

Repository

Metadata

Release files for dinox 0.6.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 dinox 0.6.0
File Size Uploaded Provenance Actions
dinox-0.6.0.tar.gz 20.2 kB Without provenance Details for dinox-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dinox 0.6.0
File Interpreter ABI Platform Actions
dinox-0.6.0-py3-none-any.whl Python 3 none any Details for dinox-0.6.0-py3-none-any.whl

Total release size: 42.0 kB

Release files / dinox-0.6.0.tar.gz

Download URL dinox-0.6.0.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
be314e2b18a0e231d2b10cdba44230a25c22b09b5598199bdd282aaae45f9248
BLAKE2b-256 checksum
How to use checksums
0673bee8611fbcd758819221ba2481ac902f256c1e080e279412459a25129405
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / dinox-0.6.0-py3-none-any.whl

Download URL dinox-0.6.0-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b27c79ed64d58fd344e70a9227ed0caf13bdfcdce656e07a4b5259b37af7748
BLAKE2b-256 checksum
How to use checksums
d6f9b645a10aa0eaeda2995ee30e999a713c532bfc32a01fb67f85601d0f5623
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for dinox 0.6.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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