[Nix-dev] Parallel building support, 1st attempt

Marc Weber marco-oweber at gmx.de
Tue Jun 22 18:10:02 CEST 2010


> Let me know what you think, please.
Hi Peter,

I'd like to see an option choosing between opt-in and opt-out. I'd like
to see opt-out because opting all packages in is too much work and will
never be done. I can live with the risk.
Unless I'm the only one asking for this feature ignore it.

Differences to my implementation:

  NIX_BUILD_CORES is passed always. Its up to the build script to opt-out. 
  Nothing wrong with that.

  You only pass one env var. I passed one for both: -j and -l option.
  Using one env var is probably a good approximation. I don't know yet
  whether there are real world uses cases where you want to pass both.
  Eg when IO is very slow you may want to start as much processes as
  possible so that you still get a nice CPU load. Does this happen in
  practise?

You may want to go back to my reverted implementation and have a look at
some opt-outs I made. Often I had to opt-out the install phase only.
Does your patch allow that?
Eg follow the discussion here again (Ludo saying that -j is important
for the build phase only):
http://thread.gmane.org/gmane.linux.distributions.nixos.scm/130/focus=4325

I think that Ludo was in favour of having two opt-ins:
  parallelInstall = true;
  parallelCheck = true;
I (as well as Ludo?) expect these two phases to be the most important.
Check phase is not used that often. Yet it can take a lot of time
(automake or such). Unfortunately I didn't see a patch of him showing how to 
read those opt-ins in the nicest way. Probably I'd go for adding this
twice:

make ... many flags .. $([ -z "$parallelInstall"] || echo $parallelBuildFlags )
(because runMake was considered being too complicated)
Of course this would become more complicated if we want to choose
between opt-in or opt-out.

OT:
I looked at my CPU load again when running
nixos-rebuild swtich two days ago. It was 1.4 (1,5 and 15min average).
However I have 4 cores.  So this is less than perfect. I guess building
in parallel would have risen the figure to 3 at least. I didn't test it.
This estimation is based on the feeling I got when watching nixos build
stuff using my patches.

Marc Weber



More information about the nix-dev mailing list