The default of tests.jvms should not be capped (#35259)

Default to the number of physical cores across all sockets instead.
This commit is contained in:
Alpar Torok 2018-11-19 14:01:32 +02:00 committed by GitHub
parent ae6a33237f
commit fda59ff969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 3 deletions

View File

@ -150,8 +150,9 @@ Default value provided below in [brackets].
=== Load balancing and caches.
By default the tests run on up to 4 JVMs based on the number of cores. If you
want to explicitly specify the number of JVMs you can do so on the command
By default the tests run on multiple processes using all the available cores on all
available CPUs. Not including hyper-threading.
If you want to explicitly specify the number of JVMs you can do so on the command
line:
----------------------------

View File

@ -773,9 +773,32 @@ class BuildPlugin implements Plugin<Project> {
}
static void applyCommonTestConfig(Project project) {
String defaultParallel = 'auto'
// Count physical cores on any Linux distro ( don't count hyper-threading )
if (project.file("/proc/cpuinfo").exists()) {
Map<String, Integer> socketToCore = [:]
String currentID = ""
project.file("/proc/cpuinfo").readLines().forEach({ line ->
if (line.contains(":")) {
List<String> parts = line.split(":", 2).collect({it.trim()})
String name = parts[0], value = parts[1]
// the ID of the CPU socket
if (name == "physical id") {
currentID = value
}
// Number of cores not including hyper-threading
if (name == "cpu cores") {
assert currentID.isEmpty() == false
socketToCore[currentID] = Integer.valueOf(value)
currentID = ""
}
}
})
defaultParallel = socketToCore.values().sum().toString();
}
project.tasks.withType(RandomizedTestingTask) {
jvm "${project.runtimeJavaHome}/bin/java"
parallelism System.getProperty('tests.jvms', 'auto')
parallelism System.getProperty('tests.jvms', defaultParallel)
ifNoTests System.getProperty('tests.ifNoTests', 'fail')
onNonEmptyWorkDirectory 'wipe'
leaveTemporary true