Skip to content

Commit

Permalink
forcing forkserver mode for multiprocessing in mac
Browse files Browse the repository at this point in the history
  • Loading branch information
epnev committed Apr 25, 2018
1 parent 29e951f commit 5c199c0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions caiman/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,13 @@ def setup_cluster(backend='multiprocessing', n_processes=None, single_thread=Fal
'A cluster is already runnning. Terminate with dview.terminate() if you want to restart.')
c = None
if platform.system() == 'Darwin':
mp_start_method = 'forkserver' # default 'fork' crashes multi-threaded BLAS on Mac
else:
mp_start_method = None # use default for platform
ctx = multiprocessing.get_context(mp_start_method)
dview = ctx.Pool(n_processes)
multiprocessing.set_start_method('forkserver', force=True)
#mp_start_method = 'forkserver' # default 'fork' crashes multi-threaded BLAS on Mac
#else:
#mp_start_method = None # use default for platform
#ctx = multiprocessing.get_context(mp_start_method)
#dview = ctx.Pool(n_processes)
dview = Pool(n_processes)
else:
raise Exception('Unknown Backend')

Expand Down

0 comments on commit 5c199c0

Please sign in to comment.