Skip to content

Commit 9789ec6

Browse files
committed
Use mp_ctx forkserver on MacOS
1 parent 881c65a commit 9789ec6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pymc3/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@
2727
handler = logging.StreamHandler()
2828
_log.addHandler(handler)
2929

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-
3630

3731
def __set_compiler_flags():
3832
# Workarounds for Theano compiler problems on various platforms

pymc3/parallel_sampling.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import pickle
2121
from collections import namedtuple
2222
import traceback
23+
import platform
2324
from pymc3.exceptions import SamplingError
2425

2526
import numpy as np
@@ -420,6 +421,9 @@ def __init__(
420421
raise ValueError("Number of seeds and start_points must be %s." % chains)
421422

422423
if mp_ctx is None or isinstance(mp_ctx, str):
424+
# Closes issue https://github.com/pymc-devs/pymc3/issues/3849
425+
if platform.system() == 'Darwin':
426+
mp_ctx = "forkserver"
423427
mp_ctx = multiprocessing.get_context(mp_ctx)
424428

425429
step_method_pickled = None

0 commit comments

Comments
 (0)