Repository navigation
Releases
v0.4.0
PDHCG v0.4.0
This release introduces a device-independent solver architecture. The core algorithm is separated from device-specific operations, with independent CPU and CUDA implementations. This also provides a foundation for adding other hardware backends.
The main changes are:
- Multiple backends in one build. CPU and CUDA can be compiled into the same library and executable. Python, C, and the CLI share the same native device selection.
- CPU support. Problems can now be solved without a GPU, using OpenMP and BLAS/LAPACK. The thread count is configurable, with automatic BLAS thread management for supported OpenBLAS and MKL builds.
- Automatic backend detection. By default, CMake builds the backends whose dependencies are available and prints the compiled devices and default.
- Improved infeasibility detection. LP, QP, and conic problems use certificate checks that account for variable bounds, cone constraints, fixed cone coordinates, and quadratic objectives.
- CPU testing in CI. Automated checks now cover native and Python interfaces, CLI behavior, and representative optimization problems.
- Reorganized documentation. Device selection, build options, threading, and distributed execution are documented together. Examples and API references have also been reviewed and corrected.
For example, build both CPU and CUDA:
cmake -S . -B build -DPDHCG_DEVICES="CPU;CUDA"
cmake --build buildChoose the backend for each Python solve:
model.setParam("Threads", 8)
model.optimize(device="cpu")
model.optimize(device="cuda")The equivalent options are params.device = "cpu" in C and --device cpu in the CLI. Use pdhcg.print_devices() or pdhcg --list-devices to see the compiled backends.
When no device is specified, the build default is used, normally preferring CUDA over CPU. CUDA initialization failures are reported as errors rather than automatically switching to CPU.
C applications need to be recompiled against the updated API. The eps_infeas_detect parameter has been removed; use eps_infeasible in C or InfeasibleTol in Python.
v0.3.1
PDHCG v0.3.1
PDHCG 0.3.1 adds an optional linearized update for non-diagonal quadratic objectives, improves parser and API reliability, and extends CUDA compatibility.
What's Changed
-
Added
innerandlinearizedmodes for non-diagonal quadratic objectives. For$H=Q+R^\top D R$ , the new optional mode uses
$x^{k+1}=\Pi_{\mathcal X}\left(x^k-\frac{Hx^k+c-A^\top y^k}{L+\tau_k^{-1}}\right).$ This also adds quadratic-aware scaling and unified spectral and nonconvexity checks for sparse, low-rank, and combined objectives. #12
-
Improved MPS parsing, centralized C and Python parameter validation, and made Python problem/result ownership exception-safe. #11
-
Added CUDA 13.3 cuSPARSE SpMVOp compatibility while preserving CUDA 13.2 and older fallback paths. Thanks to @evawyy for this contribution. #10
Downstream C/C++ applications should rebuild against v0.3.1 because pdhg_parameters_t contains the new non_diagonal_quadratic_mode field.
Full Changelog: v0.3.0.post1...v0.3.1
v0.3.0.post1
PDHCG v0.3.0.post1
Adds initial PSD cone support for variable and affine cones in the C, Python, CVXPY, and distributed interfaces.
PSD projection uses GPU eigendecomposition. Large PSD cones are not recommended; each distributed PSD block remains on one GPU.
v0.3.0
PDHCG v0.3.0
PDHCG 0.3.0 expands the solver from quadratic programming to GPU-accelerated conic quadratic programming (CQP), including distributed multi-GPU execution.
Highlights
Conic quadratic programming
PDHCG now solves convex models of the form
The following cones are supported for both variable blocks and native affine constraints:
- second-order cones (SOC);
- rotated second-order cones (RSOC);
- exponential cones;
- three-dimensional power cones.
Multi-GPU conic solver
The MPI/NCCL backend now supports conic quadratic models. This release adds:
- cone-aware row and column partitioning and permutation;
- distributed projection and KKT residual evaluation;
- cooperative projection of large SOC and RSOC blocks spanning GPUs;
- support for both variable and affine cones in distributed solves.
Build with -DPDHCG_COMPILE_DISTRIBUTED=ON and launch the executable with mpirun to use multiple GPUs.
Python and CVXPY interfaces
- Added the columnar
ConeSpecandConeTypeAPIs. - Added variable cones and native affine-cone constraints to
pdhcg.Model. - Added
Model.read_file()for MPS/QPS/CBF inputs, including gzip-compressed files. - Added an optional CVXPY backend with quadratic objectives and Zero, NonNeg, SOC, ExpCone, and PowCone3D constraints.
Install CVXPY integration with:
pip install "pdhcg[cvxpy]==0.3.0"Then register the backend once before solving:
import cvxpy as cp
import pdhcg.cvxpy_backend
problem.solve(solver="PDHCG")Cone projection, scaling, and termination
- Added specialized warp/block CUDA projection paths for cone blocks.
- Completed fixed-section projection support for variable SOC, RSOC, exponential, and power cones.
- Added cone-aware primal feasibility, stationarity, dual membership, and complementarity residuals.
- Added cone-preserving Ruiz and Pock-Chambolle scaling.
- Added optional Curtis-Reid scaling through
--curtis_reid_iter. - Improved exponential-, power-, SOC-, and RSOC-cone projection correctness.
File and command-line support
- Added CBF and compressed CBF parsing.
- Improved MPS/QPS parsing, including
QCMATRIXinput. - Added supported QCQP-to-SOCP transformations, selectable with
--soc_form rotatedor--soc_form standard. - Added command-line controls for scaling, restart behavior, and inner solves.
- Changed the default infeasibility-detection tolerance to
1e-12.
Breaking Changes
Version 0.3 changes the public model-construction APIs.
- The C function
create_qp_problem()has six new trailing arguments for variable and affine cones. Existing QP callers should append0, NULL, NULL, NULL, 0, NULL. qp_problem_tandpdhg_parameters_thave new fields. Recompile downstream code and initialize parameters withset_default_parameters().- C dual warm starts and returned dual solutions are ordered as
[dual_A, dual_F]and haverows(A) + rows(F)entries. pdhcg_postsolve()now returns nonzero only after complete primal-dual recovery.- Python cone metadata must use
ConeSpec; the legacylist[dict]format is no longer accepted.
See the 0.3 migration guide for source-level examples.
Installation
Python package:
pip install --upgrade pdhcg==0.3.0Source build:
git clone https://github.com/Lhongpei/PDHCG.git
cd PDHCG
cmake -S . -B build
cmake --build build -jPDHCG requires an NVIDIA GPU and CUDA 12.4 or newer. Distributed builds also require MPI and NCCL.
References
This release accompanies GPU-Accelerated Conic Quadratic Programming with Local Linear Convergence under Strict Complementarity.
给我加上PSD并说明这个是initial支持,且大cone不建议使用
v0.2.1
v0.2.1
What's New in v0.2.1
Generalized low-rank quadratic term. The objective now supports the form
where D is an optional rank × rank middle matrix. When omitted, D defaults to the identity and the previous version. D may be diagonal, sparse, dense, or indefinite — no PSD requirement.
Testing
test/test_lowrank_middle_D.py exercises six cases, each cross-checked against an equivalent formulation:
| Case | Reference |
|---|---|
D = I |
matches no-D baseline |
1-D diag D (PSD) |
matches folded R' = sqrt(D) R |
2-D dense D (PSD) |
matches folded R' = L^T R (Cholesky D = L L^T) |
Indefinite dense D |
matches explicit Q_eff = R^T D R |
Sparse CSR D |
matches dense D with same values |
Sparse CSR diagonal-only D |
detected as DIAG, matches 1-D path |
Compatibility
- Public ABI break:
create_qp_problemsignature changed (one extra parameter). C callers must update. - Python API: additive; existing code continues to work unchanged.
v0.2.0
PDHCG-II v0.2.0
Major release introducing multi-GPU distributed solving, cuSPARSE SpMVOp backend, and a Jacobi diagonal preconditioner for the inner subproblem.
What's New in v0.2.0
Multi-GPU Distributed Solving
Solve large-scale QPs across multiple GPUs via MPI + NCCL. Build with -DPDHCG_COMPILE_DISTRIBUTED=ON and launch with mpirun. New CLI options: --grid_size, --partition_method, --permute_method, --permute_block_size. Single- and multi-GPU code paths share the same binary, dispatched automatically by MPI world size.
Strong-scaling on large LASSO problems (solving time in seconds, tolerance 1e-6):
| Problem | 1 GPU | 2 GPUs | 4 GPUs | 8 GPUs |
|---|---|---|---|---|
| SLS | 1.96 | 1.10 | 0.56 | 0.50 |
| rcv1_test | 2.37 | 1.48 | 1.06 | 0.81 |
| avazu-site.tr | 1337.05 | 953.02 | 547.28 | 376.90 |
| avazu-app | 217.70 | 116.92 | 65.86 | 46.30 |
| avazu-site | 1642.69 | 993.62 | 765.46 | 503.99 |
| kddb2010_test | 11.59 | 11.18 | 8.79 | 7.07 |
| kdda2010_test | 9.90 | 8.50 | 6.77 | 5.61 |
| kddb2010_train | 703.36 | 466.28 | 317.69 | 233.44 |
| kdda2010_train | 341.16 | 237.19 | 167.62 | 124.89 |
cuSPARSE SpMVOp Backend
On CUDA ≥ 13.0, sparse matrix-vector multiplications switch to cusparseSpMVOp for higher throughput, with transparent fallback to the standard SpMV API on CUDA 12.x — no manual configuration needed.
Measured on the Mittelmann QP Benchmark, the new SpMVOp backend delivers an average ~1.23× speedup over the previous SpMV-based path (new : old ≈ 1 : 1.23).
Jacobi Diagonal Preconditioner
Enabled by default for the inner solver, improving convergence of subproblems on ill-conditioned QPs. Disable via CLI flag --no_diag_precond or Python parameter DiagJacobiPrecond=False.
Maros–Mészáros non-diagonal QP set (tolerance 1e-6, time limit 1000s):
| Metric | w/o Jacobi | w/ Jacobi |
|---|---|---|
| Solved | 78 / 79 | 79 / 79 |
| Arithmetic mean wall (s) | 26.006 | 10.217 |
| SGM10 wall (s) | 6.150 | 4.495 |
| SGM10 outer iterations | 6495 | 5640 |
Other Improvements
- Box-only convex QPs are supported via a dummy-variable reformulation.
- Fixed result construction when the problem reduces to an LP.
- Documentation: Python parameters table, distributed CLI examples, expanded C type reference.
Limitations
The Python wheel (pip install pdhcg) supports single-GPU solving only. For multi-GPU, build the C++ executable with -DPDHCG_COMPILE_DISTRIBUTED=ON and launch with mpirun.
v0.1.5
What's New in v0.1.5
Ecosystem Integration
qpsolversSupport: PDHCG is now supported as a backend in the qpsolvers ecosystem (v4.11.0+). You can now call it seamlessly using their standard Python API viasolve_qp(..., solver="pdhcg").
New Features & UX
- Graceful Interruption (Ctrl+C): Safely catch
Ctrl+C(SIGINT) during solving. The solver now returns the current sub-optimal solution with aUSER_INTERRUPTstatus instead of ignoring SIGINT or crashing the Python process. - Lazy CUDA Initialization: The GPU context is now initialized before the main optimization process.
Bug Fixes
- Fixed: Corrected a scaling bug causing segment error.
v0.1.4.post1
- GitHub Pages documentation site with MkDocs
- API documentation for Python (
Modelclass) - API documentation for C interface
- Installation and quick start guides
- Examples and citation info
- API documentation for Python (
- GitHub Actions workflow for automated documentation deployment
- Pre-commit hooks configuration (
.pre-commit-config.yaml)- Ruff for Python formatting/linting
- Clang-format for C/C++/CUDA formatting
- Codespell for spell checking
- Development dependencies group (
[dev])- Ruff, pre-commit, mkdocs-material, mkdocstrings
v0.1.4
What's New in v0.1.4
New Features
-
Inner Solver Control: Added parameters to control QP subproblem solving:
InnerIterLimit: Max iterations for inner solver.InnerInitTol: Initial tolerance.InnerMinTol: Minimum tolerance floor.
-
IDE Support: Added
.pyistubs for better auto-completion and type checking in Python.
Improvements
- Robustness: Added C++ backend validation to automatically correct invalid parameter settings.
- Logging:
- Added
innercolumn to iteration logs. - Improved terminal banner centering.
- Fixed non-convexity (min eigenvalue) logging logic.
- Example:
- Added
---------------------------------------------------------------------------------------------------
PDHCG-II
A GPU-Accelerated First-Order Solver for Convex QPs
(c) Hongpei Li, 2026
Contact: ishongpeili@gmail.com
---------------------------------------------------------------------------------------------------
problem: 400 rows, 688 columns, 2409 nonzeros
settings:
iter_limit : 2147483647
time_limit : 3600.00 sec
eps_opt : 1.0e-04
eps_feas : 1.0e-04
eps_infeas_detect : 1.0e-10
---------------------------------------------------------------------------------------------------
Problem Type: CONVEX_QP
Quadratic Objective Matrix Type: Sparse Q
L2 Norm of Quadratic Objective Matrix: 6.344e+00
Minimum Eigenvalue of Q: 2.389e-03
---------------------------------------------------------------------------------------------------
runtime | objective | absolute residuals | relative residuals
iter inner time | pr obj du obj | pr res du res gap | pr res du res gap
---------------------------------------------------------------------------------------------------
0 0 1.9e-03 | 0.0e+00 0.0e+00 | 0.0e+00 9.6e+01 0.0e+00 | 0.0e+00 1.2e-01 0.0e+00
10 10 2.7e-03 | 1.3e+05 5.9e+04 | 5.7e+03 4.9e+02 7.5e+04 | 5.7e-01 2.5e-01 3.9e-01
20 20 3.4e-03 | 1.6e+12 7.2e+11 | 1.9e+07 3.0e+06 9.0e+11 | 1.9e+03 1.3e-01 3.8e-01
30 30 4.2e-03 | 2.7e+19 1.2e+19 | 8.3e+10 8.3e+10 1.5e+19 | 8.3e+06 1.3e-01 3.8e-01
- CLI: Updated command-line interface to support new parameters.
v0.1.3
What's New in v0.1.3
This release introduces a more granular logging system for both the C and Python interfaces—greatly improving integration and usability—and resolves a critical compilation issue in CMake.
Features & Enhancements
- Multi-level Logging: The boolean logging flag has been upgraded to an integer-based
LogLevel(orVerbosity). You can now control the output granularity:0: Silent (No output)1: Summary (Final solver statistics)2: Detailed (Iteration-by-iteration progress)
- CLI Update: The C executable now accepts an integer argument for verbosity (e.g.,
./pdhcg -v 1 problem.mps output/). - Python API Aliases: Added
LogLevelandVerbosityas the preferred parameters in the PythonModel. Legacy parameters likeOutputFlagandLogToConsole(True/False) are still fully supported for backward compatibility (automatically mapped to1and0respectively).
Documentation
- Custom CUDA Paths: Added comprehensive instructions in the
README.mdon how to build the Python package using explicit environment variables (CUDACXXandSKBUILD_CMAKE_ARGS) when multiple CUDA versions exist on the host machine.
Fixed Bugs
- Flexible CUDA Toolchains: Removed the hardcoded
nvcccompiler path from the build configuration. This resolves CMake build issues and allows the build system to correctly detect and use the active CUDA toolkit in diverse computing environments.