Skip to content

Commit 4d32b51

Browse files
committed
make chunks a little smaller
1 parent 547cdb9 commit 4d32b51

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/mdio/core/utils_write.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from numpy.typing import DTypeLike
1010

1111

12-
MAX_SIZE_LIVE_MASK = 256 * 1024**2
12+
MAX_SIZE_LIVE_MASK = 128 * 1024**2
1313
MAX_COORDINATES_BYTES = 16 * 1024**2
1414

1515

tests/unit/test_auto_chunking.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class TestAutoChunkLiveMask:
4848
[
4949
((100,), (100,)), # small 1d
5050
((100, 100), (100, 100)), # small 2d
51-
((50000, 50000), (25000, 25000)), # large 2d
52-
((1500, 1500, 1500), (750, 750, 750)), # large 3d
53-
((1000, 1000, 100, 36), (334, 334, 100, 36)), # large 4d
51+
((50000, 50000), (12500, 12500)), # large 2d
52+
((1500, 1500, 1500), (500, 500, 500)), # large 3d
53+
((1000, 1000, 100, 36), (200, 200, 100, 36)), # large 4d
5454
],
5555
)
5656
def test_auto_chunk_live_mask(
@@ -65,7 +65,7 @@ def test_auto_chunk_live_mask(
6565
@pytest.mark.parametrize(
6666
"shape",
6767
[
68-
# Below are >500MiB. Smaller ones tested above
68+
# Below are >250MiB. Smaller ones tested above
6969
(32768, 32768),
7070
(46341, 46341),
7171
(86341, 96341),
@@ -74,7 +74,7 @@ def test_auto_chunk_live_mask(
7474
(1024, 1024, 1024),
7575
(215, 215, 215, 215),
7676
(512, 216, 512, 400),
77-
(74, 74, 74, 74, 74),
77+
(64, 128, 64, 32, 64),
7878
(512, 17, 43, 200, 50),
7979
],
8080
)
@@ -84,6 +84,7 @@ def test_auto_chunk_live_mask_nbytes(self, shape: tuple[int, ...]) -> None:
8484
result = get_live_mask_chunksize(shape)
8585
chunk_elements = np.prod(result)
8686

87-
# We want them to be 500MB +/- 25%
87+
# We want them to be 250MB +/- 50%
88+
print(result)
8889
assert chunk_elements > MAX_SIZE_LIVE_MASK * 0.75
8990
assert chunk_elements < MAX_SIZE_LIVE_MASK * 1.25

0 commit comments

Comments
 (0)