Being source based - and hence compiling everything before you install it - any build time speed improvements are welcome. We already have the -j option which can be passed to make via make.conf:
MAKEOPTS="-j3"Various sources say to set this number j = N(CPU) + 1 or j = 2N(CPU) + 1. I find the former is sufficient.
But what about configure? Before you compile a package, you have to configure it, which typically can only use one CPU. In addition there are other operations that are disk-intensive while not being CPU intensive (for instance, unpacking source code). And finally some packages are just "broken" and internally set -j1.
So it would be nice to build (unrelated) packages simultaneously. While one configure script is running, another could be compiling, further utilising those MeGaHurTz you paid so dearly for! Recently I tested this for the first time. I ran emerge like so:
$ emerge -vauDN --jobs=2 world
After looking through the output, this is how it proceeds:
Total: 70 packages (66 upgrades, 1 new, 3 reinstalls, 3 uninstalls), Size of downloads: 0 kB Conflict: 23 blocks Portage tree and overlays: [0] /usr/portage [1] /usr/local/portage >>> Verifying ebuild manifests >>> Starting parallel fetch >>> Emerging (1 of 70) x11-libs/qt-xmlpatterns-4.6.1 >>> Emerging (2 of 70) sys-devel/binutils-2.20 >>> Jobs: 0 of 70 complete, 2 running Load avg: 5.56, 2.53, 1.67
And just to prove that two packages are emerging:
$ genlop -c Currently merging 2 out of 70 * sys-devel/binutils-2.20 current merge time: 1 minute and 27 seconds. ETA: less than a minute. Currently merging 1 out of 70 * x11-libs/qt-xmlpatterns-4.6.1 current merge time: 1 minute and 28 seconds. ETA: less than a minute.A little while later, my load average settles down around 4.8:
>>> Installing (18 of 70) dev-python/pytz-2010b >>> Installing (16 of 70) x11-libs/qt-script-4.6.1 >>> Emerging (19 of 70) dev-util/subversion-1.6.9 >>> Emerging (20 of 70) dev-lang/python-2.6.4-r1 >>> Jobs: 17 of 70 complete, 1 running Load avg: 4.84, 4.84, 3.94
You may come across some packages that are interactive, such as skype, which forces you to view and accept their EULA. In that case the concurrent jobs are disabled. If you wish to go ahead with all non-interactive jobs (a good idea!) run emerge like so:
$ emerge -vauDN --jobs=2 --accept-properties=-interactive world
Note this feature is not supported in older versions of portage. I tested with sys-apps/portage-2.1.7.16
3 comments:
Very useful option. I wasnt aware of that
Thanks
Hey, glad you found this option. I just want to point out what I wrote for planet.gentoo.org some months ago :)
http://blog.jolexa.net/2008/07/24/gentoo-portages-new-jobs-feature/
So, leaving out the interactive jobs will not emerge them, and I can later do another 'emerge -vauDN world' to just handle those interactive jobs. Am I getting it right?
Post a Comment