A C implementation of the Halpern Peaceman--Rachford (HPR) method for solving linear programming (LP) problems on GPUs.
- NVIDIA GPU with CUDA support
- CUDA Toolkit (version 12.4 or later recommended)
- cuBLAS, cuSOLVER, cuSPARSE libraries (included with CUDA Toolkit)
The build system creates libraries and executables:
make clean # Remove build artifacts
make # Build everything (recommended)This creates:
lib/libhprlp.a- Static library for C/C++ linkinglib/libhprlp.so- Shared library for language bindings (Python, Julia, MATLAB)build/solve_mps_file- MPS file solver executable
# Show help
./build/solve_mps_file -h
# Run with default settings
./build/solve_mps_file -i data/model.mps
# Run with custom settings
./build/solve_mps_file -i data/model.mps --tol 1e-4 --time-limit 3600See the examples/ directory for standalone demos showing how to link against libhprlp.a and solve LP problems programmatically.
See examples/c(cpp)/README.md for details on using HPR-LP-C in external projects.
| Option | Description | Default |
|---|---|---|
-i, --input <path> |
Path to input MPS file | required |
--device <id> |
CUDA device ID | 0 |
--max-iter <N> |
Maximum iterations | unlimited |
--tol <eps> |
Stopping tolerance | 1e-4 |
--time-limit <sec> |
Time limit in seconds | 3600 |
--check-iter <N> |
Convergence check interval | 150 |
--ruiz <true/false> |
Ruiz scaling | true |
--pock <true/false> |
Pock-Chambolle scaling | true |
--bc <true/false> |
Bounds/cost scaling | true |
-h, --help |
Show help message | - |
Python (pip only):
cd HPR-LP-C/bindings/python
python -m pip install . # or: python -m pip install -e .Julia Interface:
cd bindings/julia
bash install.shMATLAB Interface:
cd bindings/matlab
bash install.shSee the respective README files in bindings/ for detailed usage instructions.
HPR-LP-C provides native interfaces for multiple languages:
- Python: Native Python bindings via pybind11 (see
bindings/python/README.md) - MATLAB: Native MEX interface with OOP wrapper (see
bindings/matlab/README.md) - Julia: Native Julia interface (see
bindings/julia/README.md) - C/C++: Direct API usage (see
examples/c/andexamples/cpp/)
MIT License
Copyright (c) 2025 HPR-LP Contributors
See the LICENSE file for full details.
Kaihuang Chen, Defeng Sun, Yancheng Yuan, Guojun Zhang, and Xinyuan Zhao, “HPR-LP: An implementation of an HPR method for solving linear programming”, arXiv:2408.12179 (August 2024), Mathematical Programming Computation 17:4 (2025), doi.org/10.1007/s12532-025-00292-0.
- Kaihuang Chen - Developer
- ZheXuan Gu - Developer
- Defeng Sun - Principal Investigator
- Yancheng Yuan - Contributor
- Guojun Zhang - Contributor
- Xinyuan Zhao - Contributor
- Community contributors and testers
For questions, issues, or collaboration inquiries:
- Open an issue on GitHub: https://github.com/PolyU-IOR/HPR-LP-C/issues
Current version: 0.1.0
For the C implementation on GPUs, please visit the following repository:
https://github.com/PolyU-IOR/HPR-LP-C
For the Julia implementation on CPUs and GPUs, please visit the following repository:
https://github.com/PolyU-IOR/HPR-LP
For the Python implementation on GPUs, please visit the following repository:
https://github.com/PolyU-IOR/HPR-LP-Python
For the MATLAB implementation on CPUs, please visit the following repository: