pythonpython-3.xpathos

Is there a `pathos`-specific way to determine the number of CPU cores?


I want to determine the number of physical CPU cores to size the number of nodes for a ProcessPool accordingly.

from pathos.pools import ProcessPool
process_pool = ProcessPool(nodes=?)

I know that psutil provides this number as described below.

import psutil
process_pool = ProcessPool(nodes=psutil.cpu_count(logical=False))

However, is there a canonical pathos-specific way of adjusting the node parameter?


Solution

  • The usage in pathos is very similar to psutil

    >>> import pathos as pa             
    >>> pa.helpers.cpu_count()
    8