Skip to main content

Derivative Informed Neural Operators in JAX and Equinox

Project description

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

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. This fixes this issue

unset LD_LIBRARY_PATH

Step 3 — Install GPU-enabled JAX

pip install "jax[cuda12]" cupy-cuda12x

JAX versions 0.6.1 and 0.6.2 have a known cuSPARSE loading bug. Version 0.6.0 is the recommended stable release for CUDA 12.

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
unset LD_LIBRARY_PATH  # or use the permanent conda hook above

pip install "jax[cuda12]==0.6.0"
pip install -e ".[dev]"

This installs:

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

Requirements

  • Python >= 3.9
  • FEniCS 2019.1 (via conda)
  • JAX >= 0.4.30 (for GPU: pip install "jax[cuda12]==0.6.0")
  • 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
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

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

dinox-0.5.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

dinox-0.5-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file dinox-0.5.tar.gz.

File metadata

  • Download URL: dinox-0.5.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.19

File hashes

Hashes for dinox-0.5.tar.gz
Algorithm Hash digest
SHA256 b382d895a7a9050259c74dff6b2b6a10a392df43b0da5f275e45e4ff11144401
MD5 2e697a1ef1df18b0202e441296757ec6
BLAKE2b-256 2289077adf59a5c68b191c0771612611ab01f07c37e3e7624e27ae89ca0f956d

See more details on using hashes here.

File details

Details for the file dinox-0.5-py3-none-any.whl.

File metadata

  • Download URL: dinox-0.5-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.19

File hashes

Hashes for dinox-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2e5fe27282d11bb506eb6f0f37f93f9d05302e360a4de90f69f407f8668e6b28
MD5 f40fe3f82b6764ee78d5423622889374
BLAKE2b-256 170331649dc63e6331bf12f7d3c4d9837b360ec9a6ff820e340d2339446fe574

See more details on using hashes here.

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