-
Notifications
You must be signed in to change notification settings - Fork 104
Main merge release/25.12 4 #696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Main merge release/25.12 4 #696
Conversation
## Summary by CodeRabbit ## Release Notes * **Performance** * Optimized branch-and-bound algorithm with improved search termination conditions * **Improvements** * Enhanced concurrency control mechanisms across solver components * Improved logger initialization and lifecycle management for better resource handling <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> Authors: - Alice Boucher (https://github.com/aliceb-nv) Approvers: - Nicolas Blin (https://github.com/Kh4ster) URL: NVIDIA#691
📝 WalkthroughWalkthroughThe pull request migrates volatile-based concurrency primitives to atomic types across solver settings and LP solving modules, adds a node exploration cap in branch-and-bound diving logic, refactors logger initialization to use a ref-counted guard pattern for shared configuration, updates a pre-commit hook configuration, and adjusts a dependency version constraint. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
cpp/src/dual_simplex/branch_and_bound.cpp (1)
1138-1138: Consider making the diving node cap configurable.The hard-coded limit of 1000 nodes per diving subtree is a reasonable safeguard against excessive exploration, but making it configurable (via
settings_or as a named constant) would improve flexibility and maintainability.+ // Maximum nodes to explore per diving subtree before moving to next subtree + static constexpr i_t kMaxDivingNodesPerSubtree = 1000; + if (start_node.has_value()) { if (get_upper_bound() < start_node->node.lower_bound) { continue; } bool recompute_bounds_and_basis = true; i_t nodes_explored = 0; // ... - if (nodes_explored >= 1000) { break; } + if (nodes_explored >= kMaxDivingNodesPerSubtree) { break; }Also applies to: 1156-1156, 1171-1172
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
.pre-commit-config.yaml(2 hunks)cpp/include/cuopt/linear_programming/pdlp/solver_settings.hpp(1 hunks)cpp/src/dual_simplex/branch_and_bound.cpp(3 hunks)cpp/src/dual_simplex/branch_and_bound.hpp(2 hunks)cpp/src/dual_simplex/simplex_solver_settings.hpp(1 hunks)cpp/src/linear_programming/solve.cu(1 hunks)cpp/src/mip/diversity/diversity_manager.cuh(1 hunks)cpp/src/mip/relaxed_lp/relaxed_lp.cuh(1 hunks)cpp/src/utilities/logger.cpp(2 hunks)cpp/src/utilities/logger.hpp(1 hunks)python/cuopt/cuopt/linear_programming/pyproject.toml(3 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{cu,cuh,cpp,hpp,h}
📄 CodeRabbit inference engine (.github/.coderabbit_review_guide.md)
**/*.{cu,cuh,cpp,hpp,h}: Track GPU device memory allocations and deallocations to prevent memory leaks; ensure cudaMalloc/cudaFree balance and cleanup of streams/events
Validate algorithm correctness in optimization logic: simplex pivots, branch-and-bound decisions, routing heuristics, and constraint/objective handling must produce correct results
Check numerical stability: prevent overflow/underflow, precision loss, division by zero/near-zero, and use epsilon comparisons for floating-point equality checks
Validate correct initialization of variable bounds, constraint coefficients, and algorithm state before solving; ensure reset when transitioning between algorithm phases (presolve, simplex, diving, crossover)
Ensure variables and constraints are accessed from the correct problem context (original vs presolve vs folded vs postsolve); verify index mapping consistency across problem transformations
For concurrent CUDA operations (barriers, async operations), explicitly create and manage dedicated streams instead of reusing the default stream; document stream lifecycle
Eliminate unnecessary host-device synchronization (cudaDeviceSynchronize) in hot paths that blocks GPU pipeline; use streams and events for async execution
Assess algorithmic complexity for large-scale problems (millions of variables/constraints); ensure O(n log n) or better complexity, not O(n²) or worse
Verify correct problem size checks before expensive GPU/CPU operations; prevent resource exhaustion on oversized problems
Identify assertions with overly strict numerical tolerances that fail on legitimate degenerate/edge cases (near-zero pivots, singular matrices, empty problems)
Ensure race conditions are absent in multi-GPU code and multi-threaded server implementations; verify proper synchronization of shared state
Refactor code duplication in solver components (3+ occurrences) into shared utilities; for GPU kernels, use templated device functions to avoid duplication
Check that hard-coded GPU de...
Files:
cpp/src/dual_simplex/branch_and_bound.cppcpp/src/dual_simplex/simplex_solver_settings.hppcpp/src/utilities/logger.cppcpp/src/dual_simplex/branch_and_bound.hppcpp/include/cuopt/linear_programming/pdlp/solver_settings.hppcpp/src/linear_programming/solve.cucpp/src/mip/diversity/diversity_manager.cuhcpp/src/utilities/logger.hppcpp/src/mip/relaxed_lp/relaxed_lp.cuh
**/*.{cpp,hpp,h}
📄 CodeRabbit inference engine (.github/.coderabbit_review_guide.md)
**/*.{cpp,hpp,h}: Check for unclosed file handles when reading MPS/QPS problem files; ensure RAII patterns or proper cleanup in exception paths
Validate input sanitization to prevent buffer overflows and resource exhaustion attacks; avoid unsafe deserialization of problem files
Prevent thread-unsafe use of global and static variables; use proper mutex/synchronization in server code accessing shared solver state
Files:
cpp/src/dual_simplex/branch_and_bound.cppcpp/src/dual_simplex/simplex_solver_settings.hppcpp/src/utilities/logger.cppcpp/src/dual_simplex/branch_and_bound.hppcpp/include/cuopt/linear_programming/pdlp/solver_settings.hppcpp/src/utilities/logger.hpp
**/*.{cu,cpp,hpp,h}
📄 CodeRabbit inference engine (.github/.coderabbit_review_guide.md)
Avoid inappropriate use of exceptions in performance-critical GPU operation paths; prefer error codes or CUDA error checking for latency-sensitive code
Files:
cpp/src/dual_simplex/branch_and_bound.cppcpp/src/dual_simplex/simplex_solver_settings.hppcpp/src/utilities/logger.cppcpp/src/dual_simplex/branch_and_bound.hppcpp/include/cuopt/linear_programming/pdlp/solver_settings.hppcpp/src/linear_programming/solve.cucpp/src/utilities/logger.hpp
**/*.{h,hpp,py}
📄 CodeRabbit inference engine (.github/.coderabbit_review_guide.md)
Verify C API does not break ABI stability (no struct layout changes, field reordering); maintain backward compatibility in Python and server APIs with deprecation warnings
Files:
cpp/src/dual_simplex/simplex_solver_settings.hppcpp/src/dual_simplex/branch_and_bound.hppcpp/include/cuopt/linear_programming/pdlp/solver_settings.hppcpp/src/utilities/logger.hpp
cpp/include/cuopt/**/*
⚙️ CodeRabbit configuration file
cpp/include/cuopt/**/*: For public header files (C++ API):
- Check if new public functions/classes have documentation comments (Doxygen format)
- Flag API changes that may need corresponding docs/ updates
- Verify parameter descriptions match actual types/behavior
- Suggest documenting thread-safety, GPU requirements, and numerical behavior
- For breaking changes, recommend updating docs and migration guides
Files:
cpp/include/cuopt/linear_programming/pdlp/solver_settings.hpp
**/*.{cu,cuh}
📄 CodeRabbit inference engine (.github/.coderabbit_review_guide.md)
**/*.{cu,cuh}: Every CUDA kernel launch and memory operation must have error checking with CUDA_CHECK or equivalent verification
Avoid reinventing functionality already available in Thrust, CCCL, or RMM libraries; prefer standard library utilities over custom implementations
Files:
cpp/src/linear_programming/solve.cucpp/src/mip/diversity/diversity_manager.cuhcpp/src/mip/relaxed_lp/relaxed_lp.cuh
**/*.cu
📄 CodeRabbit inference engine (.github/.coderabbit_review_guide.md)
**/*.cu: Verify race conditions and correctness of GPU kernel shared memory, atomics, and warp-level operations
Detect inefficient GPU kernel launches with low occupancy or poor memory access patterns; optimize for coalesced memory access and minimize warp divergence in hot paths
Files:
cpp/src/linear_programming/solve.cu
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Reduce tight coupling between solver components (presolve, simplex, basis, barrier); increase modularity and reusability of optimization algorithms
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Validate correct initialization of variable bounds, constraint coefficients, and algorithm state before solving; ensure reset when transitioning between algorithm phases (presolve, simplex, diving, crossover)
Applied to files:
cpp/src/dual_simplex/branch_and_bound.cppcpp/src/dual_simplex/simplex_solver_settings.hppcpp/src/dual_simplex/branch_and_bound.hppcpp/src/linear_programming/solve.cucpp/src/mip/relaxed_lp/relaxed_lp.cuh
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Validate algorithm correctness in optimization logic: simplex pivots, branch-and-bound decisions, routing heuristics, and constraint/objective handling must produce correct results
Applied to files:
cpp/src/dual_simplex/branch_and_bound.cppcpp/src/dual_simplex/simplex_solver_settings.hppcpp/src/dual_simplex/branch_and_bound.hppcpp/include/cuopt/linear_programming/pdlp/solver_settings.hppcpp/src/linear_programming/solve.cucpp/src/mip/relaxed_lp/relaxed_lp.cuh
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*test*.{cpp,cu,py} : Add tests for algorithm phase transitions: verify correct initialization of bounds and state when transitioning from presolve to simplex to diving to crossover
Applied to files:
cpp/src/dual_simplex/branch_and_bound.cpp
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cpp,hpp,h} : Prevent thread-unsafe use of global and static variables; use proper mutex/synchronization in server code accessing shared solver state
Applied to files:
cpp/src/dual_simplex/simplex_solver_settings.hppcpp/src/dual_simplex/branch_and_bound.hppcpp/include/cuopt/linear_programming/pdlp/solver_settings.hppcpp/src/linear_programming/solve.cucpp/src/mip/diversity/diversity_manager.cuhcpp/src/mip/relaxed_lp/relaxed_lp.cuh
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Ensure race conditions are absent in multi-GPU code and multi-threaded server implementations; verify proper synchronization of shared state
Applied to files:
cpp/src/dual_simplex/simplex_solver_settings.hppcpp/include/cuopt/linear_programming/pdlp/solver_settings.hppcpp/src/linear_programming/solve.cucpp/src/mip/diversity/diversity_manager.cuhcpp/src/mip/relaxed_lp/relaxed_lp.cuh
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Ensure variables and constraints are accessed from the correct problem context (original vs presolve vs folded vs postsolve); verify index mapping consistency across problem transformations
Applied to files:
cpp/src/dual_simplex/simplex_solver_settings.hppcpp/src/dual_simplex/branch_and_bound.hppcpp/include/cuopt/linear_programming/pdlp/solver_settings.hppcpp/src/linear_programming/solve.cucpp/src/mip/relaxed_lp/relaxed_lp.cuh
📚 Learning: 2025-12-04T20:09:09.264Z
Learnt from: chris-maes
Repo: NVIDIA/cuopt PR: 602
File: cpp/src/linear_programming/solve.cu:732-742
Timestamp: 2025-12-04T20:09:09.264Z
Learning: In cpp/src/linear_programming/solve.cu, the barrier solver does not currently return INFEASIBLE or UNBOUNDED status. It only returns OPTIMAL, TIME_LIMIT, NUMERICAL_ISSUES, or CONCURRENT_LIMIT.
Applied to files:
cpp/src/dual_simplex/simplex_solver_settings.hppcpp/src/dual_simplex/branch_and_bound.hppcpp/src/linear_programming/solve.cucpp/src/mip/relaxed_lp/relaxed_lp.cuh
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Reduce tight coupling between solver components (presolve, simplex, basis, barrier); increase modularity and reusability of optimization algorithms
Applied to files:
cpp/src/dual_simplex/simplex_solver_settings.hpp
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Refactor code duplication in solver components (3+ occurrences) into shared utilities; for GPU kernels, use templated device functions to avoid duplication
Applied to files:
cpp/src/dual_simplex/simplex_solver_settings.hppcpp/src/linear_programming/solve.cu
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.cu : Verify race conditions and correctness of GPU kernel shared memory, atomics, and warp-level operations
Applied to files:
cpp/src/linear_programming/solve.cu
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Eliminate unnecessary host-device synchronization (cudaDeviceSynchronize) in hot paths that blocks GPU pipeline; use streams and events for async execution
Applied to files:
cpp/src/linear_programming/solve.cu
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Verify correct problem size checks before expensive GPU/CPU operations; prevent resource exhaustion on oversized problems
Applied to files:
cpp/src/linear_programming/solve.cu
🧬 Code graph analysis (1)
cpp/src/utilities/logger.cpp (1)
cpp/src/utilities/logger.hpp (2)
reset_default_logger(34-34)init_logger_t(42-42)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: wheel-build-cuopt-mps-parser / 13.0.2, 3.10, arm64, rockylinux8
- GitHub Check: wheel-build-cuopt-mps-parser / 13.0.2, 3.11, arm64, rockylinux8
- GitHub Check: wheel-build-cuopt-mps-parser / 13.0.2, 3.10, amd64, rockylinux8
- GitHub Check: wheel-build-cuopt-mps-parser / 13.0.2, 3.12, amd64, rockylinux8
- GitHub Check: wheel-build-cuopt-sh-client / 13.0.2, 3.10, amd64, rockylinux8
- GitHub Check: checks / check-style
🔇 Additional comments (11)
.pre-commit-config.yaml (1)
59-63: LGTM!The new
verify-alpha-spechook with--fixand--mode releasearguments is correctly configured under therapidsai/pre-commit-hooksrepository.cpp/src/dual_simplex/branch_and_bound.hpp (1)
116-117: LGTM on the atomic migration.The change from
volatile inttostd::atomic<int>forroot_concurrent_halt_is correct for cross-thread signaling. The getter properly returns a pointer to the atomic, and the setter usesoperator=which defaults tomemory_order_seq_cst, providing sufficient ordering guarantees for termination signaling.Also applies to: 173-173
cpp/src/linear_programming/solve.cu (1)
309-309: LGTM on the atomic migration.The change from
volatile inttostd::atomic<int>forglobal_concurrent_haltis the correct approach for cross-thread termination signaling. The default initialization{0}and subsequent operations viaoperator=use sequentially consistent ordering, which provides the necessary visibility guarantees between PDLP, dual simplex, and barrier threads.cpp/src/mip/relaxed_lp/relaxed_lp.cuh (1)
19-28: LGTM!The change from
volatile int*tostd::atomic<int>*forconcurrent_haltaligns with the project-wide migration to proper atomic semantics for concurrent termination signaling.cpp/src/utilities/logger.hpp (1)
36-43: Clean RAII pattern using shared_ptr for ref-counted logger initialization.The use of
std::shared_ptr<void>forguard_enables type-erased ref-counting without exposing implementation details in the header. Removing the explicit destructor in favor of shared_ptr-based lifetime management is a cleaner approach for handling multipleinit_logger_tinstances that share logger configuration.python/cuopt/cuopt/linear_programming/pyproject.toml (1)
23-23: LGTM!Removing the
>=0.0.0a0suffix from therapids-loggerdependency constraint is appropriate for release mode, restricting to stable 0.2.x versions only. This aligns with the newverify-alpha-spec --mode releasepre-commit hook added in this PR.Also applies to: 42-42, 86-86
cpp/src/mip/diversity/diversity_manager.cuh (1)
97-98: LGTM!The change from
volatile inttostd::atomic<int>forglobal_concurrent_haltis correct for the PDLP termination signaling use case. The existing pattern of usingstd::mutexfor data protection (line 96) alongsidestd::atomicfor lightweight signaling is appropriate.cpp/include/cuopt/linear_programming/pdlp/solver_settings.hpp (1)
215-215: Good migration fromvolatiletostd::atomic<int>*for proper thread-safety.The
volatilekeyword does not provide atomicity or memory ordering guarantees required for concurrent access. Usingstd::atomic<int>*ensures correct synchronization semantics for the halt signal across threads.Since this is a public header, verify that downstream consumers are updated to use
std::atomic<int>*when setting this member. This is technically an ABI-breaking change.cpp/src/dual_simplex/simplex_solver_settings.hpp (1)
148-149: LGTM!Correct migration from
volatile int*tostd::atomic<int>*for proper thread-safe signaling. The comment documenting the semantics (nullptr ignored, 0=continue, 1=halt) is retained and still accurate.cpp/src/utilities/logger.cpp (2)
140-147: Well-designed guard pattern for shared logger configuration.Using a weak reference with mutex-protected access is a clean approach to ensure the logger configuration persists while any
init_logger_tinstance exists, then resets when all instances are destroyed.
149-189: LGTM - ref-counted logger initialization with proper synchronization.The implementation correctly:
- Reuses existing configuration when a guard is active (avoiding redundant sink setup)
- Drains buffered messages only on first initialization
- Creates and shares the guard for subsequent instances
One note: when an existing guard is reused (early return at line 157), buffered messages logged between instances won't be re-drained, which is correct since sinks are already configured.
|
Seems like this needs ops to look at since it is picking up 25.12.00 tag with normal way of merge |
For #693
Summary by CodeRabbit
Release Notes
Bug Fixes
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.