[issue17444] multiprocessing.cpu_count() should use hw.availcpu on Mac OS X

Trent Nelson report at bugs.python.org
Tue Mar 19 19:50:02 CET 2013


Trent Nelson added the comment:

On Tue, Mar 19, 2013 at 01:58:59AM -0700, John Szakmeister wrote:
> 
> John Szakmeister added the comment:
> 
> Actually, Trent's version looks at hw.logicalcpu and then falls back
> to hw.ncpu, if there was an error.  Given the state of the
> documentation on these parameters, it's hard to say whether it's right
> or wrong, but at least hw.logicalcpu scales correctly if I disable
> some of the processors.

    That's pretty much the rationale I used.  I tested the fallback on
    OS X manually (i.e. the _bsd_cpu_count()), and that works, and the
    hw.logicalcpu definitely works in the first place, so, I figured it
    was good enough.

    I'll raise a new issue for os.cpu_count().

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17444>
_______________________________________


More information about the Python-bugs-list mailing list