Skip to main content

dinox

dinox is a JAX implementation of Reduced Basis Derivative Informed Neural Operators, with CPU and single-GPU training.

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

Changes in 0.7.0

  • Moment-based reduction uses the finite-element mass matrix with the coefficient covariance obtained from the prior precision. Input-only and paired reductions support saving and reloading training, validation and test splits.
  • Projected PDE solves accept an optional physical prior mean. Each serial rank pair draws its own samples. The parallel hIPPYlib generator reuses worker seeds across rank pairs.
  • Dataset loading reads the requested rows from memory-mapped NumPy files before transferring arrays to JAX.
  • DINO training executes the requested number of epochs, including partial validation intervals. New MLPs use the configured activation. Earlier dinox checkpoints retain the GELU activation used during their training.

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.

Installation

dinox 0.7.0 requires Python 3.11 or later, JAX 0.7.0 or later, Pydantic 2 or later, and BayesFlux 0.10.0 or later. For CPU training on existing datasets or generation with a NumPy-compatible sampler, install the package in your Python environment.

python -m pip install dinox

For hIPPYlib PDE generation, install legacy FEniCS 2019.1 and its native DOLFIN, PETSc and MPI dependencies before installing dinox. The following conda command supports Linux and macOS. The additional CUDA steps apply to NVIDIA GPU training on Linux.

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 — Optional NVIDIA GPU setup

When using pip-provided CUDA libraries, remove conflicting CUDA paths from LD_LIBRARY_PATH. Consult the JAX installation guide for supported platforms and drivers.

unset LD_LIBRARY_PATH

Step 3 — Install GPU-enabled JAX on NVIDIA systems

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

Step 4 — Install dinox

# With optional CuPy support on NVIDIA systems
pip install "dinox[cupy]"

# Without CuPy
pip install dinox

Step 5 — Verify NVIDIA GPU availability

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
pip install -e ".[dev]"

This installs:

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

Requirements

  • Python >= 3.11
  • FEniCS 2019.1 for hIPPYlib PDE generation
  • 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

For a nonzero physical prior mean, local versions support projection_center=prior_mean when generating a dataset with reduce_input_before=True. The forward model is evaluated at the affine projection through that mean. Saved input coefficients still use the original dinox convention input_encoder.T @ m.

Metadata

Release files for dinox 0.7.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.7.0
File Size Uploaded Provenance Actions
dinox-0.7.0.tar.gz 25.3 kB Without provenance Details for dinox-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 47.4 kB

Release files / dinox-0.7.0.tar.gz

Download URL dinox-0.7.0.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
df44cae9fa0d0143eba0b587270f1f1f52edc58ce1415df3c926b127c55912a6
BLAKE2b-256 checksum
How to use checksums
ca88567f66f7111ba32e1ab9be8e47c37af4b18c124e88032cba38d39d9842f3
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.7.0-py3-none-any.whl

Download URL dinox-0.7.0-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8369bff4993cb41f4fdf8f3ea1433088a8035022de823b35ef3ad427d0f5e747
BLAKE2b-256 checksum
How to use checksums
f9b438c87df0a990af253122aad843b5557ee841e78f75f5368649e191d5d9a0
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.7.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