Merge pull request #2517 from PaulBone/num_cores

Make the number of physical CPU cores detection more robust
This commit is contained in:
sen 2021-03-08 11:14:34 -05:00 committed by GitHub
commit a3feed8dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1212,12 +1212,17 @@ int UTIL_countPhysicalCores(void)
/* fall back on the sysconf value */
goto failed;
} }
if (siblings && cpu_cores) {
if (siblings && cpu_cores && siblings > cpu_cores) {
ratio = siblings / cpu_cores;
}
if (ratio && numPhysicalCores > ratio) {
numPhysicalCores = numPhysicalCores / ratio;
}
failed:
fclose(cpuinfo);
return numPhysicalCores = numPhysicalCores / ratio;
return numPhysicalCores;
}
}