GNU bug report logs - #49919
[PATCH core-updates 0/2] build-system/go: Enable parallelism.

Previous Next

Package: guix-patches;

Reported by: Sarah Morgensen <iskarian <at> mgsn.dev>

Date: Sat, 7 Aug 2021 04:47:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49919 in the body.
You can then email your comments to 49919 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#49919; Package guix-patches. (Sat, 07 Aug 2021 04:47:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sarah Morgensen <iskarian <at> mgsn.dev>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 07 Aug 2021 04:47:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: guix-patches <at> gnu.org
Subject: [PATCH core-updates 0/2] build-system/go: Enable parallelism.
Date: Fri,  6 Aug 2021 21:45:57 -0700
Hello Guix,

These patches give the Go build system the standard parallelism levers. I would
have thought that Go was already detecting the correct number for GOMAXPROCS,
but after I made this same change for the bootstrapping Go compiler, Efraim
found that it cut the build time nearly in half [0].

[0] https://issues.guix.gnu.org/49616

--
Sarah Morgensen (2):
  build-system/go: Honor #:parallel-build?.
  build-system/go: Honor #:parallel-tests?.

 guix/build-system/go.scm       |  5 +++++
 guix/build/go-build-system.scm | 12 ++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)


base-commit: 693d75e859150601145b7f7303f61d4f48e76927
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#49919; Package guix-patches. (Sat, 07 Aug 2021 04:49:01 GMT) Full text and rfc822 format available.

Message #8 received at 49919 <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: 49919 <at> debbugs.gnu.org
Subject: [PATCH core-updates 1/2] build-system/go: Honor #:parallel-build?.
Date: Fri,  6 Aug 2021 21:48:33 -0700
guix/build/go-build-system.scm (build): Honor #:parallel-build?.
guix/build-system/go.scm (go-build): Add PARALLEL-BUILD? parameter.
[builder]: Use it.
---
 guix/build-system/go.scm       | 3 +++
 guix/build/go-build-system.scm | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index 100d1db4b6..a5aa21b99e 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2017 Leo Famulari <leo <at> famulari.name>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;; Copyright © 2021 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -129,6 +130,7 @@ commit hash and its date rather than a proper release tag."
                    (unpack-path "")
                    (build-flags ''())
                    (tests? #t)
+                   (parallel-build? #t)
                    (allow-go-reference? #f)
                    (system (%current-system))
                    (guile #f)
@@ -153,6 +155,7 @@ commit hash and its date rather than a proper release tag."
                     #:unpack-path #$unpack-path
                     #:build-flags #$build-flags
                     #:tests? #$tests?
+                    #:parallel-build? #$parallel-build?
                     #:allow-go-reference? #$allow-go-reference?
                     #:inputs #$(input-tuples->gexp inputs)))))
 
diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 227df820db..521bad9667 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2020 Jack Hill <jackhill <at> jackhill.us>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;; Copyright © 2020 Efraim Flashner <efraim <at> flashner.co.il>
+;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -216,8 +217,12 @@ unpacking."
                 (_ #f))
               inputs))))
 
-(define* (build #:key import-path build-flags #:allow-other-keys)
+(define* (build #:key import-path build-flags (parallel-build? #t)
+                #:allow-other-keys)
   "Build the package named by IMPORT-PATH."
+  (let* ((njobs (if parallel-build? (parallel-job-count) 1)))
+    (setenv "GOMAXPROCS" (number->string njobs)))
+
   (with-throw-handler
     #t
     (lambda _
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#49919; Package guix-patches. (Sat, 07 Aug 2021 04:49:02 GMT) Full text and rfc822 format available.

Message #11 received at 49919 <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: 49919 <at> debbugs.gnu.org
Subject: [PATCH core-updates 2/2] build-system/go: Honor #:parallel-tests?.
Date: Fri,  6 Aug 2021 21:48:34 -0700
guix/build/go-build-system.scm (build): Honor #:parallel-tests?.
guix/build-system/go.scm (go-build): Add PARALLEL-TESTS? parameter.
[builder]: Use it.
---
 guix/build-system/go.scm       | 2 ++
 guix/build/go-build-system.scm | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index a5aa21b99e..7b66163779 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -131,6 +131,7 @@ commit hash and its date rather than a proper release tag."
                    (build-flags ''())
                    (tests? #t)
                    (parallel-build? #t)
+                   (parallel-tests? #t)
                    (allow-go-reference? #f)
                    (system (%current-system))
                    (guile #f)
@@ -156,6 +157,7 @@ commit hash and its date rather than a proper release tag."
                     #:build-flags #$build-flags
                     #:tests? #$tests?
                     #:parallel-build? #$parallel-build?
+                    #:parallel-tests? #$parallel-tests?
                     #:allow-go-reference? #$allow-go-reference?
                     #:inputs #$(input-tuples->gexp inputs)))))
 
diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 521bad9667..0ad580a484 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -239,9 +239,12 @@ unpacking."
       (invoke "go" "env"))))
 
 ;; Can this also install commands???
-(define* (check #:key tests? import-path #:allow-other-keys)
+(define* (check #:key tests? import-path (parallel-tests? #t)
+                #:allow-other-keys)
   "Run the tests for the package named by IMPORT-PATH."
   (when tests?
+    (let* ((njobs (if parallel-tests? (parallel-job-count) 1)))
+      (setenv "GOMAXPROCS" (number->string njobs)))
     (invoke "go" "test" import-path))
   #t)
 
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#49919; Package guix-patches. (Thu, 19 Aug 2021 15:15:02 GMT) Full text and rfc822 format available.

Message #14 received at 49919 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Sarah Morgensen <iskarian <at> mgsn.dev>
Cc: 49919 <at> debbugs.gnu.org
Subject: Re: bug#49919: [PATCH core-updates 0/2] build-system/go: Enable
 parallelism.
Date: Thu, 19 Aug 2021 17:13:52 +0200
Hello Sarah,

> These patches give the Go build system the standard parallelism levers. I would
> have thought that Go was already detecting the correct number for GOMAXPROCS,
> but after I made this same change for the bootstrapping Go compiler, Efraim
> found that it cut the build time nearly in half [0].

This looks good, but I'd rather have Cuirass fixed before pushing this
series so that we can evaluate the impact on all Go packages and
potentially find some regressions.

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#49919; Package guix-patches. (Tue, 31 Aug 2021 10:17:01 GMT) Full text and rfc822 format available.

Message #17 received at 49919 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Sarah Morgensen <iskarian <at> mgsn.dev>, 49919 <at> debbugs.gnu.org
Subject: Re: [bug#49919] [PATCH core-updates 0/2] build-system/go: Enable
 parallelism.
Date: Tue, 31 Aug 2021 12:03:19 +0200
Hi,

On Fri, 06 Aug 2021 at 21:45, Sarah Morgensen <iskarian <at> mgsn.dev> wrote:

> These patches give the Go build system the standard parallelism levers. I would
> have thought that Go was already detecting the correct number for GOMAXPROCS,
> but after I made this same change for the bootstrapping Go compiler, Efraim
> found that it cut the build time nearly in half [0].
>
> [0] https://issues.guix.gnu.org/49616

Honoring the parallelism, do the Go packages still build
deterministically?  If not, the default should be still non parallel, as
it is for Haskell packages, IIRC.  However, maybe there is room for a
package transformation ’--with-parallelism’ to easily turn on when speed
matters more than reproducibility.

All the best,
simon




Information forwarded to guix-patches <at> gnu.org:
bug#49919; Package guix-patches. (Tue, 31 Aug 2021 16:07:02 GMT) Full text and rfc822 format available.

Message #20 received at 49919 <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: 49919 <at> debbugs.gnu.org
Subject: Re: [bug#49919] [PATCH core-updates 0/2] build-system/go: Enable
 parallelism.
Date: Tue, 31 Aug 2021 09:06:17 -0700
Hello,

zimoun <zimon.toutoune <at> gmail.com> writes:

> Hi,
>
> On Fri, 06 Aug 2021 at 21:45, Sarah Morgensen <iskarian <at> mgsn.dev> wrote:
>
>> These patches give the Go build system the standard parallelism levers. I would
>> have thought that Go was already detecting the correct number for GOMAXPROCS,
>> but after I made this same change for the bootstrapping Go compiler, Efraim
>> found that it cut the build time nearly in half [0].
>>
>> [0] https://issues.guix.gnu.org/49616
>
> Honoring the parallelism, do the Go packages still build
> deterministically?  If not, the default should be still non parallel, as
> it is for Haskell packages, IIRC.  However, maybe there is room for a
> package transformation ’--with-parallelism’ to easily turn on when speed
> matters more than reproducibility.

I haven't personally tested this aside from a few casual runs with
--check, but from everything I understand about Go, parallelism does not
affect build determinism.  Each build unit should still be compiled by a
single worker sequentially, but parallelism enables separate build units
to be compiled in parallel.

--
Sarah




Information forwarded to guix-patches <at> gnu.org:
bug#49919; Package guix-patches. (Wed, 15 Dec 2021 10:37:02 GMT) Full text and rfc822 format available.

Message #23 received at 49919 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: Sarah Morgensen <iskarian <at> mgsn.dev>, 49919 <at> debbugs.gnu.org
Subject: Re: [bug#49919] [PATCH core-updates 0/2] build-system/go: Enable
 parallelism.
Date: Wed, 15 Dec 2021 12:35:25 +0200
[Message part 1 (text/plain, inline)]
On Thu, Aug 19, 2021 at 05:13:52PM +0200, Mathieu Othacehe wrote:
> 
> Hello Sarah,
> 
> > These patches give the Go build system the standard parallelism levers. I would
> > have thought that Go was already detecting the correct number for GOMAXPROCS,
> > but after I made this same change for the bootstrapping Go compiler, Efraim
> > found that it cut the build time nearly in half [0].
> 
> This looks good, but I'd rather have Cuirass fixed before pushing this
> series so that we can evaluate the impact on all Go packages and
> potentially find some regressions.
> 

Friendly ping to see if Cuirass is ready for these patches to be pushed.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#49919; Package guix-patches. (Wed, 15 Dec 2021 10:44:02 GMT) Full text and rfc822 format available.

Message #26 received at 49919 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: Sarah Morgensen <iskarian <at> mgsn.dev>, 49919 <at> debbugs.gnu.org
Subject: Re: [bug#49919] [PATCH core-updates 0/2] build-system/go: Enable
 parallelism.
Date: Wed, 15 Dec 2021 11:43:25 +0100
Hey,

> Friendly ping to see if Cuirass is ready for these patches to be pushed.

Not really, I need to reconfigure Berlin and I'm hitting multiple
issues, such as a php build failure :(.

Mathieu




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Sat, 20 Jan 2024 20:51:02 GMT) Full text and rfc822 format available.

Notification sent to Sarah Morgensen <iskarian <at> mgsn.dev>:
bug acknowledged by developer. (Sat, 20 Jan 2024 20:51:02 GMT) Full text and rfc822 format available.

Message #31 received at 49919-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 49919-done <at> debbugs.gnu.org, Sarah Morgensen <iskarian <at> mgsn.dev>,
 Efraim Flashner <efraim <at> flashner.co.il>
Subject: Re: [bug#49919] [PATCH core-updates 0/2] build-system/go: Enable
 parallelism.
Date: Sat, 20 Jan 2024 15:49:53 -0500
Hello,

Mathieu Othacehe <othacehe <at> gnu.org> writes:

> Hey,
>
>> Friendly ping to see if Cuirass is ready for these patches to be pushed.
>
> Not really, I need to reconfigure Berlin and I'm hitting multiple
> issues, such as a php build failure :(.

Queued for applying locally, at last.  Closing.

-- 
Thanks,
Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Feb 2024 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 67 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.