diff --git a/pycbc/__init__.py b/pycbc/__init__.py index d6db0026e0a..99f4cc6ef37 100644 --- a/pycbc/__init__.py +++ b/pycbc/__init__.py @@ -212,8 +212,13 @@ def makedir(path): # preserve common state information which we have relied on when using # multiprocessing based pools. import multiprocessing - if hasattr(multiprocessing, 'set_start_method'): - multiprocessing.set_start_method('fork') + if multiprocessing.get_start_method(allow_none=True) is None: + if hasattr(multiprocessing, 'set_start_method'): + multiprocessing.set_start_method('fork') + elif multiprocessing.get_start_method() != 'fork': + warnings.warn("PyCBC requires the use of the 'fork' start method" + " for multiprocessing, it is currently set to {}" + .format(multiprocessing.get_start_method())) else: HAVE_OMP = True