On 2009-Mar-28 14:53:46 -0700, Ondrej Certik <ond...@certik.cz> wrote: >I am trying to figure out the best way to automatically determine the >number of processors and used that information to speed up Sage build.
Note that this should be able to be over-ridden by the operator - just because a system has (say) 8 cores available doesn't mean that the sage build should use them all. >If Python is not available, then I can use this simple C program: > >http://github.com/certik/sysconf/blob/master/ncpus.c > >but I suspect this will not work on Mac or Windows. sysconf() is part of POSIX so it should work in any POSIX environment. Microsoft made a big claim about Windows being POSIX compliant so it should work there - but may need to link against special libraries. It should work on OS-X (though I can't test it). >2) try: cat /proc/cpuinfo | grep processor | wc -l That is far less portable than sysconf() because it _only_ works on Linux, whereas sysconf() should work on nearly all Unix systems (and some others). -- Peter Jeremy
pgpuhAyd6qxwr.pgp
Description: PGP signature