From 662ad9eafed61709aec230243ca4d312e2e05c52 Mon Sep 17 00:00:00 2001 From: Katarzyna Cencelewska Date: Fri, 13 Dec 2024 17:02:46 +0100 Subject: [PATCH] add option to bruteforce test to force count of worker threads - to be able to have deterministic results it is useful to have a mechanism to force the same count of workers - this commit doesn't change the default settings but expands functianality Signed-off-by: Katarzyna Cencelewska --- test_conformance/math_brute_force/main.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test_conformance/math_brute_force/main.cpp b/test_conformance/math_brute_force/main.cpp index ec504e6030..545047ac7f 100644 --- a/test_conformance/math_brute_force/main.cpp +++ b/test_conformance/math_brute_force/main.cpp @@ -379,6 +379,7 @@ static int ParseArgs(int argc, const char **argv) gTestNames.push_back(""); int singleThreaded = 0; + int forcedWorkerThreads = 0; { // Extract the app name strncpy(appName, argv[0], MAXPATHLEN - 1); @@ -430,6 +431,11 @@ static int ParseArgs(int argc, const char **argv) case 'm': singleThreaded ^= 1; break; + case 't': + forcedWorkerThreads = atoi(argv[++i]); + vlog(" %d", forcedWorkerThreads); + break; + case 'g': gHasHalf ^= 1; break; case 'r': gTestFastRelaxed ^= 1; break; @@ -540,7 +546,17 @@ static int ParseArgs(int argc, const char **argv) gWimpyReductionFactor); } - if (singleThreaded) SetThreadCount(1); + if (singleThreaded) + { + vlog("*** WARNING: Reduce worker threads to 1 ***\n"); + SetThreadCount(1); + } + else if (forcedWorkerThreads > 0) + { + vlog("*** WARNING: Reduce worker threads to %d ***\n", + forcedWorkerThreads); + SetThreadCount(forcedWorkerThreads); + } return 0; }