Add basic support to the harness for parallel test execution (#1687)

This change introduces a new command-line parameter to enable
parallel execution by a specified number of worker threads. When
parallel execution is requested, tests are distributed across
the worker threads. This behaviour is disabled by default.

This does not currently work for all suites as some of them are
using global variables to configure tests. For the suites that
do not use global state, this change reduced the execution time
by up to 5x on an 8-core machine.

Signed-off-by: Kévin Petit <kpet@free.fr>
This commit is contained in:
Kévin Petit
2023-04-25 19:30:42 +01:00
committed by GitHub
parent 033aa195c5
commit ff1369d94e
6 changed files with 168 additions and 46 deletions

View File

@@ -316,8 +316,12 @@ int main(int argc, const char *argv[])
// Note: don't use the entire harness, because we have a different
// way of obtaining the device (via the context)
error = parseAndCallCommandLineTests(
argc_, argv, deviceIDs[i], test_num, test_list, true, 0, 1024);
test_harness_config config{};
config.forceNoContextCreation = true;
config.numElementsToUse = 1024;
config.queueProps = 0;
error = parseAndCallCommandLineTests(argc_, argv, deviceIDs[i],
test_num, test_list, config);
if (error != 0) break;
}
@@ -397,9 +401,12 @@ int main(int argc, const char *argv[])
// Note: don't use the entire harness, because we have a different
// way of obtaining the device (via the context)
error = parseAndCallCommandLineTests(argc_, argv_, deviceIDs[i],
test_num32, test_list32, true,
0, 1024);
test_harness_config config{};
config.forceNoContextCreation = true;
config.numElementsToUse = 1024;
config.queueProps = 0;
error = parseAndCallCommandLineTests(
argc_, argv_, deviceIDs[i], test_num32, test_list32, config);
if (error != 0) break;
}