Skip to content

Conversation

@Iroy30
Copy link
Member

@Iroy30 Iroy30 commented Dec 19, 2025

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

Summary by CodeRabbit

  • New Features

    • Added Quadratic Programming (QP) support documentation and examples for C and Python APIs.
  • Documentation

    • Expanded documentation to reflect support for Linear Programming (LP), Quadratic Programming (QP), and Mixed Integer Linear Programming (MILP) across all APIs and guides.
    • Reorganized documentation structure for improved navigation.
  • Chores

    • Enhanced performance optimizations for CUDA runtime handling.

✏️ Tip: You can customize this high-level summary in your review settings.

aliceb-nv and others added 6 commits December 11, 2025 16:52
## 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
@Iroy30 Iroy30 requested review from a team as code owners December 19, 2025 20:29
@copy-pr-bot
Copy link

copy-pr-bot bot commented Dec 19, 2025

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.

@Iroy30 Iroy30 added bug Something isn't working doc Improvements or additions to documentation non-breaking Introduces a non-breaking change labels Dec 19, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 19, 2025

📝 Walkthrough

Walkthrough

This PR adds Quadratic Programming (QP) support to the cuOpt documentation and product scope. Changes include reorganizing documentation from an "LP and MILP" structure to "LP, QP and MILP," updating cross-references and links throughout the documentation, and refactoring the CUDA cusparse integration to use runtime CUSPARSE version checks instead of compile-time CUDA version checks.

Changes

Cohort / File(s) Change Summary
CUDA Runtime Version Gating
cpp/src/dual_simplex/cusparse_view.cu
Replaces compile-time __CUDACC_VER_MAJOR__ check with runtime CUSPARSE version macros (CUSPARSE_VER_MAJOR/MINOR/PATCH). Single-row ALG1 workaround now triggers when num_rows == 1 and CUSPARSE version ≤ 12.6.2, with fallback to ALG2 for other cases.
Main Documentation Index Updates
docs/cuopt/source/index.rst, docs/cuopt/source/cuopt-c/index.rst, docs/cuopt/source/cuopt-python/index.rst
Updates top-level documentation navigation and toctree references from "LP and MILP" to "LP, QP and MILP" with corresponding path changes from lp-milp/ to lp-qp-milp/.
C API Documentation Reorganization
docs/cuopt/source/cuopt-c/lp-milp/index.rst (removed), docs/cuopt/source/cuopt-c/lp-qp-milp/* (new)
Removes old LP/MILP section and adds new LP/QP/MILP section with updated API reference titles, cross-references, and documentation links reflecting QP inclusion.
Python API Documentation Reorganization
docs/cuopt/source/cuopt-python/lp-milp/index.rst (removed), docs/cuopt/source/cuopt-python/lp-qp-milp/* (new)
Removes old LP/MILP documentation section and creates new LP/QP/MILP structure with updated titles, anchors, and example descriptions.
Quick Start Guide Updates
docs/cuopt/source/cuopt-c/quick-start.rst, docs/cuopt/source/cuopt-python/quick-start.rst, docs/cuopt/source/cuopt-cli/quick-start.rst
Expands supported C and Python API scope documentation from "LP and MILP" to include "QP"; updates settings reference links to lp-qp-milp-settings.
Global Settings and Features Documentation
docs/cuopt/source/lp-qp-features.rst, docs/cuopt/source/lp-qp-milp-settings.rst, docs/cuopt/source/transition.rst, docs/cuopt/source/cuopt-server/*
Updates feature and settings documentation titles, descriptions, and cross-references to reflect LP, QP, and MILP scope; corrects toctree entries and anchor links across server API examples and documentation.
Python Example Code Update
docs/cuopt/source/cuopt-python/lp-qp-milp/examples/simple_qp_example.py
Adds a new quadratic constraint (0.75\*x + y ≤ 1) to the problem; removes explicit variable names in addVariable() calls, simplifying method signatures; updates docstring to reflect additional constraint.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • CUDA cusparse logic change (cusparse_view.cu): Runtime version gating replaces compile-time checks; requires verification that version comparisons and fallback behavior are correct and backward compatible.
  • Python method signature change (simple_qp_example.py): The removal of the name parameter from addVariable() calls needs confirmation that the method signature truly supports this simplification without breaking functionality.
  • Documentation cross-reference consistency: Multiple inter-linked documentation updates across C and Python APIs require verification that all paths (lp-qp-milp-settings, lp-qp-milp-c-api, etc.) are correctly and consistently referenced throughout the documentation tree.
  • Directory structure migration: Verify that all file moves/renames from lp-milp/ to lp-qp-milp/ are complete and no stale references remain in the documentation.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Update doc and cusparse check' is vague and generic, failing to clearly describe the main changes in the pull request. Provide a more specific and descriptive title that clearly communicates the primary changes, such as 'Add QP support to documentation and update CUSPARSE version check' or 'Update cuOpt docs to include QP and fix CUSPARSE runtime version handling'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-milp-c-api.rst (1)

217-220: Update section heading and description to include QP solver support.

The section heading "Solving an LP or MIP" and the description "LP and MIP solves are performed by calling..." should be updated to include QP, since the cuOptSolve function is used for all three problem types. Consider revising to: "Solving an LP, QP, or MIP" and "LP, QP, and MIP solves are performed by calling...".

🔎 Proposed update for consistency
-Solving an LP or MIP
+Solving an LP, QP, or MIP
 --------------------
 
-LP and MIP solves are performed by calling the `cuOptSolve` function
+LP, QP, and MIP solves are performed by calling the `cuOptSolve` function
docs/cuopt/source/cuopt-c/index.rst (1)

4-4: Update C API documentation to accurately reflect supported optimization types.

Line 4 states the C API "supports linear programming optimization only," but the toctree at lines 15-20 references "LP, QP and MILP Optimization." This contradicts documented C API capabilities: the C API supports MILP examples, but QP support is available only in the Python API.

Correct one of the following:

  • Update line 4 to reflect actual C API scope: "the cuOpt C API supports linear programming (LP) and mixed integer linear programming (MILP) optimization"
  • Update the toctree caption at line 16 from "LP, QP and MILP Optimization" to "LP and MILP Optimization" and ensure lp-qp-milp/index.rst is C-API-specific or properly scoped
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 716700b and ac3dcc8.

📒 Files selected for processing (22)
  • cpp/src/dual_simplex/cusparse_view.cu (1 hunks)
  • docs/cuopt/source/cuopt-c/index.rst (1 hunks)
  • docs/cuopt/source/cuopt-c/lp-milp/index.rst (0 hunks)
  • docs/cuopt/source/cuopt-c/lp-qp-milp/index.rst (1 hunks)
  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-example.rst (1 hunks)
  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-milp-c-api.rst (3 hunks)
  • docs/cuopt/source/cuopt-c/lp-qp-milp/milp-examples.rst (1 hunks)
  • docs/cuopt/source/cuopt-c/quick-start.rst (1 hunks)
  • docs/cuopt/source/cuopt-cli/quick-start.rst (1 hunks)
  • docs/cuopt/source/cuopt-python/index.rst (2 hunks)
  • docs/cuopt/source/cuopt-python/lp-milp/index.rst (0 hunks)
  • docs/cuopt/source/cuopt-python/lp-qp-milp/examples/simple_qp_example.py (2 hunks)
  • docs/cuopt/source/cuopt-python/lp-qp-milp/index.rst (1 hunks)
  • docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-api.rst (1 hunks)
  • docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-examples.rst (3 hunks)
  • docs/cuopt/source/cuopt-python/quick-start.rst (1 hunks)
  • docs/cuopt/source/cuopt-server/examples/lp-examples.rst (1 hunks)
  • docs/cuopt/source/cuopt-server/server-api/index.rst (1 hunks)
  • docs/cuopt/source/index.rst (1 hunks)
  • docs/cuopt/source/lp-qp-features.rst (1 hunks)
  • docs/cuopt/source/lp-qp-milp-settings.rst (1 hunks)
  • docs/cuopt/source/transition.rst (1 hunks)
💤 Files with no reviewable changes (2)
  • docs/cuopt/source/cuopt-python/lp-milp/index.rst
  • docs/cuopt/source/cuopt-c/lp-milp/index.rst
🧰 Additional context used
📓 Path-based instructions (7)
docs/**/*.{rst,md}

📄 CodeRabbit inference engine (.github/.coderabbit_review_guide.md)

docs/**/*.{rst,md}: Update documentation in docs/ for API changes (new parameters, return values, error codes), new public functions/classes, and changed algorithm behavior
Document numerical tolerances, parameter ranges, and algorithm phase descriptions in API documentation when solver behavior or tolerances change
Update version numbers and deprecation notices in documentation for breaking API changes; provide migration guidance for deprecated APIs

Files:

  • docs/cuopt/source/cuopt-c/lp-qp-milp/index.rst
  • docs/cuopt/source/cuopt-server/server-api/index.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-milp-c-api.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-example.rst
  • docs/cuopt/source/cuopt-python/quick-start.rst
  • docs/cuopt/source/lp-qp-features.rst
  • docs/cuopt/source/cuopt-c/quick-start.rst
  • docs/cuopt/source/cuopt-server/examples/lp-examples.rst
  • docs/cuopt/source/lp-qp-milp-settings.rst
  • docs/cuopt/source/index.rst
  • docs/cuopt/source/cuopt-cli/quick-start.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/index.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-api.rst
  • docs/cuopt/source/cuopt-python/index.rst
  • docs/cuopt/source/cuopt-c/index.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-examples.rst
  • docs/cuopt/source/transition.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/milp-examples.rst
docs/**/*

⚙️ CodeRabbit configuration file

docs/**/*: For documentation changes, focus on:

  • Accuracy: Verify code examples compile and run correctly
  • Completeness: Check if API changes (parameters, return values, errors) are documented
  • Clarity: Flag confusing explanations, missing prerequisites, or unclear examples
  • Consistency: Version numbers, parameter types, and terminology match code
  • Examples: Suggest adding examples for complex features or new APIs
  • Missing docs: If PR changes public APIs without updating docs, flag as HIGH priority

When code changes affect docs:

  • Suggest specific doc files that need updates (e.g., docs/cuopt/api.rst)
  • Identify outdated information contradicting the code changes
  • Recommend documenting performance characteristics, GPU requirements, or numerical tolerances

Files:

  • docs/cuopt/source/cuopt-c/lp-qp-milp/index.rst
  • docs/cuopt/source/cuopt-server/server-api/index.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-milp-c-api.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-example.rst
  • docs/cuopt/source/cuopt-python/quick-start.rst
  • docs/cuopt/source/lp-qp-features.rst
  • docs/cuopt/source/cuopt-c/quick-start.rst
  • docs/cuopt/source/cuopt-server/examples/lp-examples.rst
  • docs/cuopt/source/lp-qp-milp-settings.rst
  • docs/cuopt/source/index.rst
  • docs/cuopt/source/cuopt-cli/quick-start.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/index.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-api.rst
  • docs/cuopt/source/cuopt-python/index.rst
  • docs/cuopt/source/cuopt-c/index.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-examples.rst
  • docs/cuopt/source/transition.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/milp-examples.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/examples/simple_qp_example.py
**/*.{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/dual_simplex/cusparse_view.cu
**/*.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/dual_simplex/cusparse_view.cu
**/*.{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/cusparse_view.cu
**/*.{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/cusparse_view.cu
**/*.{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:

  • docs/cuopt/source/cuopt-python/lp-qp-milp/examples/simple_qp_example.py
🧠 Learnings (16)
📓 Common learnings
Learnt from: chris-maes
Repo: NVIDIA/cuopt PR: 500
File: cpp/tests/linear_programming/c_api_tests/c_api_test.c:1033-1048
Timestamp: 2025-12-06T00:22:48.638Z
Learning: In cuOPT's quadratic programming API, when a user provides a quadratic objective matrix Q via set_quadratic_objective_matrix or the C API functions cuOptCreateQuadraticProblem/cuOptCreateQuadraticRangedProblem, the API internally computes Q_symmetric = Q + Q^T and the barrier solver uses 0.5 * x^T * Q_symmetric * x. From the user's perspective, the convention is x^T Q x. For a diagonal Q with values [q1, q2, ...], the resulting quadratic terms are q1*x1^2 + q2*x2^2 + ...
Learnt from: chris-maes
Repo: NVIDIA/cuopt PR: 500
File: cpp/src/dual_simplex/scaling.cpp:68-76
Timestamp: 2025-12-04T04:11:12.640Z
Learning: In the cuOPT dual simplex solver, CSR/CSC matrices (including the quadratic objective matrix Q) are required to have valid dimensions and indices by construction. Runtime bounds checking in performance-critical paths like matrix scaling is avoided to prevent slowdowns. Validation is performed via debug-only check_matrix() calls wrapped in #ifdef CHECK_MATRIX.
📚 Learning: 2025-10-22T14:25:22.899Z
Learnt from: aliceb-nv
Repo: NVIDIA/cuopt PR: 527
File: cpp/src/mip/diversity/lns/rins.cu:167-175
Timestamp: 2025-10-22T14:25:22.899Z
Learning: In MIP (Mixed Integer Programming) problems in the cuOPT codebase, `n_integer_vars == 0` is impossible by definition—MIP problems must have at least one integer variable. If there are no integer variables, it would be a pure Linear Programming (LP) problem, not a MIP problem.

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-qp-milp/index.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-milp-c-api.rst
  • docs/cuopt/source/cuopt-c/quick-start.rst
  • docs/cuopt/source/lp-qp-milp-settings.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/index.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-examples.rst
📚 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 docs/**/*.{rst,md} : Update documentation in docs/ for API changes (new parameters, return values, error codes), new public functions/classes, and changed algorithm behavior

Applied to files:

  • docs/cuopt/source/cuopt-server/server-api/index.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-milp-c-api.rst
  • docs/cuopt/source/cuopt-python/quick-start.rst
  • docs/cuopt/source/cuopt-python/index.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-examples.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/milp-examples.rst
📚 Learning: 2025-12-06T00:22:48.638Z
Learnt from: chris-maes
Repo: NVIDIA/cuopt PR: 500
File: cpp/tests/linear_programming/c_api_tests/c_api_test.c:1033-1048
Timestamp: 2025-12-06T00:22:48.638Z
Learning: In cuOPT's quadratic programming API, when a user provides a quadratic objective matrix Q via set_quadratic_objective_matrix or the C API functions cuOptCreateQuadraticProblem/cuOptCreateQuadraticRangedProblem, the API internally computes Q_symmetric = Q + Q^T and the barrier solver uses 0.5 * x^T * Q_symmetric * x. From the user's perspective, the convention is x^T Q x. For a diagonal Q with values [q1, q2, ...], the resulting quadratic terms are q1*x1^2 + q2*x2^2 + ...

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-milp-c-api.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-example.rst
  • docs/cuopt/source/cuopt-c/quick-start.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/index.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-examples.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/examples/simple_qp_example.py
📚 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:

  • docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-milp-c-api.rst
  • cpp/src/dual_simplex/cusparse_view.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 docs/**/*.{rst,md} : Document numerical tolerances, parameter ranges, and algorithm phase descriptions in API documentation when solver behavior or tolerances change

Applied to files:

  • docs/cuopt/source/cuopt-server/examples/lp-examples.rst
  • docs/cuopt/source/lp-qp-milp-settings.rst
  • docs/cuopt/source/cuopt-cli/quick-start.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/index.rst
  • docs/cuopt/source/cuopt-python/index.rst
  • docs/cuopt/source/cuopt-c/index.rst
  • docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-examples.rst
  • docs/cuopt/source/transition.rst
  • docs/cuopt/source/cuopt-c/lp-qp-milp/milp-examples.rst
📚 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 docs/**/*.{rst,md} : Update version numbers and deprecation notices in documentation for breaking API changes; provide migration guidance for deprecated APIs

Applied to files:

  • docs/cuopt/source/cuopt-python/index.rst
📚 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} : Check that hard-coded GPU device IDs and resource limits are made configurable; abstract multi-backend support for different CUDA versions

Applied to files:

  • cpp/src/dual_simplex/cusparse_view.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} : 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/cusparse_view.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 error propagation from CUDA to user-facing APIs is complete; ensure CUDA errors are caught and mapped to meaningful user error codes

Applied to files:

  • cpp/src/dual_simplex/cusparse_view.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/dual_simplex/cusparse_view.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 : 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

Applied to files:

  • cpp/src/dual_simplex/cusparse_view.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} : Avoid reinventing functionality already available in Thrust, CCCL, or RMM libraries; prefer standard library utilities over custom implementations

Applied to files:

  • cpp/src/dual_simplex/cusparse_view.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} : 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/cusparse_view.cu
📚 Learning: 2025-12-04T04:11:12.640Z
Learnt from: chris-maes
Repo: NVIDIA/cuopt PR: 500
File: cpp/src/dual_simplex/scaling.cpp:68-76
Timestamp: 2025-12-04T04:11:12.640Z
Learning: In the cuOPT dual simplex solver, CSR/CSC matrices (including the quadratic objective matrix Q) are required to have valid dimensions and indices by construction. Runtime bounds checking in performance-critical paths like matrix scaling is avoided to prevent slowdowns. Validation is performed via debug-only check_matrix() calls wrapped in #ifdef CHECK_MATRIX.

Applied to files:

  • cpp/src/dual_simplex/cusparse_view.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} : 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/cusparse_view.cu
🔇 Additional comments (25)
docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-api.rst (1)

1-5: LGTM! Documentation title properly updated to include QP.

The cross-reference anchor and title update correctly reflect the expanded scope to include Quadratic Programming. The RST formatting (underline length) is accurate.

docs/cuopt/source/cuopt-c/quick-start.rst (1)

5-5: LGTM! Scope correctly expanded to include QP.

The C API description now accurately reflects support for Linear Programming (LP), Quadratic Programming (QP), and Mixed Integer Linear Programming (MILP).

docs/cuopt/source/cuopt-python/quick-start.rst (1)

5-5: LGTM! Python API capabilities correctly expanded.

The quickstart now accurately describes the Python API's support for both routing optimization and LP/QP/MILP problem solving.

docs/cuopt/source/cuopt-python/lp-qp-milp/examples/simple_qp_example.py (2)

17-17: Verify the new constraint produces expected results.

The additional constraint 0.75 * x + y <= 1 combined with x + y >= 1 and non-negativity constraints mathematically implies x = 0 and y = 1 (optimal solution with objective value 1). Ensure the example output documentation or comments reflect this updated solution.

Consider adding a comment or note explaining the expected solution for this problem to help users validate their results:

# Expected solution: x = 0, y = 1 with objective value = 1.0

Also applies to: 40-40


35-36: Confirm the name parameter is optional in addVariable API.

The code now relies on default variable naming by omitting the explicit name parameter. Verify that this omission is intentional (the parameter has a sensible default) and that the API documentation clearly states the name parameter is optional. If this is a recent change, ensure release notes or migration guides document this behavior.

docs/cuopt/source/index.rst (1)

21-21: Target file exists and toctree entry is correct.

The file lp-qp-features.rst exists at docs/cuopt/source/lp-qp-features.rst and the toctree entry at line 21 is properly formatted. No issues detected.

docs/cuopt/source/cuopt-server/server-api/index.rst (1)

15-15: No action required. The toctree target file docs/cuopt/source/lp-qp-milp-settings.rst exists at the correct path and the relative reference ../../lp-qp-milp-settings.rst from docs/cuopt/source/cuopt-server/server-api/index.rst correctly resolves to it.

docs/cuopt/source/transition.rst (1)

19-19: Cross-reference target verified.

The target file lp-qp-milp-settings.rst exists at docs/cuopt/source/lp-qp-milp-settings.rst, confirming the updated documentation link is valid.

docs/cuopt/source/cuopt-c/lp-qp-milp/milp-examples.rst (1)

8-8: Cross-reference target file verified.

The referenced file lp-qp-milp-c-api.rst exists at the expected location in the same directory as the current document, so the cross-reference :doc:C API `` is valid.

docs/cuopt/source/lp-qp-features.rst (2)

1-3: Title update properly reflects expanded LP/QP scope.

The change from "LP Features" to "LP/QP Features" aligns the documentation with the PR's goal of introducing QP support to the feature overview section.


58-77: QP solver documentation is thorough and accurate.

The section correctly documents the QP solver as beta, notes the x^TQx convention (without the 1/2 factor), specifies that barrier is the only supported method, and references the correct example labels. This aligns with the learnings about cuOpt's QP API implementation.

docs/cuopt/source/cuopt-server/examples/lp-examples.rst (1)

264-264: Cross-reference correctly updated to reflect LP/QP/MILP documentation scope.

The reference to solver settings now points to lp-qp-milp-settings instead of lp-milp-settings, aligning with the documentation reorganization to include QP parameters.

docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-example.rst (3)

1-3: Title correctly updated to include QP examples.

The change from "LP C API Examples" to "LP/QP C API Examples" properly reflects the addition of the quadratic programming example section.


9-9: Cross-reference updated consistently with documentation reorganization.

The reference now points to lp-qp-milp-c-api instead of lp-milp-c-api, aligning with the expanded documentation structure.


141-175: QP example section is well-structured and appropriately documented.

The simple quadratic programming example follows the established pattern of LP examples, includes a beta warning, provides clear compilation/execution instructions, and shows expected output. The example correctly demonstrates QP solver usage.

docs/cuopt/source/cuopt-cli/quick-start.rst (1)

20-20: Cross-reference correctly updated to LP/QP/MILP settings.

The reference now points to the consolidated lp-qp-milp-settings documentation page.

docs/cuopt/source/cuopt-python/lp-qp-milp/index.rst (1)

1-14: New Python LP/QP/MILP documentation index properly structured.

The new index file correctly introduces a consolidated documentation section for Python LP, QP, and MILP APIs with appropriate toctree configuration and clear navigation captions. The structure aligns with the C API documentation reorganization in this PR.

docs/cuopt/source/cuopt-c/lp-qp-milp/index.rst (1)

1-15: New C API LP/QP/MILP documentation index properly structured.

The new index file appropriately consolidates LP, QP, and MILP C API documentation with correct relative paths and clear navigation structure. The reference to ../../lp-qp-milp-settings.rst correctly accesses the shared settings documentation from the subdirectory.

docs/cuopt/source/lp-qp-milp-settings.rst (2)

1-7: Title, description, and cross-references correctly updated for LP/QP/MILP scope.

Changes properly expand the settings documentation to cover LP, QP, and MILP solvers, and the C API cross-reference path is correctly updated to reference the new cuopt-c/lp-qp-milp/index structure.


58-424: Consider documenting QP-specific parameters or confirming shared parameter coverage.

The settings page comprehensively documents parameters for LP and MILP solvers. However, there are no QP-specific parameter settings documented. If the QP solver uses the same parameters as the LP barrier method, this should be explicitly noted in the QP section or in the Linear Programming parameters section (e.g., clarifying that QP uses the Barrier settings listed on this page). If there are QP-specific parameters, they should be added.

Can you verify whether QP uses the same parameter set as LP (with barrier method enforced) or if there are QP-specific parameters that should be documented here?

docs/cuopt/source/cuopt-c/lp-qp-milp/lp-qp-milp-c-api.rst (2)

1-4: Title and description correctly updated to include QP scope.

Changes properly reflect that the C API reference now covers LP, QP, and MILP solvers.


133-133: Cross-references correctly updated to LP/QP/MILP settings documentation.

Both parameter documentation references now point to the consolidated lp-qp-milp-settings page instead of the previous lp-milp-settings.

Also applies to: 147-147

docs/cuopt/source/cuopt-python/index.rst (1)

5-5: Documentation updates are internally consistent.

The introductory text at line 5 correctly describes the expanded scope ("routing optimization and LP/QP/MILP optimization"), and the toctree structure at lines 29–33 aligns with this by referencing the new lp-qp-milp/index.rst target. The caption and terminology are consistent throughout.

Also applies to: 29-33

docs/cuopt/source/cuopt-python/lp-qp-milp/lp-qp-milp-examples.rst (2)

1-9: Documentation scope is clear and well-structured.

The updated title (lines 1–3), introductory description (line 5), and note (line 9) all correctly reflect the expanded LP/QP/MILP scope. The file structure and language are consistent with the PR objective to document quadratic programming alongside linear and mixed-integer programming examples.


31-52: QP example is properly contextualized and correct.

The "Simple Quadratic Programming Example" section (lines 31–52) includes a beta note (line 37) that appropriately manages user expectations. The example structure follows the pattern of other examples in the file (download link, literalinclude, code-block output).

The example code at examples/simple_qp_example.py is correct, properly implements the convex QP problem (minimize x² + y² subject to constraints), and produces the documented output. The file includes proper SPDX licensing and clear docstring documentation.

Comment on lines +119 to +121
if (num_rows == 1 &&
(CUSPARSE_VER_MAJOR <= 12 && CUSPARSE_VER_MINOR <= 6 && CUSPARSE_VER_PATCH <= 2)) {
return CUSPARSE_SPMV_CSR_ALG1;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix semantic version comparison logic.

The version comparison logic is incorrect. The current condition (CUSPARSE_VER_MAJOR <= 12 && CUSPARSE_VER_MINOR <= 6 && CUSPARSE_VER_PATCH <= 2) uses AND operators for all components, which fails for versions with major < 12 but minor > 6 (e.g., 11.8.0 would incorrectly skip the ALG1 workaround even though it's older than 12.6.2).

This could cause single-row matrices to trigger the ALG2 bug on affected older CUSPARSE versions.

🔎 Proposed fix for correct semantic version comparison
  if (num_rows == 1 &&
-      (CUSPARSE_VER_MAJOR <= 12 && CUSPARSE_VER_MINOR <= 6 && CUSPARSE_VER_PATCH <= 2)) {
+      (CUSPARSE_VER_MAJOR < 12 ||
+       (CUSPARSE_VER_MAJOR == 12 && CUSPARSE_VER_MINOR < 6) ||
+       (CUSPARSE_VER_MAJOR == 12 && CUSPARSE_VER_MINOR == 6 && CUSPARSE_VER_PATCH <= 2))) {
    return CUSPARSE_SPMV_CSR_ALG1;
  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (num_rows == 1 &&
(CUSPARSE_VER_MAJOR <= 12 && CUSPARSE_VER_MINOR <= 6 && CUSPARSE_VER_PATCH <= 2)) {
return CUSPARSE_SPMV_CSR_ALG1;
if (num_rows == 1 &&
(CUSPARSE_VER_MAJOR < 12 ||
(CUSPARSE_VER_MAJOR == 12 && CUSPARSE_VER_MINOR < 6) ||
(CUSPARSE_VER_MAJOR == 12 && CUSPARSE_VER_MINOR == 6 && CUSPARSE_VER_PATCH <= 2))) {
return CUSPARSE_SPMV_CSR_ALG1;
}
🤖 Prompt for AI Agents
In cpp/src/dual_simplex/cusparse_view.cu around lines 119 to 121, the version
check uses an AND across major/minor/patch which is wrong for semantic
comparison; replace it with a proper lexicographic comparison so the condition
triggers for any CUSPARSE version <= 12.6.2, e.g. test (CUSPARSE_VER_MAJOR < 12)
|| (CUSPARSE_VER_MAJOR == 12 && (CUSPARSE_VER_MINOR < 6 || (CUSPARSE_VER_MINOR
== 6 && CUSPARSE_VER_PATCH <= 2))); keep the num_rows == 1 guard and return
CUSPARSE_SPMV_CSR_ALG1 when that semantic-version condition is true.

@rgsl888prabhu rgsl888prabhu added bug Something isn't working and removed bug Something isn't working doc Improvements or additions to documentation labels Dec 22, 2025
@anandhkb anandhkb added this to the 26.02 milestone Dec 22, 2025
@rgsl888prabhu
Copy link
Collaborator

@chris-maes may I get review on this PR?

@rgsl888prabhu
Copy link
Collaborator

/ok to test 43e55c2

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

Labels

bug Something isn't working non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants