[Python-ideas] multiprocessing and physical CPU cores count

M.-A. Lemburg mal at egenix.com
Fri Sep 13 10:17:40 CEST 2013

On 12.09.2013 21:51, Giampaolo Rodola' wrote:
> On Thu, Sep 12, 2013 at 9:32 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>>> Then the question is whether having physical CPU cores count can be
>> useful.
>> I suppose it doesn't hurt :-) I don't think it belongs specifically in
>> multiprocessing, though. Perhaps in the platform module?
> I'd be +0.5 for multiprocessing because:
> - cpu_count() is already there
> - physical_cpu_count() will likely be used by multiprocessing users only
> ...but my main concern was first figuring out whether it might actually
> make sense to distinguish between virtual and physical CPUs in a real world
> app.

I'm with Antoine here: both APIs would make more sense in the
platform or os module.

Victor mentioned that there already is an os.cpu_count()
in Python 3.4, so perhaps add it there.

Do you need C code for determining the physical count ?

>> (unless you want to contribute psutil to the stdlib?)
> That's something I'd be happy to do if there's general approval but I guess
> that's for another thread.

I'd love to see psutils in the stdlib, but also be warned: once
the code lives in the stdlib,

a) making changes is difficult and adding new features as well,

b) you are bound by the Python release cycle.

For a package such psutil, it may actually be better to keep it
outside the stdlib, since the outside world changes regularly
and doesn't adhere to the Python release cycle or feature
for patch level releases ;-)

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Sep 13 2013)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
2013-09-11: Released eGenix PyRun 1.3.0 ...       http://egenix.com/go49
2013-09-04: Released eGenix pyOpenSSL 0.13.2 ...  http://egenix.com/go48
2013-09-20: PyCon UK 2013, Coventry, UK ...                 7 days to go

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Python-ideas mailing list