-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parallel sampling with Theano Op fails on MacOS 10.15 #4085
Comments
Hi @gmingas, and thanks for reporting! This looks like a familiar issue but I thought it appeared with python 3.8 🤦 |
You need to move |
Moving Nevertheless, when I run the same code in a Jupyter notebook, I get the same error (despite having moved But since it is desirable in the pymc3 notebooks folder to have notebooks that contain all the code without importing from other files, is there a different workaround that would allow me to keep all the code inside my notebook and still run on a Mac? |
It is only since python 3.8 that this is an issue on mac as well (see
https://docs.python.org/3.8/library/multiprocessing.html#contexts-and-start-methods
)
You can switch back to using spawn using `mp_ctx="spawn"`, that should fix
the issue, but might break other things unexpectedly. (I don't know what
exactly, see the issue linked in the multiprocessing docs above).
You could also try to use dill instead of pickle (pickle_backend="dill" in
pm.sample). We haven't experimented with that a lot however.
Greg Mingas <[email protected]> schrieb am Mi., 9. Sep. 2020, 16:42:
… Moving ForwardModel1 does work indeed (while changing mp_ctx does not).
Nevertheless, when I run the same code in a Jupyter notebook, I get the
same error (despite having moved ForwardModel1). From looking online it
seems like this is a known issue with multiprocessing with a known
workaround (see here
<https://stackoverflow.com/questions/41385708/multiprocessing-example-giving-attributeerror>)
- although it is supposed to happen only on Windows and not Mac.
But since it is desirable in the pymc3 notebooks folder to have notebooks
that contain all the code without importing from other files, is there a
different workaround that would allow me to keep all the code inside my
notebook and still run on a Mac?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#4085 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOLSHMZJGGIUBZTHYCXH5LSE6H7BANCNFSM4Q6MNN5Q>
.
|
Thanks a lot @aseyboldt and @AlexAndorra for the comments, they were really helpful. I will try what you recommended. |
Hi everyone, I am running into the same issue on MacOS Catalina, Python version 3.7.9 and
I tried the suggested fixes here, using Is the only fix at this point to try my script on a Linux machine? Thanks in advance for your time and help. |
The only thing that worked for me in MacOS is described in my post above (i.e. moving Tagging @mikkelbue |
Ah yes, I transferred over to a script which resolved the error, I guess avoid notebooks with stuff that compiles? Thank you for the help. |
Responding to tag from @gmingas |
Hi,
I am running the piece of code shown below on MacOS 10.15.6 with Python 3.6.11 and the latest version of the master branch in the pymc3-dev.
It is a toy example of using a Theano Op to compute a forward model and then use the output as the mean of a multivariate Normal.
I get the error shown under the code. When I sample with
cores=1
insample()
the error disappears and sampling happens normally.I played a bit with it and when I rebased the code, removing the commits from PR #3991, the error stops happening. Not sure which part of the changes breaks this and it might happen in MacOS only (a collaborator who works in Linux does not have the same issue).
This might be connected to #4053 #3844 or #3140 but it was not clear it is the same issue so decided to post separately.
Code:
Error/traceback:
The text was updated successfully, but these errors were encountered: