Skip to main content

GPU-accelerated sparse RODAS4 stiff ODE solver for QSP/PBPK population studies

Project description

nvQSP — GPU-Accelerated RODAS4 ODE Solver

GPU-accelerated RODAS4 (4th-order Rosenbrock) stiff ODE solver for Quantitative Systems Pharmacology (QSP) and PBPK population studies. Solves thousands of patient simulations per second on a single NVIDIA GPU.

Install

pip install nvqsp

No CUDA Toolkit required — only an NVIDIA driver (525+) and GPU (Ampere, Ada Lovelace, or Hopper).

Quick Start

import numpy as np
from nvqsp import sparse
from nvqsp.options import SparseOptions

# Two-compartment model: dy/dt = A0 + A1*y + A2*(y⊗y)
neq = 2
A0 = np.array([0.0, 0.0])

# First-order (linear) terms in CSR format
A1_rowptr = np.array([0, 2, 4], dtype=np.int32)
A1_col    = np.array([0, 1, 0, 1], dtype=np.int32)
A1_val    = np.array([-0.3, 0.1, 0.3, -0.1])

# Second-order terms — must have >= 1 entry; use epsilon for linear models
A2_rowptr = np.array([0, 1, 1], dtype=np.int32)
A2_col1   = np.array([0], dtype=np.int32)
A2_col2   = np.array([0], dtype=np.int32)
A2_val    = np.array([1e-30])

# Solve for 100 patients with a 100 mg dose at t=0
result = sparse.solve(
    A0=A0,
    A1_csr=(A1_rowptr, A1_col, A1_val),
    A2_csr=(A2_rowptr, A2_col1, A2_col2, A2_val),
    y0=np.tile([10.0, 0.0], (100, 1)),
    times=np.linspace(1.0, 24.0, 48),
    doses=[(0.0, 100.0)],
    opts=SparseOptions(rtol=1e-6, atol=1e-9),
)

print(result.y.shape)   # (100, 48, 2) — batch × time × state
print(result.steps)     # total ODE steps across all patients

Model Form

The solver handles polynomial ODE systems:

dy/dt = A0 + A1·y + A2·(y ⊗ y)
Term Shape Meaning
A0 (neq,) Zeroth-order (constant synthesis, zero-order infusion)
A1 (neq, neq) sparse CSR First-order (linear elimination, transfer rates)
A2 (neq, neq, neq) sparse CSR Second-order bilinear (mass-action kinetics)

Covers: linear PBPK models, first-order absorption, IV bolus/infusion, bimolecular mass-action kinetics (drug-receptor binding).

Does not cover: Michaelis-Menten elimination, Hill-function PD, TMDD with quasi-steady-state, indirect response models, DAE systems.

Key Features

  • Batch solving — 1 to 10,000+ patients in a single GPU launch
  • Automatic Jacobian — analytic from the polynomial representation
  • Adaptive step control — per-patient with configurable tolerances
  • Dosing events — bolus doses at specified times
  • Per-patient parameters — vary A0, A1, A2 values across patients
  • Fat binary — sm_80 (Ampere), sm_89 (Ada Lovelace), sm_90 (Hopper) + PTX

Solver Options

from nvqsp.options import SparseOptions

opts = SparseOptions(
    rtol            = 1e-6,    # Relative ODE tolerance
    atol            = 1e-12,   # Absolute ODE tolerance
    max_steps       = 20000,   # Maximum ODE steps per interval
    linsol_max_iters= 30,      # BiCGSTAB iteration limit
)

Requirements

  • Linux x86_64
  • NVIDIA GPU: Ampere (sm_80), Ada Lovelace (sm_89), or Hopper (sm_90)
  • NVIDIA driver 525+ (CUDA runtime 12.0+)
  • Python 3.8+, NumPy

Documentation

Full documentation, C API reference, and the Debian package are available at:

https://github.com/NVIDIA-Digital-Bio/nvQSP

License

This software is licensed under the NVIDIA Software License Agreement and the Product-Specific Terms for AI Products. By installing this software you agree to the terms of both licenses.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

nvqsp-0.1.0.post1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

File details

Details for the file nvqsp-0.1.0.post1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nvqsp-0.1.0.post1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea3d12fb1d456fd310cddf80e90909f4cb1c8eea4375518c68f5677c3f291e64
MD5 e80743c1cb9f5d42ce0adbd728dbdb6a
BLAKE2b-256 8f37a07355140c3b3e36c17132355850f16c491faad11e669248fc530f59108f

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