From unknown Sun Jun 22 03:58:34 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#77432] [PATCH core-packages-team] build-system/gnu: Limit load average. Resent-From: Greg Hogan Original-Sender: "Debbugs-submit" Resent-CC: andreas@enge.fr, janneke@gnu.org, ludo@gnu.org, z572@z572.online, guix-patches@gnu.org Resent-Date: Tue, 01 Apr 2025 14:01:11 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 77432 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77432@debbugs.gnu.org Cc: Greg Hogan , Andreas Enge , Janneke Nieuwenhuizen , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Zheng Junjie X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Andreas Enge , Janneke Nieuwenhuizen , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Zheng Junjie Received: via spool by submit@debbugs.gnu.org id=B.17435160334108 (code B ref -1); Tue, 01 Apr 2025 14:01:11 +0000 Received: (at submit) by debbugs.gnu.org; 1 Apr 2025 14:00:33 +0000 Received: from localhost ([127.0.0.1]:47282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tzcAD-00012X-DV for submit@debbugs.gnu.org; Tue, 01 Apr 2025 10:00:31 -0400 Received: from lists.gnu.org ([2001:470:142::17]:33638) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tzc9z-0000y5-9C for submit@debbugs.gnu.org; Tue, 01 Apr 2025 10:00:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzc9Q-0003YQ-EN for guix-patches@gnu.org; Tue, 01 Apr 2025 09:59:42 -0400 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tzc9M-0008QD-84 for guix-patches@gnu.org; Tue, 01 Apr 2025 09:59:34 -0400 Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-4769f3e19a9so38794531cf.0 for ; Tue, 01 Apr 2025 06:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greghogan-com.20230601.gappssmtp.com; s=20230601; t=1743515970; x=1744120770; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=j5EDOcgy8k9S0j8UZ+vRQFMa6qu1kd1hn/m6n2lmqWU=; b=ykbSWmfqD+j1YOagU5dbv7cM42Dp0A1pPwwPoET5RZAGOwm0NXEHOqbhbzopj94213 IwnmIqLRk9SfIGI8qc6h3L3xlMw/yXDLm6y6LGhCGzozzfOGuzhbh8qBv2SNqtJqkUrl B4bOAzqRLCXUy1z/lQYn+m2q9LwQ0Hv2LxgvcgRj2nrF13gb4qBvm7pzUoK6ze+00Edt qDeDOaRtjPQeKunfurlr+oWWleu24tQdRiWC26mHSdtsSAuXU1PvHmyEH5PsBYW9QSOB SqNv1awjuXpsDXELhngTAE0C59fCv/PXkrlyoMa8TbF1xTMAg9evzVQ06S84JqQUr5tN G/jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743515970; x=1744120770; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=j5EDOcgy8k9S0j8UZ+vRQFMa6qu1kd1hn/m6n2lmqWU=; b=Fh6Wcg4kvnlHpmgNA+Ug6pkrpfo84Nc4t3Aq/mfyMY27fuEnnJroIraMrnwAsamyY/ wyo1Y8wIMgkKYw9O2yYk/T5z+1nY8ErZVqbgEcstIpa25hzv33fFQCEp20vA7pHkKJ4c 4hHDXSmYMIB3mN2Q+o20ve96p0DBu2296bK/V/XQGR3e2AehkSRNIW/o9QZjUSsnX+h+ 3sMNH5eaDQHgelNCe4hnwNq6nFsLF0bEsw7+TpVuLMJj0yUS78C5GG82rNZcRy0wUm3f wM4mHh5iiYuPAhMWEQ+pjbHX402ng9EKbUWTDd8WKWejvEIdKw82nvzybsXldNDRpzV5 jdmA== X-Gm-Message-State: AOJu0YxdzdwZO1x0jHFOXpt3/qWFRKe/VqFY5sxRFKxjtR4zzYqiO21N u1pH0Yr/U1eP3Knc4KgVLPKULo32XYzeNLBxAQcBBIUTR/S0vdX+ckqfHmVTdsSxJTV5hKg6T6s W X-Gm-Gg: ASbGncu9w1QiFRbcZOPyMJNDGiQnbVErpmSspGbbOQKgN2be7hIITWwOROxZUhE1xNT hDItUpkM7aTXJF3ifsb0apbZ34WltitTKeFqrWjrABbzEqv1fyekYw0SpIXXpB+u0tbwBnqqy81 edoPN8PTtF5ak8PUg27KOakZ7YoldyUTOjuumPrHjqlikOyTn63cA0QDWmImWXHK8RP05/lO36X dxiLNPUtjdtvS1+WUDmWTiCz0/qursRUi6nH+OBhHfbcVW2+zfMfYPiON/4NECqWWWcxNb+0tO+ KqfrKVZWgtPu1/Jd/T8heAiAQsq17JdhgAetn6SsrOCjRiEk1R5bxWnHq4a7p35TECZcJ3nSsDj ab+Qkt4N6d+vzlH4upeFW0tR60bbtjxBcX77Rnfwlc5GV X-Google-Smtp-Source: AGHT+IHko8dDisZpUFW1GuRSZ8GozbIerud0xhKNF0YQwY3oRSiPrGeq8DhZdyW021ZvuTM95MKuZg== X-Received: by 2002:ac8:5856:0:b0:476:add4:d2c3 with SMTP id d75a77b69052e-477f79d41e8mr167849531cf.38.1743515969841; Tue, 01 Apr 2025 06:59:29 -0700 (PDT) Received: from ip-10-117-149-49.evoforge.org (ec2-52-70-167-183.compute-1.amazonaws.com. [52.70.167.183]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-478b26f3968sm51775541cf.41.2025.04.01.06.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 06:59:29 -0700 (PDT) From: Greg Hogan Date: Tue, 1 Apr 2025 13:58:17 +0000 Message-ID: <8f564ac84639c8ff547e94843415744e7ca4ac12.1743512359.git.code@greghogan.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=2607:f8b0:4864:20::833; envelope-from=code@greghogan.com; helo=mail-qt1-x833.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) A nice feature of offload builds is that Guix will throttle the start of new jobs based on the overload-threshold. There is no equivalent for local builds, so one must either run builds in serial (--max-jobs=1) and endure single-threaded builds or run concurrent builds and watch the system overload as it runs multiple multi-threaded builds. I have been testing this "max-load" setting in both the gnu (attached) and cmake (soon on the c++-team branch) build systems. Both make and ninja will delay starting a new build action when the system is overloaded (the number of running processes is greater than, as configured below, the number of processors). ctest has a similar option "test-load" which compares against system load. >From the following benchmark comparing the compilation of concurrent Folly builds, the "max-load" option reduced the overall time by 8.3%. Memory use also drops considerably since we are only running 1/4 of the processes at any time. If this is too late for inclusion in the core-packages-team branch, I would appreciate consideration from the team for inclusion on the c++-team branch. --8<---------------cut here---------------start------------->8--- $ guix shell -D folly $ CONCURRENT=4 $ for i in `seq 1 $CONCURRENT` ; do rm -rf build$i ; mkdir build$i ; cd build$i ; cmake ../folly & cd .. ; done ; wait $ time bash -c 'for i in `seq 1 '$CONCURRENT'` ; do cd build$i ; make -j`nproc` -l`nproc` & cd .. ; done ; wait' real 2m18.669s user 28m41.383s sys 4m35.790s $ for i in `seq 1 $CONCURRENT` ; do rm -rf build$i ; mkdir build$i ; cd build$i ; cmake ../folly & cd .. ; done ; wait $ time bash -c 'for i in `seq 1 '$CONCURRENT'` ; do cd build$i ; make -j`nproc`& cd .. ; done ; wait' real 2m31.158s user 30m44.591s sys 4m34.438s --8<---------------cut here---------------end--------------->8--- * guix/build/gnu-build-system.scm (build, check): Set max load. Change-Id: I97f1e3e59880b6ed23faed2038eb5279415e9c95 --- guix/build/gnu-build-system.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 0b94416a8d..e324c3488c 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -28,6 +28,7 @@ (define-module (guix build gnu-build-system) #:use-module (ice-9 regex) #:use-module (ice-9 format) #:use-module (ice-9 ftw) + #:use-module (ice-9 threads) #:use-module (srfi srfi-1) #:use-module (srfi srfi-19) #:use-module (srfi srfi-34) @@ -385,7 +386,9 @@ (define* (build #:key (make-flags '()) (parallel-build? #t) #:allow-other-keys) (apply invoke "make" `(,@(if parallel-build? - `("-j" ,(number->string (parallel-job-count))) + `("-j" ,(number->string (parallel-job-count)) + ,(string-append "--max-load=" + (number->string (total-processor-count)))) '()) ,@make-flags))) @@ -424,7 +427,9 @@ (define* (check #:key target (make-flags '()) (tests? (not target)) (raise c))) (apply invoke "make" test-target `(,@(if parallel-tests? - `("-j" ,(number->string (parallel-job-count))) + `("-j" ,(number->string (parallel-job-count)) + ,(string-append "--max-load=" + (number->string (total-processor-count)))) '()) ,@make-flags))) (format #t "test suite not run~%"))) base-commit: eb04a0d2c955f5fa9a721537c8202fc5c5959b19 -- 2.49.0 From unknown Sun Jun 22 03:58:34 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Greg Hogan Subject: bug#77432: closed (Re: [bug#77432] [PATCH core-packages-team] build-system/gnu: Limit load average.) Message-ID: References: <877c418vkw.fsf@gnu.org> <8f564ac84639c8ff547e94843415744e7ca4ac12.1743512359.git.code@greghogan.com> X-Gnu-PR-Message: they-closed 77432 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 77432@debbugs.gnu.org Date: Thu, 03 Apr 2025 09:05:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1743671102-2092-1" This is a multi-part message in MIME format... ------------=_1743671102-2092-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #77432: [PATCH core-packages-team] build-system/gnu: Limit load average. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 77432@debbugs.gnu.org. --=20 77432: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77432 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1743671102-2092-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 77432-done) by debbugs.gnu.org; 3 Apr 2025 09:04:51 +0000 Received: from localhost ([127.0.0.1]:32802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u0GVH-0000XH-65 for submit@debbugs.gnu.org; Thu, 03 Apr 2025 05:04:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60192) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u0GVD-0000Wz-W4 for 77432-done@debbugs.gnu.org; Thu, 03 Apr 2025 05:04:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u0GV7-0003i8-1s; Thu, 03 Apr 2025 05:04:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=lXR4xHsqvGlZOfclOY31Q4lf3/QRQNqheINhhNAGAdA=; b=ctcHRv4EdkRcddkm329E GbafPU/uSP0mx75fuTrDdwTtJK4lD+QIp5O59iAX0JU5MggiOkGhEv5YLNDi8yTmDGKV4DzbAAQiV o71X7XQlwGuQ/dnuEm5ogzV4RXsP5KWMUZHGWTrr/a90LY6Lcl2T741xDZrbZi8kKux0sNpfpLTOf fUJhRahuNHurXpSfs56gQXEj4MYG4O52Ufiihtg3BJSc/qXKpeM6yBMX1f3V/g7jlZJWWyBJROSPi RjDWXPfjDEZaBHitvETLEF6MF/5KsFWeVl6DJsG1jinEd55o8EMD5du0N15kNT4t6xZp6JMNbMA9k X0IMB1SHftiJjg==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Greg Hogan Subject: Re: [bug#77432] [PATCH core-packages-team] build-system/gnu: Limit load average. In-Reply-To: <8f564ac84639c8ff547e94843415744e7ca4ac12.1743512359.git.code@greghogan.com> (Greg Hogan's message of "Tue, 1 Apr 2025 13:58:17 +0000") References: <8f564ac84639c8ff547e94843415744e7ca4ac12.1743512359.git.code@greghogan.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Quartidi 14 Germinal an 233 de la =?utf-8?Q?R=C3=A9v?= =?utf-8?Q?olution=2C?= jour du =?utf-8?Q?H=C3=AAtre?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 03 Apr 2025 11:04:31 +0200 Message-ID: <877c418vkw.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77432-done Cc: 77432-done@debbugs.gnu.org, Zheng Junjie , Andreas Enge , Janneke Nieuwenhuizen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Greg, Greg Hogan skribis: > A nice feature of offload builds is that Guix will throttle the start of = new > jobs based on the overload-threshold. There is no equivalent for local bu= ilds, > so one must either run builds in serial (--max-jobs=3D1) and endure > single-threaded builds or run concurrent builds and watch the system over= load > as it runs multiple multi-threaded builds. > > I have been testing this "max-load" setting in both the gnu (attached) an= d cmake > (soon on the c++-team branch) build systems. Both make and ninja will del= ay > starting a new build action when the system is overloaded (the number of = running > processes is greater than, as configured below, the number of processors). > ctest has a similar option "test-load" which compares against system load. > > From the following benchmark comparing the compilation of concurrent Folly > builds, the "max-load" option reduced the overall time by 8.3%. Memory us= e also > drops considerably since we are only running 1/4 of the processes at any = time. > > If this is too late for inclusion in the core-packages-team branch, I wou= ld > appreciate consideration from the team for inclusion on the c++-team bran= ch. It=E2=80=99s not too late since we=E2=80=99re waiting for bug fixes in Gash= to land. I stripped the commit log a bit and applied it. Thanks for this welcome improvement! Ludo=E2=80=99. ------------=_1743671102-2092-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 1 Apr 2025 14:00:33 +0000 Received: from localhost ([127.0.0.1]:47282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tzcAD-00012X-DV for submit@debbugs.gnu.org; Tue, 01 Apr 2025 10:00:31 -0400 Received: from lists.gnu.org ([2001:470:142::17]:33638) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tzc9z-0000y5-9C for submit@debbugs.gnu.org; Tue, 01 Apr 2025 10:00:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzc9Q-0003YQ-EN for guix-patches@gnu.org; Tue, 01 Apr 2025 09:59:42 -0400 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tzc9M-0008QD-84 for guix-patches@gnu.org; Tue, 01 Apr 2025 09:59:34 -0400 Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-4769f3e19a9so38794531cf.0 for ; Tue, 01 Apr 2025 06:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greghogan-com.20230601.gappssmtp.com; s=20230601; t=1743515970; x=1744120770; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=j5EDOcgy8k9S0j8UZ+vRQFMa6qu1kd1hn/m6n2lmqWU=; b=ykbSWmfqD+j1YOagU5dbv7cM42Dp0A1pPwwPoET5RZAGOwm0NXEHOqbhbzopj94213 IwnmIqLRk9SfIGI8qc6h3L3xlMw/yXDLm6y6LGhCGzozzfOGuzhbh8qBv2SNqtJqkUrl B4bOAzqRLCXUy1z/lQYn+m2q9LwQ0Hv2LxgvcgRj2nrF13gb4qBvm7pzUoK6ze+00Edt qDeDOaRtjPQeKunfurlr+oWWleu24tQdRiWC26mHSdtsSAuXU1PvHmyEH5PsBYW9QSOB SqNv1awjuXpsDXELhngTAE0C59fCv/PXkrlyoMa8TbF1xTMAg9evzVQ06S84JqQUr5tN G/jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743515970; x=1744120770; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=j5EDOcgy8k9S0j8UZ+vRQFMa6qu1kd1hn/m6n2lmqWU=; b=Fh6Wcg4kvnlHpmgNA+Ug6pkrpfo84Nc4t3Aq/mfyMY27fuEnnJroIraMrnwAsamyY/ wyo1Y8wIMgkKYw9O2yYk/T5z+1nY8ErZVqbgEcstIpa25hzv33fFQCEp20vA7pHkKJ4c 4hHDXSmYMIB3mN2Q+o20ve96p0DBu2296bK/V/XQGR3e2AehkSRNIW/o9QZjUSsnX+h+ 3sMNH5eaDQHgelNCe4hnwNq6nFsLF0bEsw7+TpVuLMJj0yUS78C5GG82rNZcRy0wUm3f wM4mHh5iiYuPAhMWEQ+pjbHX402ng9EKbUWTDd8WKWejvEIdKw82nvzybsXldNDRpzV5 jdmA== X-Gm-Message-State: AOJu0YxdzdwZO1x0jHFOXpt3/qWFRKe/VqFY5sxRFKxjtR4zzYqiO21N u1pH0Yr/U1eP3Knc4KgVLPKULo32XYzeNLBxAQcBBIUTR/S0vdX+ckqfHmVTdsSxJTV5hKg6T6s W X-Gm-Gg: ASbGncu9w1QiFRbcZOPyMJNDGiQnbVErpmSspGbbOQKgN2be7hIITWwOROxZUhE1xNT hDItUpkM7aTXJF3ifsb0apbZ34WltitTKeFqrWjrABbzEqv1fyekYw0SpIXXpB+u0tbwBnqqy81 edoPN8PTtF5ak8PUg27KOakZ7YoldyUTOjuumPrHjqlikOyTn63cA0QDWmImWXHK8RP05/lO36X dxiLNPUtjdtvS1+WUDmWTiCz0/qursRUi6nH+OBhHfbcVW2+zfMfYPiON/4NECqWWWcxNb+0tO+ KqfrKVZWgtPu1/Jd/T8heAiAQsq17JdhgAetn6SsrOCjRiEk1R5bxWnHq4a7p35TECZcJ3nSsDj ab+Qkt4N6d+vzlH4upeFW0tR60bbtjxBcX77Rnfwlc5GV X-Google-Smtp-Source: AGHT+IHko8dDisZpUFW1GuRSZ8GozbIerud0xhKNF0YQwY3oRSiPrGeq8DhZdyW021ZvuTM95MKuZg== X-Received: by 2002:ac8:5856:0:b0:476:add4:d2c3 with SMTP id d75a77b69052e-477f79d41e8mr167849531cf.38.1743515969841; Tue, 01 Apr 2025 06:59:29 -0700 (PDT) Received: from ip-10-117-149-49.evoforge.org (ec2-52-70-167-183.compute-1.amazonaws.com. [52.70.167.183]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-478b26f3968sm51775541cf.41.2025.04.01.06.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 06:59:29 -0700 (PDT) From: Greg Hogan To: guix-patches@gnu.org Subject: [PATCH core-packages-team] build-system/gnu: Limit load average. Date: Tue, 1 Apr 2025 13:58:17 +0000 Message-ID: <8f564ac84639c8ff547e94843415744e7ca4ac12.1743512359.git.code@greghogan.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-Debbugs-Cc: Andreas Enge , Janneke Nieuwenhuizen , Ludovic Courtès , Zheng Junjie Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=2607:f8b0:4864:20::833; envelope-from=code@greghogan.com; helo=mail-qt1-x833.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit Cc: Greg Hogan X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) A nice feature of offload builds is that Guix will throttle the start of new jobs based on the overload-threshold. There is no equivalent for local builds, so one must either run builds in serial (--max-jobs=1) and endure single-threaded builds or run concurrent builds and watch the system overload as it runs multiple multi-threaded builds. I have been testing this "max-load" setting in both the gnu (attached) and cmake (soon on the c++-team branch) build systems. Both make and ninja will delay starting a new build action when the system is overloaded (the number of running processes is greater than, as configured below, the number of processors). ctest has a similar option "test-load" which compares against system load. >From the following benchmark comparing the compilation of concurrent Folly builds, the "max-load" option reduced the overall time by 8.3%. Memory use also drops considerably since we are only running 1/4 of the processes at any time. If this is too late for inclusion in the core-packages-team branch, I would appreciate consideration from the team for inclusion on the c++-team branch. --8<---------------cut here---------------start------------->8--- $ guix shell -D folly $ CONCURRENT=4 $ for i in `seq 1 $CONCURRENT` ; do rm -rf build$i ; mkdir build$i ; cd build$i ; cmake ../folly & cd .. ; done ; wait $ time bash -c 'for i in `seq 1 '$CONCURRENT'` ; do cd build$i ; make -j`nproc` -l`nproc` & cd .. ; done ; wait' real 2m18.669s user 28m41.383s sys 4m35.790s $ for i in `seq 1 $CONCURRENT` ; do rm -rf build$i ; mkdir build$i ; cd build$i ; cmake ../folly & cd .. ; done ; wait $ time bash -c 'for i in `seq 1 '$CONCURRENT'` ; do cd build$i ; make -j`nproc`& cd .. ; done ; wait' real 2m31.158s user 30m44.591s sys 4m34.438s --8<---------------cut here---------------end--------------->8--- * guix/build/gnu-build-system.scm (build, check): Set max load. Change-Id: I97f1e3e59880b6ed23faed2038eb5279415e9c95 --- guix/build/gnu-build-system.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 0b94416a8d..e324c3488c 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -28,6 +28,7 @@ (define-module (guix build gnu-build-system) #:use-module (ice-9 regex) #:use-module (ice-9 format) #:use-module (ice-9 ftw) + #:use-module (ice-9 threads) #:use-module (srfi srfi-1) #:use-module (srfi srfi-19) #:use-module (srfi srfi-34) @@ -385,7 +386,9 @@ (define* (build #:key (make-flags '()) (parallel-build? #t) #:allow-other-keys) (apply invoke "make" `(,@(if parallel-build? - `("-j" ,(number->string (parallel-job-count))) + `("-j" ,(number->string (parallel-job-count)) + ,(string-append "--max-load=" + (number->string (total-processor-count)))) '()) ,@make-flags))) @@ -424,7 +427,9 @@ (define* (check #:key target (make-flags '()) (tests? (not target)) (raise c))) (apply invoke "make" test-target `(,@(if parallel-tests? - `("-j" ,(number->string (parallel-job-count))) + `("-j" ,(number->string (parallel-job-count)) + ,(string-append "--max-load=" + (number->string (total-processor-count)))) '()) ,@make-flags))) (format #t "test suite not run~%"))) base-commit: eb04a0d2c955f5fa9a721537c8202fc5c5959b19 -- 2.49.0 ------------=_1743671102-2092-1--