extend getters on C API#1549
Conversation
79f2f34 to
8a4ee93
Compare
CI Test Summary✅ All 31 test job(s) passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe C API adds problem-attribute selectors and getters, plus a CSC accessor for linear constraint matrices. Implementations expose metadata, arrays, names, and matrix data, while C and C++ tests validate LP, MIP, QP, and created-problem behavior. ChangesProblem accessor API
Estimated code review effort: 4 (Complex) | ~60 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cpp/tests/linear_programming/c_api_tests/c_api_tests.cpp`:
- Around line 797-802: The new QP test in c_api_tests::problem_attributes_qp
depends on quadratic_programming/QP_Test_1.qps, but that fixture is not included
in the dataset provisioning flow. Update the dataset download step or related
dataset manifest/script used by cuopt::test::get_rapids_dataset_root_dir() so
QP_Test_1.qps is downloaded with the other test assets, ensuring this test can
locate the file at runtime.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e0acf068-41ea-4d33-aa75-1ab654dc2651
📒 Files selected for processing (7)
cpp/include/cuopt/mathematical_optimization/constants.hcpp/include/cuopt/mathematical_optimization/cuopt_c.hcpp/src/pdlp/CMakeLists.txtcpp/src/pdlp/cuopt_c_attributes.cppcpp/tests/linear_programming/c_api_tests/c_api_test.ccpp/tests/linear_programming/c_api_tests/c_api_tests.cppcpp/tests/linear_programming/c_api_tests/c_api_tests.h
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cpp/tests/linear_programming/c_api_tests/c_api_test.c (1)
3391-3414: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCSC consistency check is structural-only; it won't catch a mis-populated CSC.
The transpose check compares only per-column nnz counts. A CSC exporter that produces correct column-offset gaps but wrong
csc_rowindices orcsc_valvalues would still pass. Consider (a) range-checkingcsc_row[k] ∈ [0, nc)likecsr_colis checked at Line 3401, and (b) cross-validating the actual nonzero values between the two layouts (e.g. per (row,col) lookup) so the CSC exporter's payload — not just its shape — is verified.As per path instructions, added/modified C API tests should validate returned values/consistency (not just "success") and cover CSR-to-CSC consistency.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cpp/tests/linear_programming/c_api_tests/c_api_test.c` around lines 3391 - 3414, The CSC validation in the C API test only checks offset structure and transpose counts, so a bad CSC payload could still pass. Update the test around cuOptGetConstraintMatrix and cuOptGetConstraintMatrixCSC to also range-check csc_row entries like csr_col is checked, and add a content-level comparison between CSR and CSC so the actual row/col/value payloads are verified, not just the offsets.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@cpp/tests/linear_programming/c_api_tests/c_api_test.c`:
- Around line 3391-3414: The CSC validation in the C API test only checks offset
structure and transpose counts, so a bad CSC payload could still pass. Update
the test around cuOptGetConstraintMatrix and cuOptGetConstraintMatrixCSC to also
range-check csc_row entries like csr_col is checked, and add a content-level
comparison between CSR and CSC so the actual row/col/value payloads are
verified, not just the offsets.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 18d59cd8-5a5b-4ae1-9521-6beb92f7c8b0
📒 Files selected for processing (7)
cpp/include/cuopt/mathematical_optimization/constants.hcpp/include/cuopt/mathematical_optimization/cuopt_c.hcpp/src/pdlp/CMakeLists.txtcpp/src/pdlp/cuopt_c_attributes.cppcpp/tests/linear_programming/c_api_tests/c_api_test.ccpp/tests/linear_programming/c_api_tests/c_api_tests.cppcpp/tests/linear_programming/c_api_tests/c_api_tests.h
✅ Files skipped from review due to trivial changes (1)
- cpp/src/pdlp/CMakeLists.txt
🚧 Files skipped from review as they are similar to previous changes (5)
- cpp/tests/linear_programming/c_api_tests/c_api_tests.cpp
- cpp/tests/linear_programming/c_api_tests/c_api_tests.h
- cpp/include/cuopt/mathematical_optimization/constants.h
- cpp/include/cuopt/mathematical_optimization/cuopt_c.h
- cpp/src/pdlp/cuopt_c_attributes.cpp
Additonal getters on cuOptOptimizationProblem. Uses generic get routines for different types and constants to identify the attribute, rather than fixed getters for each attribute.