Skip to content

Commit 145224f

Browse files
sbrombergervchuravy
authored andcommitted
Support ranges with different integer widths in preduce (#28651)
1 parent 35c67e5 commit 145224f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

stdlib/Distributed/src/macros.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ end
251251

252252
function preduce(reducer, f, R)
253253
N = length(R)
254-
chunks = splitrange(N, nworkers())
254+
chunks = splitrange(Int(N), nworkers())
255255
all_w = workers()[1:length(chunks)]
256256

257257
w_exec = Task[]

stdlib/Distributed/test/distributed_exec.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,14 @@ end
15271527
a27933 = :_not_defined_27933
15281528
@test remotecall_fetch(()->a27933, first(workers())) === a27933
15291529

1530+
# PR #28651
1531+
for T in (UInt8, Int8, UInt16, Int16, UInt32, Int32, UInt64)
1532+
n = @distributed (+) for i in Base.OneTo(T(10))
1533+
i
1534+
end
1535+
@test n == 55
1536+
end
1537+
15301538
# Run topology tests last after removing all workers, since a given
15311539
# cluster at any time only supports a single topology.
15321540
rmprocs(workers())

0 commit comments

Comments
 (0)