Hi,
I’ve got a problem when trying to aggregate using the @parallel macro, looks like an issue deserializing a dictionary datatype:
LoadError: On worker 2:
TypeError: Array: in parameter, expected Type{T}, got Dict{Array{Any,N},Int64}
in deserialize_datatype at .\serialize.jl:830
in handle_deserialize at .\serialize.jl:571
in collect at .\array.jl:307
in deserialize at .\serialize.jl:588
in handle_deserialize at .\serialize.jl:581
in deserialize at .\serialize.jl:541
in deserialize_datatype at .\serialize.jl:829
in handle_deserialize at .\serialize.jl:571
in deserialize at .\serialize.jl:881
in deserialize_datatype at .\serialize.jl:835
in handle_deserialize at .\serialize.jl:571
in deserialize_array at .\serialize.jl:709
in handle_deserialize at .\serialize.jl:569
in deserialize at .\serialize.jl:541
in ntuple at .\tuple.jl:65
in handle_deserialize at .\serialize.jl:562
in deserialize_msg at .\multi.jl:120
in message_handler_loop at .\multi.jl:1317
in process_tcp_streams at .\multi.jl:1276
in #620 at .\event.jl:68
while loading In[9], in expression starting on line 2
in yieldto(::Task, ::ANY) at .\event.jl:136
in wait() at .\event.jl:169
in wait(::Condition) at .\event.jl:27
in wait(::Task) at .\task.jl:132
in collect(::Base.Generator{Array{Task,1},Base.#wait}) at .\array.jl:307
in preduce(::Function, ::Function, ::Array{BuLossVector,2}) at .\multi.jl:2002
in (::##21#23)(::Array{BuLossVector,2}) at .\multi.jl:2011
Sample types and functions:
addprocs(1)
@everywhere begin
type BuLossVector
ba_yelt::Dict{Array{Any}, Int64}
end
function BuLossVector()
return BuLossVector(Dict{Array{Any}, Int64}())
end
import Base.+
function +(x::BuLossVector, y::BuLossVector)
z = BuLossVector()
z.ba_yelt = merge_sum(x.ba_yelt, y.ba_yelt)
return z
end
function merge_sum(d::Associative, others::Associative...)
result_dict = copy(d)
for other in others
for (k,v) in other
result_dict[k] = haskey(result_dict, k) ? d[k] + v : v
end
end
return result_dict
end
end
code to run test
a = BuLossVector()
b = BuLossVector()
c = BuLossVector()
d = BuLossVector()
a.ba_yelt[[16 1]] = 2
a.ba_yelt[[16 2]] = 4
b.ba_yelt[[16 1]] = 10
b.ba_yelt[[16 2]] = 40
c.ba_yelt[[16 1]] = 2
c.ba_yelt[[16 2]] = 4
d.ba_yelt[[16 1]] = 10
d.ba_yelt[[16 2]] = 40
bu_vecs = [a b c d]
the following code fails with the error outlined above.
result = @parallel (+) for bu_vec in bu_vecs
println(bu_vec)
end
Regards,
Adrian.