From 0cc4b0c3e6207fcae9ffde81096f86c40d2634b4 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Thu, 29 Nov 2018 19:06:34 +0100 Subject: [PATCH] Fix build parallelism on Windows with NUMA (#21278) When multiple NUMA nodes are enabled on the machine where coreclr is built, we incorrectly detect the number of cores that we use for build parallelism of the native part of the build (NumberOfCores) as only a number in the last NUMA node. The reason is that the `wmic cpu get NumberOfCores /value` returns multiple lines, one per each NUMA node. This change fixes it by summing values from all the lines. --- build.cmd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.cmd b/build.cmd index 781ed9f..41ff53d 100644 --- a/build.cmd +++ b/build.cmd @@ -332,9 +332,11 @@ REM NumberOfCores is an WMI property providing number of physical cores on machi REM processor(s). It is used to set optimal level of CL parallelism during native build step if not defined NumberOfCores ( REM Determine number of physical processor cores available on machine + set TotalNumberOfCores=0 for /f "tokens=*" %%I in ( 'wmic cpu get NumberOfCores /value ^| find "=" 2^>NUL' - ) do set %%I + ) do set %%I & set /a TotalNumberOfCores=TotalNumberOfCores+NumberOfCores + set NumberOfCores=!TotalNumberOfCores! ) echo %__MsgPrefix%Number of processor cores %NumberOfCores% -- 2.7.4