Skip to content

Add C API support for mgpu PDLP - #1958

Draft
Bubullzz wants to merge 4 commits into
NVIDIA:mainfrom
Bubullzz:c_api_mgpu
Draft

Bubullzz wants to merge 4 commits into
NVIDIA:mainfrom
Bubullzz:c_api_mgpu

Conversation

@Bubullzz

Copy link
Copy Markdown
Contributor

Description

Issue

Checklist

  • I am familiar with the Contributing Guidelines.
  • Testing
    • New or existing tests cover these changes
    • Added tests
    • Created an issue to follow-up
    • NA
  • Documentation
    • The documentation is up to date with these changes
    • Added new documentation
    • NA

@copy-pr-bot

copy-pr-bot Bot commented Sep 21, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ramakrishnap-nv ramakrishnap-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix — the GPU-resident-to-MPS round trip is a reasonable way to reuse the existing distributed ctor. A few things before merging: no tests exercise this new branch on the 2-GPU runner, and the condition doesn't check use_distributed_pdlp independently like the MPS overload does.

Comment thread cpp/src/pdlp/solve.cu Outdated
// TODO: handle problems that don't fit on a single GPU by not loading problem in memory at the beginning.
if (!is_batch_mode &&
settings.method == method_t::PDLP &&
(settings.num_gpus == -1 || settings.num_gpus > 1)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only checks method == PDLP && (num_gpus == -1 || num_gpus > 1), but solve_lp_distributed_from_mps also honors an explicit use_distributed_pdlp = true independent of num_gpus. A caller who sets use_distributed_pdlp = true with num_gpus == 1 (allowed downstream, since the only check there is num_gpus >= 1) will silently fall through to single-GPU here instead of distributing or erroring. Might be worth mirroring the if (use_distributed_pdlp) ... else if (...) structure from the MPS overload.

Comment thread cpp/src/pdlp/solve.cu Outdated
if (!is_batch_mode &&
settings.method == method_t::PDLP &&
(settings.num_gpus == -1 || settings.num_gpus > 1)) {
auto mps = op_problem_to_mps_data_model(*gpu_prob);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation of this block doesn't match the surrounding style (looks like it wasn't run through clang-format).

Comment thread cpp/src/pdlp/solve.cu
cuopt_expects(gpu_prob != nullptr,
error_type_t::ValidationError,
"problem_interface must be either a CPU or GPU optimization problem");
// Handle multi-GPU problems

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this get a gtest exercising this specific branch (GPU-resident optimization_problem_t path, not the existing MPS-file-based pdlp_distributed_test.cu coverage) on the 2-GPU runner? Right now this conversion path is untested.

ramakrishnap-nv added a commit to ramakrishnap-nv/cuopt_public that referenced this pull request Sep 21, 2026
Solving via DataModel/Solve builds the problem directly on the GPU;
without the dispatch fix in NVIDIA#1958, use_distributed_pdlp
and distributed_pdlp_partitioner are stored but have no effect there
(MPS file based solves are unaffected). Document this until NVIDIA#1958 lands.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Bubullzz Bubullzz added feature request New feature or request non-breaking Introduces a non-breaking change labels Sep 21, 2026
@Bubullzz

Copy link
Copy Markdown
Contributor Author

/ok to test 9755ee9

@Bubullzz

Copy link
Copy Markdown
Contributor Author

/ok to test 1326b08

@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown

CI Test Summary

2 failed · 30 passed · 0 skipped

conda-cpp-tests / 13.0.3, 3.14, arm64, rockylinux8, l4, latest-driver, latest-deps — 2 failed tests
  • DefaultServerTests.DeleteQueuedJobPreventsRun
  • DefaultServerTests.DeleteRunningJobCancelsWorker
conda-cpp-tests / 12.2.2, 3.11, amd64, rockylinux8, v100, earliest-driver, oldest-deps — 2 failed tests
  • DefaultServerTests.DeleteQueuedJobPreventsRun
  • DefaultServerTests.DeleteRunningJobCancelsWorker

Comment thread cpp/src/pdlp/solve.cu
error_type_t::ValidationError,
"problem_interface must be either a CPU or GPU optimization problem");
// Handle multi-GPU problems
// TODO: handle problems that don't fit on a single GPU by not loading problem in memory at the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this makes the C API work? But only for problems that fit into memory on a single GPU?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants