Skip to content

Commit d627700

Browse files
traktofonandreasnoack
authored andcommitted
Fixup README.
- update compatibility status - update example code Also, remove superfluous method for mapreduce.
1 parent 30621dd commit d627700

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
Distributed Arrays for Julia
88

99
***NOTE***
10-
Distributed Arrays will only work on Julia v0.4.0 or later.
11-
12-
`DArray`s have been removed from Julia Base library in v0.4 so it is now necessary to import the `DistributedArrays` package on all spawned processes.
10+
This package will only work on Julia v0.7 or later.
1311

1412
```julia
1513
using DistributedArrays
@@ -154,7 +152,7 @@ following code accomplishes this::
154152
left = mod(first(I[2])-2,size(d,2))+1
155153
right = mod( last(I[2]) ,size(d,2))+1
156154

157-
old = Array(Bool, length(I[1])+2, length(I[2])+2)
155+
old = Array{Bool}(undef, length(I[1])+2, length(I[2])+2)
158156
old[1 , 1 ] = d[top , left] # left side
159157
old[2:end-1, 1 ] = d[I[1], left]
160158
old[end , 1 ] = d[bot , left]
@@ -318,17 +316,18 @@ This toy example exchanges data with each of its neighbors `n` times.
318316

319317
```
320318
using Distributed
321-
addprocs(8)
322319
using DistributedArrays
323-
using DistributedArrays.SPMD
320+
addprocs(8)
321+
@everywhere using DistributedArrays
322+
@everywhere using DistributedArrays.SPMD
324323
325-
d_in=d=DArray(I->fill(myid(), (map(length,I)...)), (nworkers(), 2), workers(), [nworkers(),1])
326-
d_out=ddata()
324+
d_in=d=DArray(I->fill(myid(), (map(length,I)...,)), (nworkers(), 2), workers(), [nworkers(),1])
325+
d_out=ddata(); # TODO cannot show
327326
328327
# define the function everywhere
329328
@everywhere function foo_spmd(d_in, d_out, n)
330329
pids = sort(vec(procs(d_in)))
331-
pididx = findfirst(pids, myid())
330+
pididx = findfirst(isequal(myid()), pids)
332331
mylp = d_in[:L]
333332
localsum = 0
334333
@@ -352,7 +351,7 @@ d_out=ddata()
352351
end
353352
354353
# run foo_spmd on all workers
355-
spmd(foo_spmd, d_in, d_out, 10)
354+
spmd(foo_spmd, d_in, d_out, 10, pids=workers())
356355
357356
# print values of d_in and d_out after the run
358357
println(d_in)

0 commit comments

Comments
 (0)