Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit c210d67

Browse files
authored
Merge pull request #454 from BlueBrain/win32_compatibility
Fix get_context of multiprocessing for windows compatibility
2 parents 4227007 + 120b1e9 commit c210d67

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

bluepyopt/ephys/protocols.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# pylint: disable=W0511
2626

2727
import os
28+
import sys
2829
import collections
2930
import tempfile
3031

@@ -265,7 +266,16 @@ def _reduce_method(meth):
265266

266267
# Default context for python>=3.8 on macos is spawn.
267268
# Spwan context would reset NEURON properties, such as dt.
268-
multiprocessing_context = multiprocessing.get_context('fork')
269+
if sys.platform == 'win32':
270+
multiprocessing_context = multiprocessing.get_context('spawn')
271+
if (
272+
sim is not None and not sim.cvode_active and
273+
sim.dt != 0.025
274+
):
275+
logger.warning("On Windows, evaluation might break when"
276+
"using non-default fixed time steps.")
277+
else:
278+
multiprocessing_context = multiprocessing.get_context('fork')
269279

270280
if timeout is not None:
271281
if timeout < 0:

0 commit comments

Comments
 (0)