Skip to content
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

Failure when using pmap with pycall #108

Closed
garrison opened this issue Dec 18, 2014 · 4 comments
Closed

Failure when using pmap with pycall #108

garrison opened this issue Dec 18, 2014 · 4 comments

Comments

@garrison
Copy link

The following three-line program fails using PyCall 0.7.3 with Julia release-0.3 or master

@everywhere using PyCall
@everywhere @pyimport math
pmap(math.sin, linspace(0, pi, 100))

with a rather long error message, the first few lines being

fatal error on 4: fatal error on 2: fatal error on fatal error on 5: 3: ERROR: type: setfield!: expected Ptr{PyObject_struct}, got Symbol
 in deserialize at serialize.jl:565
 in deserialize at serialize.jl:520
 in handle_deserialize at serialize.jl:351
 in deserialize at serialize.jl:334
 in anonymous at serialize.jl:354
 in ntuple at tuple.jl:30
 in deserialize_tuple at serialize.jl:354
@garrison
Copy link
Author

A simple variation of the above code seems to work, however, so perhaps sending a python function directly to pmap is just unsupported?

@everywhere using PyCall
@everywhere @pyimport math
@everywhere f(x) = math.sin(x)
pmap(f, linspace(0, pi, 100))

@stevengj
Copy link
Member

If each of the processes imports its own Python math module, it should work; I'm not sure why you are getting the weird error message here — it seems like the second example should be equivalent to the first.

I have to admit that I don't really know how pmap works. @StefanKarpinski, any ideas?

@StefanKarpinski
Copy link

No idea. @JeffBezanson?

@garrison
Copy link
Author

Closing, as this works nowadays without error. The equivalent code that works today is:

using Distributed
@everywhere using PyCall
@everywhere @pyimport math
pmap(math.sin, range(0, stop=pi, length=100))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants