Skip to content

Commit bb887a7

Browse files
authored
Add a test for reducing larger array sizes (#459)
1 parent 42164aa commit bb887a7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/testsuite/reductions.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@
1515
end
1616
end
1717

18+
@testsuite "reductions/mapreducedim!_large" (AT, eltypes)->begin
19+
@testset "$ET" for ET in eltypes
20+
# Skip smaller floating types due to precision issues
21+
if ET in (Float16, ComplexF16)
22+
continue
23+
end
24+
25+
range = ET <: Real ? (ET(1):ET(10)) : ET
26+
# Reduce larger array sizes to test multiple-element reading in certain implementations
27+
for (sz,red) in [(1000000,)=>(1,), (5000,500)=>(1,1), (500,5000)=>(1,1),
28+
(500,5000)=>(500,1), (5000,500)=>(1,500)]
29+
@test compare((A,R)->Base.mapreducedim!(identity, +, R, A), AT, rand(range, sz), zeros(ET, red))
30+
end
31+
end
32+
end
33+
1834
@testsuite "reductions/reducedim!" (AT, eltypes)->begin
1935
@testset "$ET" for ET in eltypes
2036
range = ET <: Real ? (ET(1):ET(10)) : ET

0 commit comments

Comments
 (0)