Skip to content

Commit 3b435a4

Browse files
yanzin00fda-tome
authored andcommitted
DArray: Restrict copyto! scope to destination
1 parent dc80599 commit 3b435a4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/array/copy.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,14 @@ function darray_copyto!(B::DArray{TB,NB}, A::DArray{TA,NA}, Binds=parentindices(
131131
Arange_local = Arange_global_clamped .- CartesianIndex(Arange_start) .+ CartesianIndex{Nmax}(1)
132132

133133
# Perform local view copy
134-
Dagger.@spawn copyto_view!(Out(Bpart), Brange_local, In(Apart), Arange_local)
134+
space = (Bpart isa DTask ? fetch(Bpart; move_value=false, unwrap=false) : Bpart).space
135+
procs = processors(space)
136+
scope = UnionScope([ExactScope(proc) for proc in procs])
137+
check_uniform(space)
138+
for proc in procs
139+
check_uniform(proc)
140+
end
141+
Dagger.@spawn scope = scope copyto_view!(Out(Bpart), Brange_local, In(Apart), Arange_local)
135142
end
136143
end
137144
end

0 commit comments

Comments
 (0)