Consider this very simple example
if nprocs() == 1
addprocs(2)
end
ll2(F::Matrix, G::Matrix, H::Matrix, obs::Matrix) = sum(F*G*obs*obs'*H)
function create_ll2_args()
obs = rand(3, 50)
[(randn(3, 3) * .5, randn(3, 3)*.2, eye(3), obs) for i=1:2]
end
function works_with_map()
args = create_ll2_args()
map(x->ll2(x...), args)
end
function craps_out_with_pmap()
args = create_ll2_args()
pmap(x->ll2(x...), args)
end
Now see what happens when I call the last two functions
julia> works_with_map()
2-element Array{Float64,1}:
6.60313
8.82563
julia> workers() # make sure I have workers
2-element Array{Int64,1}:
2
3
julia> craps_out_with_pmap()
fatal error on fatal error on 23: : ERROR: `convert` has no method matching
convert(::Type{Int64...}, ::Int64)
in convert at base.jl:13
in convert at ./base.jl:21
in deserialize at serialize.jl:447
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
in handle_deserialize at serialize.jl:346
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
in handle_deserialize at serialize.jl:346
in anonymous at task.jl:853
ERROR: `convert` has no method matching convert(::Type{Int64...}, ::Int64)
in convert at base.jl:13
in convert at ./base.jl:21
in deserialize at serialize.jl:447
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
in handle_deserialize at serialize.jl:346
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
in handle_deserialize at serialize.jl:346
in anonymous at task.jl:853
Worker 3 terminated.
Worker 2 terminated.
2-element Array{Any,1}:
ProcessExitedException()
ProcessExitedException()
I’m not sure what the problem is. I tried to follow the traceback and ended
up at this line
<https://github.com/JuliaLang/julia/blob/master/base/serialize.jl#L448>,
but I’m not really sure what is going wrong or how to fix it. Any ideas?
If this really is a bug we can create an issue for it…
Thanks