On Wed, Jul 30, 2008 at 2:22 PM, John Nagle <[EMAIL PROTECTED]> wrote:
> defn noob wrote:
>>
>> How can I check how many cores my computer has?
>> Is it possible to do this in a Python-app?
>
>    Why do you care?  Python can't use more than one of them at
> a time anyway.

Per Python process, but you might fork multiple processes and want to
know how many cores there are to know how many to fork, and which
cores to pin them to.  (I don't know if there's a direct way in Python
to force it to a certain core, so I instead just wrote an extension to
interface with sched_setaffinity on Linux.)

On Linux, an almost assuredly non-ideal way to find out the number of
cores is to read /proc/cpuinfo and look for the highest-numbered
"processor: " line (and add 1).
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to