From a7092c752f892d9e9251574eaba18a3703512c05 Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Thu, 25 Jun 2026 16:24:10 -0500 Subject: [PATCH 1/4] Honor dtest -n in loop_calc via CalcAllTablesPBNN. Pass dtest_effective_threads through to calc batches so calc threading matches solve and responds to the -n flag. Co-authored-by: Cursor --- library/tests/loop.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/library/tests/loop.cpp b/library/tests/loop.cpp index 8c564e03..d7644a97 100644 --- a/library/tests/loop.cpp +++ b/library/tests/loop.cpp @@ -119,6 +119,12 @@ bool loop_calc( #endif int filter[5] = {0, 0, 0, 0, 0}; + int strain_count = 0; + for (int k = 0; k < DDS_STRAINS; k++) + { + if (!filter[k]) + strain_count++; + } for (int i = 0; i < number; i += stepsize) { @@ -128,7 +134,9 @@ bool loop_calc( strcpy(dealsp->deals[j].cards, deal_list[i+j].remainCards); timer.start(count); - const int ret = CalcAllTablesPBN(dealsp, -1, filter, resp, parp); + const int workload = count * strain_count; + const int threads = dtest_effective_threads(options.num_threads_, workload); + const int ret = CalcAllTablesPBNN(dealsp, -1, filter, resp, parp, threads); if (ret != RETURN_NO_FAULT) { cout << "loop_calc: i " << i << ", return " << ret << "\n"; From de9b771c6486049c812c25202f386338b5990123 Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Fri, 26 Jun 2026 12:57:54 -0500 Subject: [PATCH 2/4] Stop passing -n to SetResources in dtest drivers. SetResources ignores maxThreads; threading is handled via dtest_effective_threads and the *N batch APIs. Passing -n only triggered a misleading library warning. itest.cpp will be removed in a future PR. --- library/tests/dtest.cpp | 2 +- library/tests/itest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/tests/dtest.cpp b/library/tests/dtest.cpp index 1116fb1f..d26abdfa 100644 --- a/library/tests/dtest.cpp +++ b/library/tests/dtest.cpp @@ -28,7 +28,7 @@ int main(int argc, char * argv[]) { read_args(argc, argv); - SetResources(options.memory_mb_, options.num_threads_); + SetResources(options.memory_mb_, 0); DDSInfo info; GetDDSInfo(&info); diff --git a/library/tests/itest.cpp b/library/tests/itest.cpp index 8e63b9ec..2eb6bbd2 100644 --- a/library/tests/itest.cpp +++ b/library/tests/itest.cpp @@ -28,7 +28,7 @@ int main(int argc, char * argv[]) { read_args(argc, argv); - SetResources(options.memory_mb_, options.num_threads_); + SetResources(options.memory_mb_, 0); DDSInfo info; GetDDSInfo(&info); From b8861e952c4691e93fbfe67a1934734313ffc8e0 Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Fri, 26 Jun 2026 19:35:55 +0100 Subject: [PATCH 3/4] Simplify Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- library/tests/loop.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/library/tests/loop.cpp b/library/tests/loop.cpp index d7644a97..8c98165e 100644 --- a/library/tests/loop.cpp +++ b/library/tests/loop.cpp @@ -119,12 +119,7 @@ bool loop_calc( #endif int filter[5] = {0, 0, 0, 0, 0}; - int strain_count = 0; - for (int k = 0; k < DDS_STRAINS; k++) - { - if (!filter[k]) - strain_count++; - } + const int strain_count = DDS_STRAINS; for (int i = 0; i < number; i += stepsize) { From 3d82c605854e6c04936a9f7736141a509b49335a Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Fri, 26 Jun 2026 20:10:15 +0100 Subject: [PATCH 4/4] Use named constant Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- library/tests/loop.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/tests/loop.cpp b/library/tests/loop.cpp index 8c98165e..7dbeb6a8 100644 --- a/library/tests/loop.cpp +++ b/library/tests/loop.cpp @@ -118,9 +118,8 @@ bool loop_calc( setw(25) << right << "Time" << "\n"; #endif - int filter[5] = {0, 0, 0, 0, 0}; + int filter[DDS_STRAINS] = {0, 0, 0, 0, 0}; const int strain_count = DDS_STRAINS; - for (int i = 0; i < number; i += stepsize) { int count = (i + stepsize > number ? number - i : stepsize);