On Sun, Mar 29, 2009 at 11:34 AM, Peter Jeremy <peterjer...@optushome.com.au> wrote: > 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.
Just for the record this is a discussion about "Simple Python Distribution", not Sage. What Ondrej is doing doesn't a priori have anything to do with how Sage is built (though I of course hope it will). I've cc'd this to the spd-dev list since the discussion would also make sense there: http://groups.google.com/group/spd-dev/about and there are no discussions there yet. >>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). Microsoft Windows only implements POSIX.1. According to wikipedia: "Because only the first version of POSIX (POSIX.1) is implemented, a POSIX application cannot create a thread or window, nor can it use RPC or socket. Instead of implementing the later versions of POSIX, Microsoft offers Windows Services for UNIX." http://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem I donly know if sysconf is in POSIX.1 or not. > >>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 > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---