Here's some Julia code:
addprocs()
@everywhere begin
type Test
values::Array{Any,1}
addValue::Function
function Test()
this = new()
this.values = Any[]
this.addValue = function(v)
push!(this.values,v)
end
return this
end
end
end
@everywhere t = Test()
@everywhere t.addValue(myid())
@spawnat 2 whos()
r = @spawnat 2 t
I believe this code defines a Test type on all processes and then creates an instance of that type stored in a variable, called t, on each process. This variable is local to that process. I then use one of the Test methods run in parallel on each process to mutate the local instance of Test. In the line
@spawnat 2 whos()
we can see that the local t has indeed been updated. However, I get a HUGE error when trying to fetch any of the remote variables t into a RemoteRef. The error message is quite large, but it leads me to believe that the Julia serialization process cannot handle user-defined types. Can anybody lend some insight? Thank You!
Upadate: A simpler example yielding the same error:
addprocs()
@everywhere begin
type Test
values::Array{Any,1}
addValue::Function
function Test()
this = new()
this.values = Any[]
this.addValue = function(v)
push!(this.values,v)
end
return this
end
end
end
t = Test()
R = RemoteRef(2)
put!(R,t)