mbox series

[bug#70303,0/2] Use guile-final for grafting.

Message ID cover.1712656502.git.efraim@flashner.co.il
Headers show
Series Use guile-final for grafting. | expand

Message

Efraim Flashner April 9, 2024, 10:03 a.m. UTC
Over the years the grafting code has changed bit by bit, with various
attempts to speed it up.  By switching the grafts to not use parallelism
in rewriting the leaves we can finally switch the guile-for-grafts to be
guile-final.  The segfault is still there if we perform the grafts in
parallel, but I believe it is fast enough that it should be fine to do
them sequentially.

There's probably room in replace-store-references in (guix build graft)
for changes if we're not going to use guile-2.0 here anymore.

There are also a number of default guiles in (guix grafts) which should
maybe be %guile-for-grafts instead of %guile-for-build.

Efraim Flashner (2):
  graft: Remove work-around for old guile.
  graft: Perform grafts with guile-final.

 guix/build/graft.scm | 55 +++++---------------------------------------
 guix/packages.scm    |  6 ++---
 2 files changed, 8 insertions(+), 53 deletions(-)


base-commit: 51de844a0ff6ea224367a384092896bce6848b9f
prerequisite-patch-id: ea387a4f9d860397a26c840c11c8742f0ac70fc3

Comments

Ludovic Courtès April 15, 2024, 8:28 p.m. UTC | #1
Howdy!

Efraim Flashner <efraim@flashner.co.il> skribis:

> Over the years the grafting code has changed bit by bit, with various
> attempts to speed it up.  By switching the grafts to not use parallelism
> in rewriting the leaves we can finally switch the guile-for-grafts to be
> guile-final.  The segfault is still there if we perform the grafts in
> parallel, but I believe it is fast enough that it should be fine to do
> them sequentially.

Could you time the grafting derivation of, say, libreoffice or
ungoogled-chromium?

Typically I’d do it along these lines:

--8<---------------cut here---------------start------------->8---
$ guix build libreoffice
/gnu/store/24is7ypdx6sm56mkclxdx4hyj7yg4smb-libreoffice-7.6.3.1
$ sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
$ time guix build libreoffice --check
The following graft will be made:
   /gnu/store/wdjqpxm2kbdvq7qlrzyjxb244zn3s3bv-libreoffice-7.6.3.1.drv
applying 137 grafts for libreoffice-7.6.3.1 ...
grafting '/gnu/store/5flppg3h8y235di2ilr3sx878gfl82db-libreoffice-7.6.3.1' -> '/gnu/store/24is7ypdx6sm56mkclxdx4hyj7yg4smb-libreoffice-7.6.3.1'...
successfully built /gnu/store/wdjqpxm2kbdvq7qlrzyjxb244zn3s3bv-libreoffice-7.6.3.1.drv
successfully built /gnu/store/wdjqpxm2kbdvq7qlrzyjxb244zn3s3bv-libreoffice-7.6.3.1.drv
/gnu/store/24is7ypdx6sm56mkclxdx4hyj7yg4smb-libreoffice-7.6.3.1

real    0m14.921s
user    0m7.588s
sys     0m0.389s
--8<---------------cut here---------------end--------------->8---

(That’s on my 4-core i7.)

It’s a bummer that the segfault is still there.  I remember week-long
‘rr’ debugging sessions in the past, where I did find a few issues; I
should try again but uh…

> There's probably room in replace-store-references in (guix build graft)
> for changes if we're not going to use guile-2.0 here anymore.

I believe ‘tests/grafts.scm’ may run some of this code under Guile 2.0
(using the ‘guile-bootstrap’ tarball provided for the tests).

Thanks,
Ludo’.
Efraim Flashner April 16, 2024, 2:56 p.m. UTC | #2
On Mon, Apr 15, 2024 at 10:28:17PM +0200, Ludovic Courtès wrote:
> Howdy!
> 
> Efraim Flashner <efraim@flashner.co.il> skribis:
> 
> > Over the years the grafting code has changed bit by bit, with various
> > attempts to speed it up.  By switching the grafts to not use parallelism
> > in rewriting the leaves we can finally switch the guile-for-grafts to be
> > guile-final.  The segfault is still there if we perform the grafts in
> > parallel, but I believe it is fast enough that it should be fine to do
> > them sequentially.
> 
> Could you time the grafting derivation of, say, libreoffice or
> ungoogled-chromium?
> 
> Typically I’d do it along these lines:
> 
> --8<---------------cut here---------------start------------->8---
> $ guix build libreoffice
> /gnu/store/24is7ypdx6sm56mkclxdx4hyj7yg4smb-libreoffice-7.6.3.1
> $ sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
> $ time guix build libreoffice --check
> The following graft will be made:
>    /gnu/store/wdjqpxm2kbdvq7qlrzyjxb244zn3s3bv-libreoffice-7.6.3.1.drv
> applying 137 grafts for libreoffice-7.6.3.1 ...
> grafting '/gnu/store/5flppg3h8y235di2ilr3sx878gfl82db-libreoffice-7.6.3.1' -> '/gnu/store/24is7ypdx6sm56mkclxdx4hyj7yg4smb-libreoffice-7.6.3.1'...
> successfully built /gnu/store/wdjqpxm2kbdvq7qlrzyjxb244zn3s3bv-libreoffice-7.6.3.1.drv
> successfully built /gnu/store/wdjqpxm2kbdvq7qlrzyjxb244zn3s3bv-libreoffice-7.6.3.1.drv
> /gnu/store/24is7ypdx6sm56mkclxdx4hyj7yg4smb-libreoffice-7.6.3.1
> 
> real    0m14.921s
> user    0m7.588s
> sys     0m0.389s
> --8<---------------cut here---------------end--------------->8---
> 
> (That’s on my 4-core i7.)

I'm currently vising my parents for a few weeks during the Passover
break, and I've already lost connection to my desktop at home, so I'm
currently running the tests on my pinebook pro.

The first one is with the patches applied, the second one is without the
patches. I have the guix-daemon on my pinebook pro to use 3 cores, but
I'm not sure how much that would be honored by the grafting code.

(ins)efraim@pbp ~/workspace/guix$ sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
Password:
(ins)efraim@pbp ~/workspace/guix$ time ./pre-inst-env guix build libreoffice --check
The following graft will be made:
   /gnu/store/i2aml4p5yg7h090bdzjpaqmds47g26d8-libreoffice-7.6.3.1.drv
applying 137 grafts for libreoffice-7.6.3.1 ...
grafting '/gnu/store/yd9slkfhdl8lzhhmhm40airimwb6yhj5-libreoffice-7.6.3.1' -> '/gnu/store/1cfjx934czp641v4fmwsz2js7158ivgm-libreoffice-7.6.3.1'...
successfully built /gnu/store/i2aml4p5yg7h090bdzjpaqmds47g26d8-libreoffice-7.6.3.1.drv
successfully built /gnu/store/i2aml4p5yg7h090bdzjpaqmds47g26d8-libreoffice-7.6.3.1.drv
/gnu/store/1cfjx934czp641v4fmwsz2js7158ivgm-libreoffice-7.6.3.1

real    1m35.537s
user    0m32.328s
sys     0m2.521s
(ins)efraim@pbp ~/workspace/guix$ sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
(ins)efraim@pbp ~/workspace/guix$ time guix build libreoffice --check
The following graft will be made:
   /gnu/store/2f6i7r77z8msbjlspsp0aq5vlpjqnifp-libreoffice-7.6.3.1.drv
applying 137 grafts for libreoffice-7.6.3.1 ...
grafting '/gnu/store/yd9slkfhdl8lzhhmhm40airimwb6yhj5-libreoffice-7.6.3.1' -> '/gnu/store/xm3q8qsns8qqybq47zvv70n0y0qs4r65-libreoffice-7.6.3.1'...
successfully built /gnu/store/2f6i7r77z8msbjlspsp0aq5vlpjqnifp-libreoffice-7.6.3.1.drv
successfully built /gnu/store/2f6i7r77z8msbjlspsp0aq5vlpjqnifp-libreoffice-7.6.3.1.drv
/gnu/store/xm3q8qsns8qqybq47zvv70n0y0qs4r65-libreoffice-7.6.3.1

real    1m20.573s
user    0m29.688s
sys     0m2.346s
Ludovic Courtès May 4, 2024, 3:03 p.m. UTC | #3
Hi!

Efraim Flashner <efraim@flashner.co.il> skribis:

> The first one is with the patches applied, the second one is without the
> patches. I have the guix-daemon on my pinebook pro to use 3 cores, but
> I'm not sure how much that would be honored by the grafting code.
>
> (ins)efraim@pbp ~/workspace/guix$ sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
> Password:
> (ins)efraim@pbp ~/workspace/guix$ time ./pre-inst-env guix build libreoffice --check
> The following graft will be made:
>    /gnu/store/i2aml4p5yg7h090bdzjpaqmds47g26d8-libreoffice-7.6.3.1.drv
> applying 137 grafts for libreoffice-7.6.3.1 ...
> grafting '/gnu/store/yd9slkfhdl8lzhhmhm40airimwb6yhj5-libreoffice-7.6.3.1' -> '/gnu/store/1cfjx934czp641v4fmwsz2js7158ivgm-libreoffice-7.6.3.1'...
> successfully built /gnu/store/i2aml4p5yg7h090bdzjpaqmds47g26d8-libreoffice-7.6.3.1.drv
> successfully built /gnu/store/i2aml4p5yg7h090bdzjpaqmds47g26d8-libreoffice-7.6.3.1.drv
> /gnu/store/1cfjx934czp641v4fmwsz2js7158ivgm-libreoffice-7.6.3.1
>
> real    1m35.537s
> user    0m32.328s
> sys     0m2.521s
> (ins)efraim@pbp ~/workspace/guix$ sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
> (ins)efraim@pbp ~/workspace/guix$ time guix build libreoffice --check
> The following graft will be made:
>    /gnu/store/2f6i7r77z8msbjlspsp0aq5vlpjqnifp-libreoffice-7.6.3.1.drv
> applying 137 grafts for libreoffice-7.6.3.1 ...
> grafting '/gnu/store/yd9slkfhdl8lzhhmhm40airimwb6yhj5-libreoffice-7.6.3.1' -> '/gnu/store/xm3q8qsns8qqybq47zvv70n0y0qs4r65-libreoffice-7.6.3.1'...
> successfully built /gnu/store/2f6i7r77z8msbjlspsp0aq5vlpjqnifp-libreoffice-7.6.3.1.drv
> successfully built /gnu/store/2f6i7r77z8msbjlspsp0aq5vlpjqnifp-libreoffice-7.6.3.1.drv
> /gnu/store/xm3q8qsns8qqybq47zvv70n0y0qs4r65-libreoffice-7.6.3.1
>
> real    1m20.573s
> user    0m29.688s
> sys     0m2.346s

That’s an 18% slowdown.  Could you make several runs to see how stable
that is?

Thanks,
Ludo’.