Repository navigation
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.