Add -n/--numthr to dd_table_for_deal - #384
Merged
Merged
Conversation
Match dtest: 0 = auto, 1 = sequential; C++ uses CalcDDtablePBNN. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Two moderate issues remain, along with two documentation nits.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds -n/--numthr worker-thread controls to the C++ and Python dd_table_for_deal utilities.
Changes:
- Adds option parsing with automatic mode at
0. - Forwards thread limits to the solver APIs.
- Adds parsing and propagation tests.
File summaries
| File | Summary |
|---|---|
utilities/tests/dd_table_for_deal_test.cpp |
Adds C++ parser tests; executable-level forwarding coverage is still requested. |
utilities/src/dd_table_for_deal/dd_table_for_deal.hpp |
Declares the thread-count parser. |
utilities/src/dd_table_for_deal/dd_table_for_deal.cpp |
Adds C++ option handling and solver forwarding; usage grammar needs correction (nit, 1 vote). |
utilities/src/dd_table_for_deal/dd_table_for_deal_lib.cpp |
Implements C++ thread-count parsing. |
python/utilities/tests/test_dd_table_for_deal_par.py |
Tests Python CLI parsing and thread propagation. |
python/utilities/src/dd_table_for_deal.py |
Adds Python option handling and forwarding; usage grammar needs correction (nit, 1 vote) and values above INT_MAX should be rejected (moderate, 3 votes). |
Review details
Suppressed comments (3)
python/utilities/src/dd_table_for_deal.py:201
- This usage grammar makes
-nlook like a flag without an argument ([-n|--numthr N]), but the parser requires a value after either spelling. Users following the documented short form get a misleading error; spell out the value for both alternatives, such as[-n N|--numthr N].
f"[-n|--numthr N] <pbn_deal_or_file>\n"
utilities/src/dd_table_for_deal/dd_table_for_deal.cpp:244
- This usage grammar makes
-nlook like a flag without an argument ([-n|--numthr N]), but the parser requires a value after either spelling. Users following the documented short form get a misleading error; spell out the value for both alternatives, such as[-n N|--numthr N].
"[-n|--numthr N] <pbn_deal_or_file>\n"
utilities/src/dd_table_for_deal/dd_table_for_deal.cpp:215
- The C++ CLI's new thread-count plumbing is not covered:
utilities/tests/dd_table_for_deal_test.cpponly exercisesparse_numthr, so a regression that drops or changes thisCalcDDtablePBNNargument would leave the tests green. Add an executable-level test (or an extracted testable processing function) that verifies-n 1and the omitted/0cases reach the solver with the intended cap.
const int res = CalcDDtablePBNN(tableDealPBN, &table, num_threads);
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Document [-n N|--numthr N] and cover num_threads reaching CalcDDtablePBNN via an injectable helper. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-n/--numthrto the C++ and Pythondd_table_for_dealutilities so callers can control worker threads per table solve.dtestsemantics:0= auto (default),1= sequential; C++ usesCalcDDtablePBNN, Python passesmax_threadsthrough tocalc_all_tables_pbn.Test plan
dd_table_for_dealtests (ParseNumthrcases)test_dd_table_for_deal_par(CLI +max_threadsmain test)dd_table_for_deal -n 1 hands/example.pbnand Python equivalent-n 0/ omitted flag still behave as autoMade with Cursor