Skip to content

Commit e200ba5

Browse files
authored
Set start method to forkserver for MacOS (#3919)
* Set start method to forkserver for MacOS * Polished up changes * Added release note
1 parent ad59074 commit e200ba5

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

RELEASE-NOTES.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
- `pm.sample` now takes 1000 draws and 1000 tuning samples by default, instead of 500 previously (see [#3855](https://github.com/pymc-devs/pymc3/pull/3855)).
2222
- Moved argument division out of `NegativeBinomial` `random` method. Fixes [#3864](https://github.com/pymc-devs/pymc3/issues/3864) in the style of [#3509](https://github.com/pymc-devs/pymc3/pull/3509).
2323
- The Dirichlet distribution now raises a ValueError when it's initialized with <= 0 values (see [#3853](https://github.com/pymc-devs/pymc3/pull/3853)).
24-
- Dtype bugfix in `MvNormal` and `MvStudentT` (see [3836](https://github.com/pymc-devs/pymc3/pull/3836))
24+
- Dtype bugfix in `MvNormal` and `MvStudentT` (see [3836](https://github.com/pymc-devs/pymc3/pull/3836)).
2525
- End of sampling report now uses `arviz.InferenceData` internally and avoids storing
26-
pointwise log likelihood (see [#3883](https://github.com/pymc-devs/pymc3/pull/3883))
26+
pointwise log likelihood (see [#3883](https://github.com/pymc-devs/pymc3/pull/3883)).
27+
- The multiprocessing start method on MacOS is now set to "forkserver", to avoid crashes (see issue [#3849](https://github.com/pymc-devs/pymc3/issues/3849), solved by [#3919](https://github.com/pymc-devs/pymc3/pull/3919)).
2728

2829
### Deprecations
2930
- Remove `sample_ppc` and `sample_ppc_w` that were deprecated in 3.6.

pymc3/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
__version__ = "3.8"
1717

1818
import logging
19+
import multiprocessing as mp
20+
import platform
1921

2022
_log = logging.getLogger("pymc3")
2123

@@ -25,10 +27,15 @@
2527
handler = logging.StreamHandler()
2628
_log.addHandler(handler)
2729

30+
# Set start method to forkserver for MacOS to enable multiprocessing
31+
# Closes issue https://github.com/pymc-devs/pymc3/issues/3849
32+
sys = platform.system()
33+
if sys == "Darwin":
34+
new_context = mp.get_context("forkserver")
35+
2836

2937
def __set_compiler_flags():
3038
# Workarounds for Theano compiler problems on various platforms
31-
import platform
3239
import theano
3340

3441
system = platform.system()

0 commit comments

Comments
 (0)