# Parallel programing with Distributed Arrays

**URL:** <https://discourse.julialang.org/t/parallel-programing-with-distributed-arrays/50305>\
**Category:** General Usage\
**Created:** [November 17, 2020, 3:59pm UTC](https://discourse.julialang.org/t/parallel-programing-with-distributed-arrays/50305 "2020-11-17T15:59:12Z")\
**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:** [November 17, 2020, 3:59pm UTC](https://discourse.julialang.org/t/parallel-programing-with-distributed-arrays/50305/1 "2020-11-17T15:59:12Z")

</div>

Hello, I’m trying to run this code, but why I’m I getting these 2 rows in the Middle with 00000, can someone help me, to get that fixed, please?

```julia
using Distributed #Bereitstellung der Bibliothekee zur Parallelen Programierung
addprocs(2)
@everywhere using LinearAlgebra #Bereitstellung der LinearAlgebra Bibliotheke
@everywhere using DistributedArrays #Bereitstellung der DistributedArrays Bibliotheke
@everywhere using InteractiveUtils #Bereitstellung der InteractiveUtils Bibliotheke
@everywhere using BenchmarkTools #Bereitstellung der BenchmarkTools Bibliotheke
# zur der Leistung und Berrechnungszeit

@everywhere n =10 # Anzahl Gitterpunkte, einschließlich interner Punkte
@everywhere h = 1/(n-1) #Schrittweite
@everywhere X=0:h:1 # Gitterpunkte, einschließlich interner Punkte auf X-Axis
@everywhere Y=0:h:1 # Gitterpunkte, einschließlich interner Punkte auf Y-Axis
#Erstellung der Gitterpunkte mit der Gleichung Rechte Hand Seite K_r = -exp-(X-0.25)² - (Y-0.6)²

@everywhere T =(zeros(n,n))
T[:,1].=10 #Randbedingungen T_links =10
T[:,end].=10 #Randbedingungen T_rechts =10

T = distribute(T; dist=(2,1))
d_r = ddata();
maxit = 100 #maximale Iterrationsanzahl

@everywhere function Poissons_2D(T)
    for w in 1:maxit
        @sync @distributed for p in 1:nworkers()
            for i in 2:length(localindices(T)[1])-1
                for j in 2:length(localindices(T)[2])-1
                    localpart(T)[i,j] = (1/4 * (localpart(T)[i-1,j] + localpart(T)[i+1,j] + localpart(T)[i,j-1] + localpart(T)[i,j+1]))
                end
            end
        end
    end
    return T
end

Poissons_2D(T)
10×10 DArray{Float64,2,Array{Float64,2}}:
 10.0 0.0 0.0 0.0 … 0.0 0.0 0.0 10.0
 10.0 4.33779 2.00971 1.01077 1.01077 2.00971 4.33779 10.0
 10.0 5.34146 2.69026 1.40017 1.40017 2.69026 5.34146 10.0
 10.0 4.33779 2.00971 1.01077 1.01077 2.00971 4.33779 10.0
 10.0 0.0 0.0 0.0 0.0 0.0 0.0 10.0
 10.0 0.0 0.0 0.0 … 0.0 0.0 0.0 10.0
 10.0 4.33779 2.00971 1.01077 1.01077 2.00971 4.33779 10.0
 10.0 5.34146 2.69026 1.40017 1.40017 2.69026 5.34146 10.0
 10.0 4.33779 2.00971 1.01077 1.01077 2.00971 4.33779 10.0
 10.0 0.0 0.0 0.0 0.0 0.0 0.0 10.0

```
