Skip to main content

cuPIQP

Institution Funding License

CuPIQP is a GPU-accelerated convex Quadratic Programming (QP) solver implementing the PIQP (Proximal Interior Point Quadratic Programming) algorithm entirely on NVIDIA GPUs. Its core strength is solving large batches of small-to-medium QPs in a single GPU launch, and the solution is differentiable with respect to the problem data. It also scales to large-scale sparse and dense QPs, in the same class as GPU solvers such as cuClarabel, cuOpt, and QOCO-GPU.

cuPIQP is Warp-native: the solver is written in Warp, and every input, internal buffer and result is a warp.array. It drops straight into Warp code, for example a MuJoCo Warp simulation step, and a solve can be recorded into the same CUDA graph as the rest of your GPU pipeline.

Problem Formulation

cuPIQP solves convex QPs of the form:

$$ \begin{aligned} \min_{x} \quad & \tfrac{1}{2} x^\top P x + c^\top x \ \text{s.t.} \quad & A x = b \ & h_l \leq G x \leq h_u \ & x_l \leq x \leq x_u \end{aligned} $$

where $P \succeq 0$ is positive semidefinite, $x \in \mathbb{R}^n$ is the decision variable, $A \in \mathbb{R}^{p \times n}$ defines equality constraints, and $G \in \mathbb{R}^{m \times n}$ defines two-sided inequality constraints. Any bound may be $\pm\infty$ and is handled without numerical penalty.

Features

  • Warp-native — the solver kernels are written in Warp, and every result (solution, status, residuals) is a warp.array at a fixed address that your own Warp kernels read directly, without host round trips. Inputs can be any GPU array: warp.array, CuPy, CUDA PyTorch tensors, JAX arrays, ... are viewed zero-copy through the CUDA Array Interface or DLPack.
  • Native batched solving — solve $B$ independent QPs in parallel from a single solver instance by stacking inputs along a leading batch axis; the inner kernels operate on (B, …) tensors with no Python-side loop. Built for sampling-based control, RL rollouts, and parameter sweeps.
  • Differentiable — efficient computation of the VJPs via implicit differentiation by reusing the condensed factor from the forward solve (solver.backward()). For PyTorch, cupiqp.torch provides DenseSolverLayer, SparseSolverLayer and MultistageSolverLayer, differentiable torch.nn.Module layers that plug into autograd.
  • JAX-compatible — cupiqp.jax.DenseSolver, SparseSolver and MultistageSolver solve QPs as pure JAX functions, under jax.jit and jax.vmap (one native batched solve, no loop); differentiable with jax.grad; see the JAX interface guide.
  • Scales to large QPs — the same solver handles large sparse and dense QPs, competing with GPU solvers such as cuClarabel, cuOpt, and QOCO-GPU.
  • Fully GPU-resident, asynchronous solver — all iterations, KKT factorizations, and linear algebra run on the GPU, and the GPU itself decides when each problem has converged. solve() queues the work and returns without waiting.
  • CUDA Graph capture — the whole solve runs as one CUDA graph with near-zero kernel-launch overhead. You can also record update() and solve() into your own CUDA graph, next to your own Warp work, even inside your own wp.capture_while loop (sparse backend not supported yet).
  • Versatile problem types — supports general dense and sparse QPs, as well as multistage optimization problems like optimal control problems (OCPs).

Installation

Requirements

  • Python 3.10 or later.
  • Linux with an NVIDIA GPU and a working CUDA driver/runtime stack.
  • CUDA Python packages compatible with the installed CUDA stack. This repository defines extras for CUDA 12.x and CUDA 13.x, which pull in the matching NVIDIA runtime libraries (cuBLAS, cuSOLVER, cuSPARSE, cuDSS) through nvmath-python.

Install cuPIQP from PyPI with the extra matching the CUDA version reported by nvidia-smi:

python -m pip install "cupiqp[cuda12]"  # for a CUDA 12.x driver/runtime
# or:
python -m pip install "cupiqp[cuda13]"  # for a CUDA 13.x driver/runtime

Add the torch extra for the differentiable PyTorch layers, e.g. python -m pip install "cupiqp[cuda12,torch]", or the jax extra for the JAX interface (then install a CUDA build of JAX, e.g. python -m pip install "jax[cuda12]"). If the NVIDIA runtime libraries matching your CUDA version are already installed, python -m pip install cupiqp is enough.

To install the latest development version from source instead:

git clone https://github.com/PREDICT-EPFL/cupiqp.git
cd cupiqp
python -m pip install ".[cuda12]"  # or ".[cuda13]"

Verifying the install

import numpy as np
import warp as wp
from cupiqp import DenseSolver, Status

P = wp.array(np.eye(3), dtype=wp.float64, device="cuda")
c = wp.array(np.ones(3), dtype=wp.float64, device="cuda")

solver = DenseSolver()
solver.setup(P=P, c=c)
solver.solve()                                   # asynchronous: queues the solve

x = solver.result.x                              # warp.array (B, n) on the GPU
status = solver.result.info.status.numpy()       # .numpy() waits for the solve
assert status[0] == Status.CUPIQP_SOLVED
print(x.numpy())                                 # [[-1. -1. -1.]]

Runtime dependencies (for reference)

Installed automatically with cuPIQP; the CUDA extras add the matching NVIDIA runtime libraries:

  • Warp — the solver's arrays and JIT-compiled CUDA kernels.
  • nvmath-python — cuBLAS / cuSOLVER / cuSPARSE / cuDSS bindings and CUDA runtime packages via the selected CUDA extra.
  • SciPy — sparse backend only, to build the KKT sparsity pattern once at setup().
  • NVTX — profiling annotations.
  • socu — required by the MultistageSolver as the linear system solver.

Quick Start

Refer to this simple example to get started. For the PyTorch layers, see this minimal example.

Comparison with PIQP

CuPIQP implements the same Proximal Interior Point algorithm as PIQP, targeting large-scale QPs on NVIDIA GPUs:

PIQP (CPU) CuPIQP (GPU)
Language C++ (with C / Python / Matlab / Julia / Rust bindings) Python (Warp-native)
Execution CPU (multi-threaded via OpenMP) Fully GPU-resident (CUDA)
Batched solving Designed for single solves Designed for batched solves with massive parallelism
Differentiable No Yes, via implicit differentiation

Citing

If you use cuPIQP in academic work, please cite the underlying PIQP algorithm paper and this implementation. A BibTeX entry will be provided once a cuPIQP-specific publication is available.

License

BSD-2-Clause. See LICENSE.

Metadata

Release files for cupiqp 0.1.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 cupiqp 0.1.0
File Size Uploaded Provenance Actions
cupiqp-0.1.0.tar.gz 205.0 kB With provenance Details for cupiqp-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 441.4 kB

Release files / cupiqp-0.1.0.tar.gz

Download URL cupiqp-0.1.0.tar.gz
Size 205.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d4feb6487a20d6d3fbfa49b21c409e3e40139c061234667bc53126a23229f72f
BLAKE2b-256 checksum
How to use checksums
a299c02b9ffc65039506764ca108748484a2ab1f9e39da2b72787d8e6b783a8a
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 Oct 26, 2026.

Transparency log

Release files / cupiqp-0.1.0-py3-none-any.whl

Download URL cupiqp-0.1.0-py3-none-any.whl
Size 236.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
762a005c36b828d7c81deb31983c72b7b33b3c5fde6a68a8852347092d704a67
BLAKE2b-256 checksum
How to use checksums
90c2b825f7ae8bb90597c9141da41be795db859c872a8d12ff3457585a9e5247
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 Oct 26, 2026.

Transparency log

Security for cupiqp 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cupiqp-0.1.0.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 Oct 26, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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