WorksAgricultural and Biological Sciences
gpuGEM: GPU-based linear optimisation of genome-scale metabolic models
Abstract
Summary: Genome-scale metabolic models increasingly challenge CPU linear-programming solvers in repeated optimisation. We present gpuGEM, an open-source Python library for GPU-based optimisation using NVIDIA cuOpt, with size-adaptive settings validated against HiGHS and Gurobi. Across ten models spanning four orders of magnitude, gpuGEM achieved 1.1x to 94x speed-ups over the faster HiGHS method (dual simplex or interior point), and outperformed Gurobi on three models (1.6x to 2.5x). In candidate-gene prioritisation, gpuGEM reduced end-to-end query time from 41 s to 21 s. Availability and Implementation: gpuGEM is released under the MIT licence at https://github.com/Digital-Metabolic-Twin-Centre/gpuGEM and on PyPI (pip install gpugem); release v0.1.3 is archived at https://zenodo.org/records/23422813. It requires an NVIDIA GPU of compute capability 7.0 or newer (Volta onward), Python 3.11 or later, CUDA 12 and cuOpt 26.6 or later. Contact: [email protected] Supplementary information: Supplementary data are available as an ancillary file on arXiv.
† These authors contributed equally to this work.
Introduction
Genome-scale metabolic models (GEMs) link genes, reactions, metabolites, and constraints from cells to whole organisms [6, 17]. Flux balance analysis (FBA) predicts feasible fluxes by solving a linear programme under steady-state mass balance [16]. Gene-deletion screens, flux variability analysis, model personalisation, and cohort studies require hundreds to thousands of related solves, making solver runtime an important determinant of computational feasibility. On our benchmark workstation, a single FBA solve of the Harvey whole-body model (81,094 reactions, 103,600 coupling constraints) takes 33 s with HiGHS, making repeated optimisation costly.
Standard FBA relies on CPU linear programming solvers. As genome-scale modelling extends into metabolic digital twins and human health applications, reproducibility and auditability become increasingly important, strengthening the case for an openly available solver stack. HiGHS [9] provides an open-source CPU alternative. Meanwhile, advances in artificial intelligence have accelerated investment and innovation in GPU computing. First-order optimisation methods avoid repeated matrix factorisations and rely heavily on sparse matrix-vector operations, making them well suited to GPU execution. Extending genome-scale metabolic modelling to GPUs therefore offers an opportunity to benefit from continued advances in GPU hardware and software. NVIDIA cuOpt provides GPU implementations of large-scale linear programming methods, including PDLP, a restarted primal-dual hybrid gradient method [1, 13] (Lu and Yang 2023). The field has moved quickly since: cuPDLPx reports further gains over cuPDLP-C [14] (Lu and Yang 2025), and first-order GPU modes now ship in HiGHS and in Gurobi 13 [10, 7]. The contribution here is therefore not the solver itself but its integration into a constraint-based modelling workflow, together with the size-adaptive settings and validation that make it usable on genome-scale and whole-body models. Prior GPU work in constraint-based modelling has addressed flux sampling [4] and parallel pathway analysis [3], rather than GPU solving of GEM-derived linear programmes. To our knowledge, no previous study has systematically evaluated and validated GPU-based linear programming for GEMs at whole-body and personalised microbiome scale. The central question is therefore whether GEM-derived linear programmes can converge reliably on GPUs while reproducing CPU-solver results. GEM-derived linear programmes are typically degenerate and may be ill-conditioned when coefficient and bound magnitudes span several orders of magnitude, so numerical error risks altering feasibility and biological interpretation.
Implementation and benchmarking
Library design and solver interface
gpuGEM is a Python library built on NumPy and SciPy sparse arrays that formulates FBA as a linear programme and dispatches it to the PDLP solver in NVIDIA cuOpt [1, 15]. The core entry point solves
where is the stoichiometric matrix, the right-hand side, and are the lower and upper flux bounds, the objective vector, and is the optional coupling-constraint matrix with lower and upper bounds and . The problem is assembled in the cuOpt data model, solved on the GPU, and returned as a result object containing the objective value, flux vector, termination status, feasibility residuals, and solve time. A COBRApy [5] adapter converts a model to this representation in one call, while COBRA Toolbox [8] models can be exported to the same arrays.
Validated size-adaptive default settings
Default cuOpt settings failed to converge or exceeded the predefined feasibility criterion on several benchmark models. gpuGEM therefore applies size-adaptive settings at a threshold of reactions. Both regimes solve in double precision. Smaller models set cuOpt’s double-precision mode explicitly and use primal and dual tolerances, per-constraint convergence and default presolve. Larger models leave precision at cuOpt’s default, which also resolves to double, and use PaPILO presolve with default tolerances. Settings were selected through systematic parameter sweeps (Supplementary Methods, gpuGEM / cuOpt configuration; Table S4).
Benchmarking
We benchmarked ten representative models spanning 95 to 1.18 million variables: E. coli core, iML1515, Harvey, Harvetta [18] and six personalised microbiome-whole-body models (PMM1 to PMM6). All ten models are plotted in Figure 1a to Figure 1c. Benchmarks used an Intel Core i9-10900X CPU, 128 GB RAM and NVIDIA RTX A4500 GPU. gpuGEM used cuOpt 26.6.0, with HiGHS 1.14.0 [9] and Gurobi 13.0.2 [7] as CPU references. Gurobi barrier was used as the commercial reference, and reported times are medians of three repeats of single cold solves; full protocols are provided in Supplementary Methods (Hardware and software environment, Validation protocol, Timing protocol).
Figure 1. gpuGEM performance envelope, numerical correctness and runtime stability. (a) Median solve time against LP size for gpuGEM, HiGHS and Gurobi barrier on log-log axes. The dotted line marks variables; open triangles mark HiGHS interior-point runs that returned an incorrect status. (b) Speed-up relative to HiGHS and Gurobi; the horizontal line marks equal runtime, with values above it indicating that gpuGEM is faster. (c) Maximum stoichiometric residual across all ten models for Gurobi, gpuGEM with its shipped defaults (per-constraint residual checking on), and gpuGEM with cuOpt’s default of per-constraint residual checking off. The shaded region denotes the feasibility acceptance criterion. (d) Normalised solve time across a 50-objective panel on PMM1, calculated relative to each solver’s mean. Solve times are medians of three repeats; per-model values are given in Supplementary Tables S2, S3, S7 and S8.
Results
gpuGEM reproduces CPU results across four orders of magnitude
Across the ten benchmark models, gpuGEM returned an optimal, feasible solution for every model. On eight of these ten models (Harvey, Harvetta and the six personalised microbiome models) the objective reaction is pinned by its own bounds [18], so every solver that returns a feasible point reports the same objective value; agreement there is a consistency check rather than a measure of accuracy. On the two models whose objective is genuinely optimised, E. coli core and iML1515, gpuGEM agreed with Gurobi and HiGHS to within relative difference. The accuracy claim on the remaining models therefore rests on the feasibility residuals, which remained below the predefined acceptance criterion (Supplementary Tables S2 and S3). All three solvers therefore satisfied the validation criteria, allowing performance comparisons to focus on runtime.
gpuGEM outperforms HiGHS on large models
Against the open-source CPU solver HiGHS, gpuGEM was faster on every model above variables. On Harvey the speed-up was against HiGHS’s default dual simplex and against whichever of its dual simplex and interior-point methods is faster on that model; on Harvetta it was and , and on the personalised microbiome models 6.1× to 94× and 1.1× to 94× (Figure 1a,Figure 1b). HiGHS interior point failed on PMM2 to PMM4 (Supplementary Table S8).
gpuGEM has a bounded performance advantage over Gurobi
Against commercial Gurobi, gpuGEM showed a bounded performance advantage rather than one that increased with model size (Figure 1b). gpuGEM was faster on three of ten benchmark models: the Harvey and Harvetta whole-body models, by 1.7× and 2.5×, respectively, and the smallest personalised microbiome model, with 686,000 variables, by 1.6×. This defines an observed performance window from approximately to variables. Below this range, Gurobi was more than two orders of magnitude faster on E. coli core and iML1515. This difference coincided with PDLP requiring 820× and 4,785× more iterations than Gurobi barrier, respectively. Above the observed window, Gurobi was three to ten times faster on the remaining five microbiome models (Supplementary Table S3).
Runtime follows problem geometry through PDLP iteration count
gpuGEM runtime tracked PDLP iteration count, which first-order theory ties to the geometry of the LP (its sharpness) rather than to its size [2, 19]. Across the ten benchmark models, log runtime correlated more strongly with log iteration count (r = 0.97) than with log model size (r = 0.84), while PMM6 solved 213 s faster than the smaller PMM3 with 331,800 fewer iterations (Supplementary Figure S4).
Relaxing residual checking sacrifices feasibility
The largest apparent speed-ups arose from configurations that did not enforce per-constraint feasibility. Disabling per-constraint residual checking made the tested microbiome-scale model solve up to 72× faster, but returned 372,156 mass-balance violations (rows with residual above the criterion) and a maximum residual of , exceeding the predefined feasibility criterion by several orders of magnitude (Figure 1c). The relaxed configuration exceeded this criterion on all five displayed models above variables and on neither of the two smaller models. Of seventeen configurations screened on a microbiome-scale model, the four that satisfied the validation criteria were no faster than gpuGEM’s shipped default (Supplementary Table S4).
Runtime is insensitive to the choice of objective on microbiome-scale models
To assess sensitivity to biological objective, we repeated solves across panels of distinct objective functions. On PMM1, runtime varied less across 50 objectives for gpuGEM than for Gurobi barrier (CV 1.3% versus 6.0%; Figure 1d). Across all six microbiome models gpuGEM runtime varied by at most 12.9% across the objective panel (CV 0.1% to 12.9%), comparable to Gurobi barrier (2.8% to 9.0%), and gpuGEM gave the lower coefficient of variation on four of the six. The panel median was within 3% of the primary-objective solve time on every microbiome model, so the timings reported here are representative of the panel rather than specific to one objective. Extended objective panels across the remaining models are provided in Supplementary Figure S3 and Table S7.
Application: GPU-accelerated candidate-gene prioritisation
Candidate-gene prioritisation from patient biomarkers is a useful setting for accelerated optimisation because the same large whole-body model may be queried repeatedly as a patient’s biomarker profile is refined or alternatives are considered. To examine this use case, we integrated gpuGEM into an inherited-metabolic-disease candidate-gene prioritisation workflow based on the Harvey whole-body model and translated from a COBRA Toolbox implementation [8]. The workflow constrains the model according to measured blood-biomarker directions and solves two optimisation problems per query: a linear programme maximising the biomarker-demand objective, followed by a minimum-norm quadratic programme selecting a unique solution on the optimal face. Knockout signatures are precomputed using one aggregated linear programme per disease gene, reducing the required solve count from hundreds of thousands to hundreds. A single query required 41 s using the CPU workflow, including 24.2 s for the linear-programming step. Replacing this step with gpuGEM reduced its runtime to 2.7 s and total query time to 21 s, while the quadratic programme remained on the CPU. Only the linear programme is offloaded here, so the quadratic programme becomes the dominant cost once the linear step is accelerated, and the end-to-end speed-up is correspondingly smaller than the speed-up of the linear step alone. cUOpt’s barrier method does support convex quadratic programmes; moving this step to the GPU was not attempted in this work and is left as future work. In all three biomarker queries the causal gene ranked first under both the Gurobi and the gpuGEM LP engines. The two rankings were strongly concordant over the full shared candidate list (Spearman’s = 0.970, 0.980 and 0.982), and the ten top-ranked genes agreed on 9, 9 and 10 of 10 (Supplementary Table S10). This experiment demonstrates workflow integration and computational acceleration rather than diagnostic performance.
Funding
This study was funded by grants from the European Research Council (ERC) under the European Union’s Horizon Europe research and innovation programme (grant agreement #101125633) to IT, the Science Foundation Ireland under Grant number 12/RC/2273/P2, and the Horizon Europe grant Recon4IMD (#101080997). This work was further supported by the Swiss State Secretariat for Education, Research and Innovation, SERI (grant 23.00232), and UK Research and Innovation, UKRI (grants 10083717 and 10080153).
Conflict of interest
None declared.
Data availability
The genome-scale metabolic models used in this study are publicly available from the sources cited in the article, Zenodo and GitHub. The software, benchmarking code and data underlying the results are archived at Zenodo at https://zenodo.org/records/23422813.
References
- [1]David Applegate, Mateo Díaz, Oliver Hinder, Haihao Lu, Miles Lubin, Brendan O’Donoghue, and Warren Schudy. Practical large-scale linear programming using primal-dual hybrid gradient. In Advances in Neural Information Processing Systems, volume 34, pages 20243–20257, 2021.arxiv.org/abs/2106.04756
- [2]David Applegate, Oliver Hinder, Haihao Lu, and Miles Lubin. Faster first-order primal-dual methods for linear programming using restarts and sharpness. Mathematical Programming, 201:133–184, 2023. doi: 10.1007/s10107-022-01901-9.DOI
- [3]Mona Arabzadeh, Mehdi Sedighi, Morteza Saheb Zamani, and Sayed-Amir Marashi. A system architecture for parallel analysis of flux-balanced metabolic pathways. Computational Biology and Chemistry, 88:107309, October 2020. doi: 10.1016/j.compbiolchem.2020.107309.DOI
- [4]Marouen Ben Guebila. ACHR.cu: GPU Accelerated Sampling of Metabolic Networks. May 2019.DOI
- [5]Ali Ebrahim, Joshua A Lerman, Bernhard O Palsson, and Daniel R Hyduke. COBRApy: COnstraints-Based Reconstruction and Analysis for Python. BMC Systems Biology, 7(1):74, August 2013. doi: 10.1186/1752-0509-7-74.DOI
- [6]Changdai Gu, Gi Bae Kim, Won Jun Kim, Hyun Uk Kim, and Sang Yup Lee. Current status and applications of genome-scale metabolic models. Genome Biology, 20(1):121, June 2019. doi: 10.1186/s13059-019-1730-3.DOI
- [7]Gurobi Optimization, LLC. Gurobi Optimizer Reference Manual, Version 13.0. https://www.gurobi.com/documentation/, 2025. Version 13.0 released 18 November 2025; includes the first-order method PDHG with GPU support (Method = 6, PDHGPGU = 1).
- [8]Laurent Heirendt, Sylvain Arreckx, Thomas Pfau, Sebastián N. Mendoza, Anne Richelle, Almut Heinken, Hulda S. Haraldsdóttir, Jacek Wachowiak, Sarah M. Keating, Vanja Vlasov, Stefania Magnusdóttir, Chiam Yu Ng, German Preciat, Alise Žagare, Siu H. J. Chan, Maike K. Aurich, Catherine M. Clancy, Jennifer Modamio, John T. Sauls, Alberto Noronha, Aarash Bordbar, Benjamin Cousins, Diana C. El Assal, Luis V. Valcarcel, Iñigo Apaolaza, Susan Ghaderi, Masoud Ahoonkhosh, Marouen Ben Guebila, Andrejs Kostromins, Nicolas Sompairac, Hoai M. Le, Ding Ma, Yukeai Sun, Lin Wang, James T. Yurkovich, Miguel A. P. Oliveira, Phan T. Vuong, Lemmer P. El Assal, Inna Kuperstein, Andrej Zinovyev, H. Scott Hinton, William A. Bryant, Francisco J. Aragón Artacho, Francisco J. Planes, Egils Stalidzans, Alejandro Maass, Santosh Vempala, Michael Hucka, Michael A. Saunders, Costas D. Maranas, Nathan E. Lewis, Thomas Sauter, Bernhard Ø. Palsson, Ines Thiele, and Ronan M. T. Fleming. Creation and analysis of biochemical constraint-based models using the COBRA Toolbox v.3.0. Nature Protocols, 14(3):639–702, March 2019. doi: 10.1038/s41596-018-0098-2.
- [9]Q. Huangfu and J. A. J. Hall. Parallelizing the dual revised simplex method. Mathematical Programming Computation, 10(1):119–142, March 2017. doi: 10.1007/s12532-017-0130-5.DOI
- [10]Qi Huangfu, Julian A. J. Hall, and HiGHS Developers. HiGHS: Linear Optimization Software – PDLP and Interior Point Solvers. https://ergo-code.github.io/HiGHS/, 2025. Software library, version 1.14.0; GPU PDLP available from v1.10.0.
- [13]Haihao Lu, Jinwen Yang, Haodong Hu, Qi Huangfu, Jinsong Liu, Tianhao Liu, Yinyu Ye, Chuwen Zhang, and Dongdong Ge. cuPDLP-C: A Strengthened Implementation of cuPDLP for Linear Programming, 2023.arxiv.org/abs/2312.14832
- [14]Haihao Lu, Zedong Peng, and Jinwen Yang. cuPDLPx: A Further Enhanced GPU-Based First-Order Solver for Linear Programming, 2025.arxiv.org/abs/2507.14051
- [15]NVIDIA Corporation. NVIDIA cuOpt: GPU-Accelerated Optimization. https://developer.nvidia.com/cuopt, 2025. Software library, version 26.6.
- [16]Jeffrey D Orth, Ines Thiele, and Bernhard Ø Palsson. What is flux balance analysis? Nature Biotechnology, 28 (3):245–248, March 2010. doi: 10.1038/nbt.1614.DOI
- [17]Ines Thiele and Bernhard Ø Palsson. A protocol for generating a high-quality genome-scale metabolic reconstruction. Nature Protocols, 5(1):93–121, January 2010. doi: 10.1038/nprot.2009.203.DOI
- [18]Ines Thiele, Swagatika Sahoo, Almut Heinken, Johannes Hertel, Laurent Heirendt, Maike K. Aurich, and Ronan MT Fleming. Personalized whole-body models integrate metabolism, physiology, and the gut microbiome. Molecular Systems Biology, 16(5):MSB198982, May 2020. doi: 10.15252/msb.20198982.DOI
- [19]Zikai Xiong and Robert M. Freund. Computational guarantees for restarted PDHG for LP based on “limiting error ratios” and LP sharpness. arXiv:2312.14774, 2023.DOI
