# Distributed Dimensional Arrays

**URL:** <https://discourse.julialang.org/t/distributed-dimensional-arrays/49343>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 30, 2020, 11:14pm UTC](https://discourse.julialang.org/t/distributed-dimensional-arrays/49343 "2020-10-30T23:14:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hyacykcharel](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@hyacykcharel](https://discourse.julialang.org/u/hyacykcharel)\
**Post date:** [October 30, 2020, 11:14pm UTC](https://discourse.julialang.org/t/distributed-dimensional-arrays/49343/1 "2020-10-30T23:14:56Z")

</div>

Hello, I’m trying to run this in parallel but the result is not what I want, and I need My DArray to be synchronized.

```julia
#2D Heat Equation.
using Distributed
addprocs(2)
@everywhere using DistributedArrays
@everywhere using LinearAlgebra
@everywhere n = 10 #grid has n - 2 interior points per dimension [overlapping]

@everywhere TOL = 1e-6
T = zeros(n,n)
T[1,1:n] .= 10 #TOP
T[n,1:n] .= 1 #BOTTOM
T[1:n,1] .= 1 #LEFT
T[1:n,n] .= 10 #RIGHT

T = distribute(T; dist=(2,1))
T=@sync(T)
x = range(0,step=1,length=size(T,1))
y = range(0,step=1,length=size(T,1))
dx = x[2]-x[1]
dy = y[2]-y[1]
dt = dx^2/4
maxit=1000
for z in 1:maxit
    @sync @distributed for k in 1:2
        if myid()==2 
 
            for i in 2:length(localindices(T)[1])
                for j in 2:length(localindices(T)[2])-1
                    @async localpart(T)[i,j] = dt*((localpart(T)[i+1,j]-2*localpart(T)[i,j]+localpart(T)[i-1,j])/dx^2 +
                    (localpart(T)[i,j+1]-2*localpart(T)[i,j]+localpart(T)[i,j-1])/dy^2)+localpart(T)[i,j]
                end
            end
        else
            for i in 1:length(localindices(T)[1])-1
                for j in 2:length(localindices(T)[2])-1
                    @async localpart(T)[i,j] = dt*((localpart(T)[i+1,j]-2*localpart(T)[i,j]+localpart(T)[i-1,j])/dx^2 +
                    (localpart(T)[i,j+1]-2*localpart(T)[i,j]+localpart(T)[i,j-1])/dy^2)+localpart(T)[i,j]
                end
            end

        end
    end
end
T

```

```julia
This is what I get , but I don't need those Zeros in the middle , how can I synchronise this Array please
10×10 DArray{Float64,2,Array{Float64,2}}:
 1.0 10.0 10.0 10.0 … 10.0 10.0 10.0 10.0
 1.0 5.10999 6.55527 7.13223 7.87081 8.28623 8.98392 10.0
 1.0 2.88467 3.97886 4.56074 5.57927 6.29017 7.64947 10.0
 1.0 1.44985 1.91474 2.23027 2.96885 3.6457 5.32379 10.0
 1.0 0.0 0.0 0.0 0.0 0.0 0.0 10.0
 1.0 0.0 0.0 0.0 … 0.0 0.0 0.0 10.0
 1.0 0.54892 0.407347 0.390995 1.12958 2.13831 4.42286 10.0
 1.0 0.788332 0.689474 0.690817 1.70935 3.00079 5.55313 10.0
 1.0 0.914933 0.8714 0.881191 1.61978 2.60236 4.78887 10.0
 1.0 1.0 1.0 1.0 1.0 1.0 1.0 10.0

```
