Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concatenate small input chunks before P2P rechunking #8832

Merged
merged 22 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix merge (2/2)
  • Loading branch information
hendrikmakait committed Aug 20, 2024
commit 1db2284beb6663b53a589980d8c383a45ac92db0
6 changes: 4 additions & 2 deletions distributed/shuffle/_rechunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ def _calculate_prechunking(
old_to_new_axis = _old_to_new[axis_index]
old_axis = old_chunks[axis_index]
split_axis = []
partial_chunks = []
for slice_ in slices:
partial_chunks = []
first_new_chunk = slice_.start
first_old_chunk, first_old_slice = old_to_new_axis[first_new_chunk][0]
last_new_chunk = slice_.stop - 1
Expand Down Expand Up @@ -484,7 +484,9 @@ def _calculate_prechunking(

partial_chunks.append(chunk_size)
split_axis.append(partial_chunks)

partial_chunks = []
if partial_chunks:
split_axis.append(partial_chunks)
split_axes.append(split_axis)

has_nans = (any(math.isnan(y) for y in x) for x in old_chunks)
Expand Down
4 changes: 2 additions & 2 deletions distributed/shuffle/tests/test_rechunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ async def test_partial_rechunk_taskgroups(c, s):
],
)
def test_calculate_prechunking_1d(old, new, expected):
actual = _calculate_prechunking(old, new)
actual = _calculate_prechunking(old, new, np.dtype)
assert actual == expected


Expand All @@ -1375,5 +1375,5 @@ def test_calculate_prechunking_1d(old, new, expected):
],
)
def test_calculate_prechunking_2d(old, new, expected):
actual = _calculate_prechunking(old, new)
actual = _calculate_prechunking(old, new, np.dtype(np.int16))
assert actual == expected
Loading