[PATCH] "automated" make -j value

Garance A Drosehn gad at FreeBSD.org
Thu Dec 14 13:34:49 PST 2006

At 1:52 PM -0500 12/14/06, Kurt J. Lidl wrote:
>On Wed, Dec 13, 2006, David O'Brien wrote:
>  > With multi-socket systems becoming more prevalent, and the continued
>>  increase in cores per processors, I thought it would be nice for
>>  'make -j' to gain some automation.
>>  Attached is a patch that makes "-j-" be the same as
>  > "-j `sysctl -n kern.smp.cpus`" and "-j=" be twice that.
>I think you can do it better than this, by just support
>setting the concurrancy level via reading a environmental
>variable.  Like say "NPROC", which is what CrayOS used, and
>also appeared in the BSD/OS pmake varient several years ago.

You could have '-j-' use the value of NPROC if that variable is set, and
fall back to kern.smp.cpus if NPROC is not set.  (it also seems to me
this could be called "-j auto" instead of using some single-character
for it).

I think is not going to make much sense to have a special -j value
for "twice ncpu" as we get machines with 12 or 16 CPU's.  I doubt
there would be many projects which could really take advantage of 32
streams even if there was no performance penalties.  And for the few
which do exist, the users could just set NPROC if they think that
would do them any good.

Garance Alistair Drosehn     =               drosehn at rpi.edu
Senior Systems Programmer               or   gad at FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA

More information about the freebsd-hackers mailing list