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.

Yes, exactly. I am still thinking of the best way to do that. I think
the default should be to just use one processor, but it should be easy
to tell it to use all processors, or just certain amount of them.

I think I will just add more targets to the makefile in the top
directory, e.g. something like

make   # use 1 processor
make parallel # use all processors
JOBS=3 make  # use 3 processors



>
>>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).

Yes, indeed, I found out that sysconf() does work on Mac. So that's awesome.


Ondrej

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to