Skip to content

Commit

Permalink
Merge pull request JuliaLang#11951 from JuliaLang/amitm/rr_getidx
Browse files Browse the repository at this point in the history
restore getindex on remoterefs
  • Loading branch information
JeffBezanson committed Jun 30, 2015
2 parents 81b5064 + a303514 commit c415826
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions base/multi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1637,3 +1637,10 @@ function terminate_all_workers()
end
end
end

function getindex(r::RemoteRef, args...)
if r.where == myid()
return getindex(fetch(r), args...)
end
return remotecall_fetch(r.where, getindex, r, args...)
end
10 changes: 10 additions & 0 deletions test/parallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ id_other = filter(x -> x != id_me, procs())[rand(1:(nprocs()-1))]
@test @fetchfrom id_other begin myid() end == id_other
@fetch begin myid() end

rr=RemoteRef()
a = rand(5,5)
put!(rr, a)
@test rr[2,3] == a[2,3]

rr=RemoteRef(workers()[1])
a = rand(5,5)
put!(rr, a)
@test rr[1,5] == a[1,5]

dims = (20,20,20)

@linux_only begin
Expand Down

0 comments on commit c415826

Please sign in to comment.