From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: chasel.chiu@intel.com) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by groups.io with SMTP; Wed, 12 Jun 2019 23:17:52 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2019 23:17:52 -0700 X-ExtLoop1: 1 Received: from cchiu4-mobl1.gar.corp.intel.com ([10.5.240.33]) by orsmga007.jf.intel.com with ESMTP; 12 Jun 2019 23:17:50 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Michael Kubacki , Nate DeSimone , Liming Gao Subject: [PATCH] Platform/Intel: Dynamic NUMBER_OF_PROCESSORS in build. Date: Thu, 13 Jun 2019 14:14:39 +0800 Message-Id: <20190613061439.10144-1-chasel.chiu@intel.com> X-Mailer: git-send-email 2.13.3.windows.1 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1913 To improve build performance by default the maximum processors should be used for building. To support this, NUMBER_OF_PROCESSORS in build.cfg has new definition: 0 = AUTO. Maximum of processors will be used. non-zero = limit or force the number of processors. Test: tried several NUMBER_OF_PROCESSORS settings and the build parameter can be updated accordingly also builds successfully. Cc: Michael Kubacki Cc: Nate DeSimone Cc: Liming Gao Signed-off-by: Chasel Chiu --- Platform/Intel/build.cfg | 2 +- Platform/Intel/build_bios.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg index 6c23e5eabc..fc6e4fe824 100644 --- a/Platform/Intel/build.cfg +++ b/Platform/Intel/build.cfg @@ -46,7 +46,7 @@ FSP_TEST_RELEASE = FALSE SECURE_BOOT_ENABLE = FALSE REBUILD_MODE = BUILD_ROM_ONLY = -NUMBER_OF_PROCESSORS = 1 +NUMBER_OF_PROCESSORS = 0 [PLATFORMS] diff --git a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py index 09eceddeff..864511ac4d 100644 --- a/Platform/Intel/build_bios.py +++ b/Platform/Intel/build_bios.py @@ -21,6 +21,7 @@ import shutil import argparse import traceback import subprocess +import multiprocessing from importlib import import_module try: @@ -345,7 +346,12 @@ def build(config): print(" BUILD_ROM_ONLY = ", config.get("BUILD_ROM_ONLY")) print("==========================================") - command = ["build", "-n", config["NUMBER_OF_PROCESSORS"]] + NumberOfProcessors = config["NUMBER_OF_PROCESSORS"] + if config["NUMBER_OF_PROCESSORS"] == "0": + # 0 means AUTO, maximum number of processors will be set + NumberOfProcessors = str(multiprocessing.cpu_count()) + print ("Number of processors set to " + NumberOfProcessors) + command = ["build", "-n", NumberOfProcessors] if config["REBUILD_MODE"] and config["REBUILD_MODE"] != "": command.append(config["REBUILD_MODE"]) -- 2.13.3.windows.1