Skip to content

Commit 517f10d

Browse files
fonnesbeckaloctavodia
authored andcommitted
Use multiprocessing instead of psutil to count cores (#3593)
* Changed _cpu_count to use multiprocessing * Added RELEASE-NOTES entry * remove redundant import
1 parent 1642e73 commit 517f10d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

RELEASE-NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
- Parallelization of population steppers (`DEMetropolis`) is now set via the `cores` argument. ([#3559](https://github.com/pymc-devs/pymc3/pull/3559))
1616
- SMC: stabilize covariance matrix [3573](https://github.com/pymc-devs/pymc3/pull/3573)
1717
- SMC is no longer a step method of `pm.sample` now it should be called using `pm.sample_smc` [3579](https://github.com/pymc-devs/pymc3/pull/3579)
18+
- Now uses `multiprocessong` rather than `psutil` to count CPUs, which results in reliable core counts on Chromebooks.
1819
- `sample_posterior_predictive` now preallocates the memory required for its output to improve memory usage. Addresses problems raised in this [discourse thread](https://discourse.pymc.io/t/memory-error-with-posterior-predictive-sample/2891/4).
1920

21+
2022
## PyMC3 3.7 (May 29 2019)
2123

2224
### New features

pymc3/parallel_sampling.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,7 @@ def _cpu_count():
434434
that half of the cpus are only hardware threads and ignore those.
435435
"""
436436
try:
437-
import psutil
438-
cpus = psutil.cpu_count(False)
439-
except ImportError:
440-
try:
441-
cpus = multiprocessing.cpu_count() // 2
442-
except NotImplementedError:
443-
cpus = 1
444-
if cpus is None:
437+
cpus = multiprocessing.cpu_count() // 2
438+
except NotImplementedError:
445439
cpus = 1
446440
return cpus

0 commit comments

Comments
 (0)