From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9A84E21F833AC for ; Mon, 8 Jan 2018 23:53:41 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2018 23:58:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,334,1511856000"; d="scan'208";a="193344456" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga005.fm.intel.com with ESMTP; 08 Jan 2018 23:58:51 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 8 Jan 2018 23:58:51 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Tue, 9 Jan 2018 15:58:49 +0800 From: "Zhu, Yonghong" To: "Feng, YunhuaX" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH] BaseTools: Enable MAX_CONCURRENT_THREAD_NUMBER = 0 feature Thread-Index: AdOI7vrsrX91X5TkRSqLZ78xTbEIFQAMGqBA Date: Tue, 9 Jan 2018 07:58:48 +0000 Message-ID: References: <47C64442C08CCD4089DC43B6B5E46BC4818F51@shsmsx102.ccr.corp.intel.com> In-Reply-To: <47C64442C08CCD4089DC43B6B5E46BC4818F51@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools: Enable MAX_CONCURRENT_THREAD_NUMBER = 0 feature X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 07:53:42 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Yunhua, Please separate this patch into two. And remember to update copyright year. Best Regards, Zhu Yonghong -----Original Message----- From: Feng, YunhuaX=20 Sent: Tuesday, January 09, 2018 10:14 AM To: edk2-devel@lists.01.org Cc: Feng, YunhuaX ; Zhu, Yonghong ; Gao, Liming Subject: [PATCH] BaseTools: Enable MAX_CONCURRENT_THREAD_NUMBER =3D 0 featu= re Adding 'MAX_CONCURRENT_THREAD_NUMBER=3D0' option for user to enable 'auto-d= etect thread number' feature, and changing default value to '0' when initia= l build environment is configured. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=3D775 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Conf/target.template | 5 +++-- BaseTools/Source/Python/build/build.py | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git BaseTools/Conf/target.template BaseTools/Conf/target.template in= dex 787fc64fb1..ee8745610f 100644 --- BaseTools/Conf/target.template +++ BaseTools/Conf/target.template @@ -61,8 +61,9 @@ TOOL_CHAIN_TAG =3D MYTOOLS =20 # MAX_CONCURRENT_THREAD_NUMBER NUMBER Optional The number of concurrent= threads. Recommend to set this # value to one more than t= he number of your compurter -# cores or CPUs. Less than= 2 means disable multithread build. -MAX_CONCURRENT_THREAD_NUMBER =3D 1 +# cores or CPUs. automatic= ally detect number of processor threads +# when 'MAX_CONCURRENT_THR= EAD_NUMBER=3D0' +MAX_CONCURRENT_THREAD_NUMBER =3D 0 =20 =20 # BUILD_RULE_CONF Filename Optional Specify the file name to use for the= build rules that are followed diff --git BaseTools/Source/Python/build/bui= ld.py BaseTools/Source/Python/build/build.py index 38498046d7..fd2681e05d 100644 --- BaseTools/Source/Python/build/build.py +++ BaseTools/Source/Python/build/build.py @@ -26,6 +26,7 @@ import platform import traceback import encodings.ascii import itertools +import multiprocessing =20 from struct import * from threading import * @@ -936,7 +937,10 @@ class Build(): self.ThreadNumber =3D int(self.ThreadNumber, 0) =20 if self.ThreadNumber =3D=3D 0: - self.ThreadNumber =3D 1 + try: + self.ThreadNumber =3D multiprocessing.cpu_count() + except (ImportError, NotImplementedError): + self.ThreadNumber =3D 1 =20 if not self.PlatformFile: PlatformFile =3D self.TargetTxt.TargetTxtDictionary[DataType.T= AB_TAT_DEFINES_ACTIVE_PLATFORM] -- 2.12.2.windows.2