Skip to content

build(cmake): stop compiling routing/mathopt sources twice - #1960

Merged
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
ramakrishnap-nv:build-eliminate-duplicate-routing-mathopt-compile
Sep 21, 2026
Merged

rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
ramakrishnap-nv:build-eliminate-duplicate-routing-mathopt-compile

Conversation

@ramakrishnap-nv

@ramakrishnap-nv ramakrishnap-nv commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

cuopt_routing and cuopt_mathopt were compiled directly from source, while cuopt_objs separately recompiled the same files a second time just to feed cuopt_static. Gives routing/mathopt the same OBJECT-library treatment cuopt_client already uses, so each domain compiles once and cuopt_static links the objects instead of rebuilding them. Removes cuopt_objs.

Also fixes an ordering bug this touched: CUDSS_MT_LIB_FILE_NAME was recomputed after cuopt_mathopt's compile definitions had already captured the stale value.

Verified locally: full build succeeds, ninja target count drops 631 → 350.

Verified in CI (conda-cpp-build / 13.3.0, amd64): 631 → 474 targets, 0 errors, 0 failed distributed compilations.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/cuopt/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e925bec6-d83a-4222-acf2-4f5f8ac4b595

📥 Commits

Reviewing files that changed from the base of the PR and between 8a25c92 and f9c346d.

📒 Files selected for processing (1)
  • cpp/CMakeLists.txt

Included review availability: Your plan provides up to 12 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

CMake now builds routing and mathopt through hidden-visibility object libraries. Shared targets receive their dependencies during assembly. Static builds embed the component objects directly.

Changes

Component build restructuring

Layer / File(s) Summary
Object library and routing setup
cpp/CMakeLists.txt
CMake documents visibility for component object libraries. It adds optional cuDSS threading-layer construction and builds cuopt_routing from cuopt_routing_objs with routing settings and dependencies.
Mathopt and static target assembly
cpp/CMakeLists.txt
CMake moves mathopt settings and KaMinPar requirements to cuopt_mathopt_objs, links PSLP, Highway, and KaMinPar on cuopt_mathopt, and embeds component objects in cuopt_static.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: preventing routing and mathopt sources from being compiled twice in the CMake build.
Description check ✅ Passed The description directly explains the build-graph changes, the removal of duplicate compilation, the CUDSS_MT_LIB_FILE_NAME ordering fix, and verification results.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

cuopt_routing and cuopt_mathopt were built directly from source, while
cuopt_objs separately recompiled the same files (CUOPT_ROUTING_SRC_FILES +
CUOPT_MATHOPT_SRC_FILES) to feed cuopt_static. Give routing and mathopt
the same OBJECT-library treatment cuopt_client already has
(cuopt_routing_objs / cuopt_mathopt_objs), compiled once and reused by
both the shared component library and cuopt_static. Removes cuopt_objs.

Also fixes an ordering bug: CUDSS_MT_LIB_FILE_NAME was recomputed
(basename -> full path, NVIDIA#1883) after cuopt_mathopt's own
target_compile_definitions had already captured the stale value.

Verified locally: full build succeeds, ninja target count drops
631 -> 350.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ramakrishnap-nv
ramakrishnap-nv force-pushed the build-eliminate-duplicate-routing-mathopt-compile branch from 8a25c92 to f9c346d Compare September 21, 2026 17:14
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

CI Test Summary

✅ All 32 test job(s) passed.

@ramakrishnap-nv ramakrishnap-nv self-assigned this Sep 21, 2026
@ramakrishnap-nv ramakrishnap-nv added non-breaking Introduces a non-breaking change improvement Improves an existing functionality labels Sep 21, 2026
@ramakrishnap-nv

Copy link
Copy Markdown
Collaborator Author

/merge

@rapids-bot
rapids-bot Bot merged commit ee016db into NVIDIA:main Sep 21, 2026
85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants