Skip to content

Commit 8879fbc

Browse files
edsavagecursoragent
andcommitted
[ML] Use optimal test parallelism based on CPU count
Each test suite spawns ctest --parallel <all_cpus> internally, so running all suites concurrently causes resource contention. Limit the number of concurrent suites to ceil(nproc/3) on Unix and 2 on Windows, matching empirically determined optimal values from cross-platform benchmarking (see PR elastic#2900). Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent b6d498a commit 8879fbc

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ if (isWindows && msystem != 'MINGW64') {
110110
}
111111

112112
project.ext.numCpus = Runtime.runtime.availableProcessors()
113+
// Optimal number of test suites to run concurrently via cmake --build -j.
114+
// Each suite spawns ctest --parallel <all_cpus> internally, so running too
115+
// many suites simultaneously causes resource contention. These values were
116+
// determined empirically (see PR #2900).
117+
project.ext.testParallel = isWindows ? 2 : Math.max(1, (int) Math.ceil(numCpus / 3.0))
113118
project.ext.makeEnvironment = [ 'CPP_CROSS_COMPILE': cppCrossCompile,
114119
'VERSION_QUALIFIER': versionQualifier,
115120
'SNAPSHOT': (isSnapshot ? 'yes' : 'no'),

dev-tools/docker/docker_entrypoint.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,3 @@ elif [ "x$1" = "x--test" ] ; then
110110
cmake --build cmake-build-docker ${CMAKE_VERBOSE} -j ${TEST_PARALLEL} -t test_all_parallel || echo failed > build/test_status.txt
111111
fi
112112

113-
# Print sccache stats if it was used
114-
if [ -n "${SCCACHE_PATH:-}" ]; then
115-
"$SCCACHE_PATH" --show-stats || true
116-
"$SCCACHE_PATH" --stop-server || true
117-
fi
118-

0 commit comments

Comments
 (0)