Help extracting only certain fields of non-array data


#1
addprocs(4)
@everywhere type Temp
       a::Array{Float64}
       alarge::Array{Float64}
end

@everywhere using DistributedArrays
work=workers()
nwork=length(work)
pap=ddata(T=Temp, init=I->Temp([2.,3.,], randn(1000)), pids=work);

@everywhere function updatea!(temp::Temp)
       temp.a=[-1.,-1.,]
end

extracta=[[0.,0.] for iw in 1:nwork]

@everywhere function updatec!(ip,temp::Temp, extracta)
       extracta[ip]=copy(temp.a)
end


for (ip, p) in enumerate(procs(pap))
 @sync remotecall_wait(p) do
        println(localpart(pap).a)
        updatea!(localpart(pap))
        updatec!(ip,localpart(pap),extracta)
        println(localpart(pap).a)
 end
end
println(extracta)
  • I want extracta to have a's of all the localparts

  • Why doesn’t this happen?

  • How can I extract only certain fields of a distributed array of non-array data?

  • Here, the field alarge has a huge dimension and I like to avoid transfer of this field between processors to minimize data transfer.

  • Note that the modifications I do to field a are dependent on alarge