On Wed, Dec 13, 2006 at 08:19:52PM -0800, 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. > > comments? (redirected back to list)
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. Then you can just do this: export NPROC=`/sbin/sysctl hw.ncpu | awk '{print $3*2}'` or this: export NPROC=`/sbin/sysctl hw.ncpu | awk '{print $3}'` in your shells .rc files. (Obviously, change the sysctl node as appropriate for your OS.) I found this really useful when compiling a large tree of sources, where some of the Makefiles didn't have their dependencies written correctly, sucht that a parallel make wouldn't work properly. It's easy to turn off, just by unsetting the environmental variable. It's also easy to iterate over a set of values to figure out which one will compile a tree the fastest. (FYI -- setting 3*hw.ncpu was optimal for BSD/OS.) If you hack on make to put in automagic around -j, you should add the environmental variable support too. It's actually more useful in a lot of cases. (Mostly cause you don't have to touch any Makefile to turn it on, it just works...) -Kurt _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"