It would be nice if portage optionally gleaned the value for -jN from the number of machines in DISTCC_HOSTS (or distcc-config --get-hosts). I update the latter from a script that checks which hosts are up and running distccd (in a lab that sometimes is used for Windows stuff). Unfortunately, I also have to adjust MAKEOPTS so the machines don't slow themselves down by using -j22 on three machines. One way might be to make MAKEOPTS more intelligent, like being able to specify MAKEOPTS="-jAUTO" and the replacing the AUTO string with the number of DISTCC_HOSTS. Escaping this ("-j{NJOBS}" etc.) could/should be done in a portage-firendly way. Reproducible: Always Steps to Reproduce:
The MAKEOPTS value depends on two things: 1. cpus used to compile 2. load you want to set on them. So if you have 20 dual xeon boxes, you don't want to run with -j21, but -j41 or even 61. CPUs+1 is a (unwritten?) rule Personally i prefer CPUs*2+1. Lisa should decide this one ;)
That's why my setup adds a hostname twice for dual-cpu machines. This also makes sure that the smp machines get double the load of the uniprocessor machines. As for the amoutn of N, I have benchmarked using 2.4 and 2.6 kernels and usually, compiles does not speed up after N=NUM_CPUS. YMMV, of course.
Markus is right. Why not fix your script so it updates make.conf on its own? grep -v '^MAKEOPTS=' /etc/make.conf > /tmp/make.conf.tmp echo "MAKEOPTS='-jN'" >> /tmp/make.conf.tmp mv --force /tmp/make.conf.tmp /etc/make.conf Setting MAKEOPTS should be up to the user.
I had in mind that the user sets auto-mode for -j explcitly, then never tiuches it again. So they can still override at the cmd line with MAEKOPTS="..." but in the default case, the amount of parallelism is gleaned from the no. of hosts. I feel a bit uneasy when fiddling with make.conf directly, but ok. 'twas just an idea.
closing