Skip to content

Commit 9b6111b

Browse files
JosephTomlinsonvchuravy
authored andcommitted
Fix for Inconsistent Uneven Grid Distributions (#167)
1 parent 721858c commit 9b6111b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/darray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ end
285285
# get array of start indices for dividing sz into nc chunks
286286
function defaultdist(sz::Int, nc::Int)
287287
if sz >= nc
288-
return round.(Int, range(1, stop=sz+1, length=nc+1))
288+
return ceil.(Int, range(1, stop=sz+1, length=nc+1))
289289
else
290290
return [[1:(sz+1);]; zeros(Int, nc-sz)]
291291
end

test/darray.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ using SparseArrays: nnz
5656
@test DistributedArrays.empty_localpart(Float64,2,LowerTriangular{Float64,Matrix{Float64}}) isa
5757
LowerTriangular
5858
end
59+
60+
@testset "Consistent Uneven Distribution issue #166" begin
61+
DA = drand((2+length(OTHERIDS),), [MYID, OTHERIDS])
62+
@test fetch(@spawnat MYID length(localpart(DA)) == 2)
63+
@test fetch(@spawnat OTHERIDS length(localpart(DA)) == 1)
64+
close(DA)
65+
end
5966
end
6067

6168
check_leaks()

0 commit comments

Comments
 (0)