|
1 | 1 |
|
2 |
| -@testset "Loop chunk distribution" begin |
3 |
| -using DiskArrays: DiskArrays, GridChunks, RegularChunks, IrregularChunks, AbstractDiskArray |
4 |
| -using YAXArrayBase: YAXArrayBase |
5 |
| -using YAXArrays |
6 |
| -struct LargeDiskArray{N,CT<:GridChunks{N}} <: AbstractDiskArray{Float64,N} |
7 |
| - size::NTuple{N,Int} |
8 |
| - chunks::CT |
9 |
| - compressed::Bool |
10 |
| -end |
11 |
| -Base.size(a::LargeDiskArray) = a.size |
12 |
| -DiskArrays.eachchunk(a::LargeDiskArray) = a.chunks |
13 |
| -DiskArrays.haschunks(::LargeDiskArray) = DiskArrays.Chunked() |
14 |
| -YAXArrayBase.iscompressed(a::LargeDiskArray) = a.compressed |
15 |
| -s = (4000,2000,1500) |
16 |
| -cs = (100,100,700) |
17 |
| -YAXArrays.YAXDefaults.max_cache[] = 1.0e8 |
18 |
| -a1 = YAXArray(LargeDiskArray(s, GridChunks(s,cs),true)) |
| 2 | +# @testset "Loop chunk distribution" begin |
| 3 | +# using DiskArrays: DiskArrays, GridChunks, RegularChunks, IrregularChunks, AbstractDiskArray |
| 4 | +# using YAXArrayBase: YAXArrayBase |
| 5 | +# using YAXArrays |
| 6 | +# struct LargeDiskArray{N,CT<:GridChunks{N}} <: AbstractDiskArray{Float64,N} |
| 7 | +# size::NTuple{N,Int} |
| 8 | +# chunks::CT |
| 9 | +# compressed::Bool |
| 10 | +# end |
| 11 | +# Base.size(a::LargeDiskArray) = a.size |
| 12 | +# DiskArrays.eachchunk(a::LargeDiskArray) = a.chunks |
| 13 | +# DiskArrays.haschunks(::LargeDiskArray) = DiskArrays.Chunked() |
| 14 | +# YAXArrayBase.iscompressed(a::LargeDiskArray) = a.compressed |
| 15 | +# s = (4000,2000,1500) |
| 16 | +# cs = (100,100,700) |
| 17 | +# YAXArrays.YAXDefaults.max_cache[] = 1.0e8 |
| 18 | +# a1 = YAXArray(LargeDiskArray(s, GridChunks(s,cs),true)) |
19 | 19 |
|
20 |
| -#Test case where chunk has to be split |
21 |
| -dc = mapslices(sum, a1, dims="Dim_1", debug = true) |
22 |
| -ch = YAXArrays.DAT.getloopchunks(dc) |
| 20 | +# #Test case where chunk has to be split |
| 21 | +# dc = mapslices(sum, a1, dims="Dim_1", debug = true) |
| 22 | +# ch = YAXArrays.DAT.getloopchunks(dc) |
23 | 23 |
|
24 |
| -@test length(ch) == 2 |
25 |
| -@test ch[1] == RegularChunks(4,0,2000) |
26 |
| -@test ch[2] == RegularChunks(700,0,1500) |
27 |
| -dc.outcubes[1].cube |
28 |
| -# Test that the allocated buffer is close to what the prescribes size |
29 |
| -incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
30 |
| -@test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0; |
| 24 | +# @test length(ch) == 2 |
| 25 | +# @test ch[1] == RegularChunks(4,0,2000) |
| 26 | +# @test ch[2] == RegularChunks(700,0,1500) |
| 27 | +# dc.outcubes[1].cube |
| 28 | +# # Test that the allocated buffer is close to what the prescribes size |
| 29 | +# incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
| 30 | +# @test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0; |
31 | 31 |
|
32 | 32 |
|
33 |
| -#Test subsets and offset |
34 |
| -a2 = a1[Dim_3=201..1300.5] |
35 |
| -dc = mapslices(sum, a2, dims="Dim_1", debug = true) |
36 |
| -ch = YAXArrays.DAT.getloopchunks(dc) |
37 |
| -@test ch == (RegularChunks(4,0,2000), RegularChunks(700,200,1100)) |
38 |
| -# Test that the allocated buffer is close to what the prescribes size |
39 |
| -incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
40 |
| -@test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0; |
| 33 | +# #Test subsets and offset |
| 34 | +# a2 = a1[Dim_3=201..1300.5] |
| 35 | +# dc = mapslices(sum, a2, dims="Dim_1", debug = true) |
| 36 | +# ch = YAXArrays.DAT.getloopchunks(dc) |
| 37 | +# @test ch == (RegularChunks(4,0,2000), RegularChunks(700,200,1100)) |
| 38 | +# # Test that the allocated buffer is close to what the prescribes size |
| 39 | +# incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
| 40 | +# @test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0; |
41 | 41 |
|
42 |
| -#Test with different max_cache |
43 |
| -YAXArrays.YAXDefaults.max_cache[] = 2.0e8 |
44 |
| -dc = mapslices(sum, a2, dims="Dim_1", debug = true) |
45 |
| -ch = YAXArrays.DAT.getloopchunks(dc) |
46 |
| -#Test loop chunk sizes |
47 |
| -@test ch == (RegularChunks(5,0,2000), RegularChunks(700,200,1100)) |
48 |
| -# Test that the allocated buffer is close to what the prescribes size |
49 |
| -incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
50 |
| -@test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0# Test that the allocated buffer is close to what the prescribes size |
| 42 | +# #Test with different max_cache |
| 43 | +# YAXArrays.YAXDefaults.max_cache[] = 2.0e8 |
| 44 | +# dc = mapslices(sum, a2, dims="Dim_1", debug = true) |
| 45 | +# ch = YAXArrays.DAT.getloopchunks(dc) |
| 46 | +# #Test loop chunk sizes |
| 47 | +# @test ch == (RegularChunks(5,0,2000), RegularChunks(700,200,1100)) |
| 48 | +# # Test that the allocated buffer is close to what the prescribes size |
| 49 | +# incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
| 50 | +# @test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0# Test that the allocated buffer is close to what the prescribes size |
51 | 51 |
|
52 | 52 |
|
53 |
| -# Test case that is chunk-friendly |
54 |
| -YAXArrays.YAXDefaults.max_cache[] = 1.5e8 |
55 |
| -dc = mapslices(sum, a1, dims="Dim_3", debug = true) |
56 |
| -ch = YAXArrays.DAT.getloopchunks(dc) |
57 |
| -@test ch == (RegularChunks(100,0,4000), RegularChunks(100,0,2000)) |
58 |
| -incubes, outcubes = YAXArrays.DAT.getCubeCache(dc) |
59 |
| -@test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0# Test that the allocated buffer is close to what the prescribes size |
| 53 | +# # Test case that is chunk-friendly |
| 54 | +# YAXArrays.YAXDefaults.max_cache[] = 1.5e8 |
| 55 | +# dc = mapslices(sum, a1, dims="Dim_3", debug = true) |
| 56 | +# ch = YAXArrays.DAT.getloopchunks(dc) |
| 57 | +# @test ch == (RegularChunks(100,0,4000), RegularChunks(100,0,2000)) |
| 58 | +# incubes, outcubes = YAXArrays.DAT.getCubeCache(dc) |
| 59 | +# @test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0# Test that the allocated buffer is close to what the prescribes size |
60 | 60 |
|
61 |
| -#With offset |
62 |
| -a2 = a1[Dim_1=51..3050.5] |
63 |
| -dc = mapslices(sum, a2, dims="Dim_3", debug = true) |
64 |
| -ch = YAXArrays.DAT.getloopchunks(dc) |
65 |
| -@test ch == (RegularChunks(100,50,3000), RegularChunks(100,0,2000)) |
66 |
| -incubes, outcubes = YAXArrays.DAT.getCubeCache(dc) |
67 |
| -@test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0# Test that the allocated buffer is close to what the prescribes size |
| 61 | +# #With offset |
| 62 | +# a2 = a1[Dim_1=51..3050.5] |
| 63 | +# dc = mapslices(sum, a2, dims="Dim_3", debug = true) |
| 64 | +# ch = YAXArrays.DAT.getloopchunks(dc) |
| 65 | +# @test ch == (RegularChunks(100,50,3000), RegularChunks(100,0,2000)) |
| 66 | +# incubes, outcubes = YAXArrays.DAT.getCubeCache(dc) |
| 67 | +# @test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0# Test that the allocated buffer is close to what the prescribes size |
68 | 68 |
|
69 |
| -#With more working memory |
70 |
| -YAXArrays.YAXDefaults.max_cache[] = 4.5e8 |
71 |
| -a2 = a1[Dim_1=51..3050.5] |
72 |
| -dc = mapslices(sum, a1, dims="Dim_3", debug = true); |
73 |
| -ch = YAXArrays.DAT.getloopchunks(dc) |
74 |
| -@test ch == (RegularChunks(300,0,4000), RegularChunks(100,0,2000)) |
75 |
| -incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
76 |
| -@test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0# Test that the allocated buffer is close to what the prescribes size |
| 69 | +# #With more working memory |
| 70 | +# YAXArrays.YAXDefaults.max_cache[] = 4.5e8 |
| 71 | +# a2 = a1[Dim_1=51..3050.5] |
| 72 | +# dc = mapslices(sum, a1, dims="Dim_3", debug = true); |
| 73 | +# ch = YAXArrays.DAT.getloopchunks(dc) |
| 74 | +# @test ch == (RegularChunks(300,0,4000), RegularChunks(100,0,2000)) |
| 75 | +# incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
| 76 | +# @test 0.5 < (sum(sizeof,incubes) + sum(sizeof,outcubes))/YAXArrays.YAXDefaults.max_cache[] <= 1.0# Test that the allocated buffer is close to what the prescribes size |
77 | 77 |
|
78 |
| -#Now a completely different test, this is more for DataFrame functionality |
79 |
| -# and tests if we can proagate irregular axes into the cubes |
80 |
| -using Dates |
81 |
| -yearchunks = map(y->isleapyear(y) ? 366 : 365, 2001:2008) |
82 |
| -c = GridChunks(RegularChunks(100,0,4000), RegularChunks(100,0,2000), IrregularChunks(chunksizes=yearchunks)) |
83 |
| -s = last.(last(c)) |
84 |
| -YAXArrays.YAXDefaults.max_cache[] = 1.0e8 |
85 |
| -a1 = YAXArray(LargeDiskArray(s, c,true)) |
| 78 | +# #Now a completely different test, this is more for DataFrame functionality |
| 79 | +# # and tests if we can proagate irregular axes into the cubes |
| 80 | +# using Dates |
| 81 | +# yearchunks = map(y->isleapyear(y) ? 366 : 365, 2001:2008) |
| 82 | +# c = GridChunks(RegularChunks(100,0,4000), RegularChunks(100,0,2000), IrregularChunks(chunksizes=yearchunks)) |
| 83 | +# s = last.(last(c)) |
| 84 | +# YAXArrays.YAXDefaults.max_cache[] = 1.0e8 |
| 85 | +# a1 = YAXArray(LargeDiskArray(s, c,true)) |
86 | 86 |
|
87 |
| -dc = mapCube(identity, a1, indims = InDims(), outdims = (), debug=true) |
88 |
| -ch = YAXArrays.DAT.getloopchunks(dc) |
89 |
| -@test ch == (RegularChunks(300,0,4000), RegularChunks(100,0,2000), RegularChunks(365,0,2922)) |
90 |
| -incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
91 |
| -@test 0.5 < sum(sizeof,incubes)/YAXArrays.YAXDefaults.max_cache[] <= 1.0# |
| 87 | +# dc = mapCube(identity, a1, indims = InDims(), outdims = (), debug=true) |
| 88 | +# ch = YAXArrays.DAT.getloopchunks(dc) |
| 89 | +# @test ch == (RegularChunks(300,0,4000), RegularChunks(100,0,2000), RegularChunks(365,0,2922)) |
| 90 | +# incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
| 91 | +# @test 0.5 < sum(sizeof,incubes)/YAXArrays.YAXDefaults.max_cache[] <= 1.0# |
92 | 92 |
|
93 |
| -dc = mapCube(identity, a1, indims = InDims(), outdims = (), debug=true,irregular_loopranges = true) |
94 |
| -ch = YAXArrays.DAT.getloopchunks(dc) |
95 |
| -@test ch == (RegularChunks(300,0,4000), RegularChunks(100,0,2000), IrregularChunks(chunksizes=yearchunks)) |
96 |
| -incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
97 |
| -@test 0.5 < sum(sizeof,incubes)/YAXArrays.YAXDefaults.max_cache[] <= 1.0# |
98 |
| -end |
| 93 | +# dc = mapCube(identity, a1, indims = InDims(), outdims = (), debug=true,irregular_loopranges = true) |
| 94 | +# ch = YAXArrays.DAT.getloopchunks(dc) |
| 95 | +# @test ch == (RegularChunks(300,0,4000), RegularChunks(100,0,2000), IrregularChunks(chunksizes=yearchunks)) |
| 96 | +# incubes, outcubes = YAXArrays.DAT.getCubeCache(dc); |
| 97 | +# @test 0.5 < sum(sizeof,incubes)/YAXArrays.YAXDefaults.max_cache[] <= 1.0# |
| 98 | +# end |
99 | 99 |
|
100 | 100 | @testitem "Map Cubes with Different Chunks Issue #182" begin
|
101 | 101 | using YAXArrays
|
|
0 commit comments