Skip to content

Comments

haskell: tune generic-builder for more parallel build performance#86948

Merged
peti merged 1 commit intoNixOS:haskell-updatesfrom
peti:t/parallel-ghc-builds
May 7, 2020
Merged

haskell: tune generic-builder for more parallel build performance#86948
peti merged 1 commit intoNixOS:haskell-updatesfrom
peti:t/parallel-ghc-builds

Conversation

@peti
Copy link
Member

@peti peti commented May 5, 2020

Raise the maximum number of cores used for parallel building from 4 to 16. Increase the size of the allocation area for GHC's garbage collector from 1 MiB to 64 MiB.

See https://www.twitch.tv/videos/611899011 for the motivation for this change.

@peti peti added the 6.topic: haskell General-purpose, statically typed, purely functional programming language label May 5, 2020
@peti peti requested review from cdepillabout and nh2 May 5, 2020 14:33
Copy link
Contributor

@nh2 nh2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks sensible to me, but one question:

If it is done at the ghcWithPackages level, do/can/will we also have the ability to override it per Haskell package? I am suspecting that there might be certain large packages for which we may need to tune down -j or -A to not consume too much memory on builders that have less than the casual 3 TB RAM.

@peti
Copy link
Member Author

peti commented May 7, 2020

It just occurred to me that the change to the ghcWithPackages wrapper is unnecessary, because you can do the same thing in ~/.cabal/config. Adding

program-default-options
  ghc-options: -j16 +RTS -A64M -RTS

there has the same effect -- at least if you're building with cabal-install. I'm pretty sure an identical mechanism exists for stack, too. So, on second thought I'd rather not introduce yet another location to configure default flags that's specific to Nixpkgs.

@peti peti force-pushed the t/parallel-ghc-builds branch from 9c4ac9c to 7255d30 Compare May 7, 2020 10:55
@peti peti changed the title ghcWithPackages: add ghcOptions argument to pass extra options to the compiler haskell: tune generic-builder for more parallel build performance May 7, 2020
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels May 7, 2020
@peti peti requested review from cdepillabout and nh2 May 7, 2020 11:21
Raise the maximum number of cores used for parallel building from 4 to 16.
Increase the size of the allocation area for GHC's garbage collector from 1 MiB
to 64 MiB.

See https://www.twitch.tv/videos/611899011 for the motivation for this change.
@peti peti force-pushed the t/parallel-ghc-builds branch from 7255d30 to f6df169 Compare May 7, 2020 11:23
@peti
Copy link
Member Author

peti commented May 7, 2020

I'll merge this change to haskell-updates so that we can get some test results from Hydra before the live stream tomorrow.

@peti peti merged commit 6a815f9 into NixOS:haskell-updates May 7, 2020
@peti peti deleted the t/parallel-ghc-builds branch May 7, 2020 17:40
@expipiplus1
Copy link
Contributor

This change causes an uncomfortably high load on my poor machine.

image

I've also noticed loads of 120+ on my 8(16) core desktop, surely this can't be faster.

(sorry if I posted this before somewhere, I thought I did for another machine but couldn't find anything)

wolfgangwalther added a commit to wolfgangwalther/nixpkgs that referenced this pull request Jun 10, 2024
Those flags were not actually passed to GHC before, but to Setup.hs.

They were introduced in NixOS#86948. The related twitch live stream uses the
build of git-annex as a measurement. I get the following numbers when
building git-annex with doCheck = false:

 - for current master: 1:40 wall clock / 340s user
 - without any -A64M argument: 1:40 wall clock / 340s user
 - with this fix: 1:13 wall clock / 280s user

The idea was good, but the settings were never active.

More testing revealed that this seems to work on darwin just as well, so
we're removing the isLinux condition, too.
sternenseemann pushed a commit that referenced this pull request Jun 10, 2024
Those flags were not actually passed to GHC before, but to Setup.hs.

They were introduced in #86948. The related twitch live stream uses the
build of git-annex as a measurement. I get the following numbers when
building git-annex with doCheck = false:

 - for current master: 1:40 wall clock / 340s user
 - without any -A64M argument: 1:40 wall clock / 340s user
 - with this fix: 1:13 wall clock / 280s user

The idea was good, but the settings were never active.

More testing revealed that this seems to work on darwin just as well, so
we're removing the isLinux condition, too.
github-actions bot pushed a commit that referenced this pull request Jun 20, 2024
Those flags were not actually passed to GHC before, but to Setup.hs.

They were introduced in #86948. The related twitch live stream uses the
build of git-annex as a measurement. I get the following numbers when
building git-annex with doCheck = false:

 - for current master: 1:40 wall clock / 340s user
 - without any -A64M argument: 1:40 wall clock / 340s user
 - with this fix: 1:13 wall clock / 280s user

The idea was good, but the settings were never active.

More testing revealed that this seems to work on darwin just as well, so
we're removing the isLinux condition, too.

(cherry picked from commit 3286300)
sternenseemann pushed a commit that referenced this pull request Jun 21, 2024
Those flags were not actually passed to GHC before, but to Setup.hs.

They were introduced in #86948. The related twitch live stream uses the
build of git-annex as a measurement. I get the following numbers when
building git-annex with doCheck = false:

 - for current master: 1:40 wall clock / 340s user
 - without any -A64M argument: 1:40 wall clock / 340s user
 - with this fix: 1:13 wall clock / 280s user

The idea was good, but the settings were never active.

More testing revealed that this seems to work on darwin just as well, so
we're removing the isLinux condition, too.

(cherry picked from commit 3286300)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: haskell General-purpose, statically typed, purely functional programming language 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants