vvoelz / biceps

Bayesian inference of conformational populations
https://github.com/vvoelz/biceps
Other
12 stars 3 forks source link

multiprocessing error in albo example #79

Open vvoelz opened 3 years ago

vvoelz commented 3 years ago

In trying to run the example code for albocycline, I run into an error with the multiprocessing commands. My guess is that something must have changed with the classes used in multiprocessing in newer python versions. I'm using Python 3.8.3

Number of CPU's: 8
Number of processes: 3
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-4e9d2c5a37fe> in <module>
      4 jobs = []
      5 for lam in lambda_values:
----> 6     process = p.Process(target=mp_lambdas, args=(lam,))
      7     jobs.append(process)
      8     jobs[-1].start() # Start the processes

TypeError: Process() missing 1 required positional argument: 'ctx'
robraddi commented 3 years ago

Python 3.8 multiprocessing get_context() function Application for ctx = mp.get_context() I will make sure this is fixed for the "big merge" of most recent src code for biceps 2.0 manuscript. For now, we will have to assume version Python 3-3.7 for multiprocessing to work.

robraddi commented 3 years ago

EDIT: Fixed bug for Python 3.8 by satisfying positional argument: 'ctx'

Here's what I tried:

if version < 3.8: process = p.Process(target=function, args=(iter,))
## FIXME: Python >= 3.8: For some reason this isn't working anymore?!?!
if version >= 3.8: process = p.Process(target=function, args=(iter,), ctx=mp.get_context(method='fork'))

Still searching here for an alternate solution.

As a side note, there may be complications using multiprocessing between platforms.