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

Properly handle unknown chunk sizes in P2P rechunking #7856

Merged
merged 13 commits into from May 25, 2023

Conversation

hendrikmakait
Copy link
Member

@hendrikmakait hendrikmakait commented May 24, 2023

@github-actions
Copy link
Contributor

github-actions bot commented May 24, 2023

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

       20 files  +       1         20 suites  +1   11h 0m 33s ⏱️ + 41m 0s
  3 640 tests +     17    3 528 ✔️ +     46     108 💤 +    3  3  -   33  1 🔥 +1 
35 190 runs  +3 456  33 427 ✔️ +3 557  1 758 💤 +154  4  - 256  1 🔥 +1 

For more details on these failures and errors, see this check.

Results for commit a7ae007. ± Comparison against base commit 28459a5.

This pull request removes 13 and adds 30 tests. Note that renamed tests count towards both.
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_unknown[x0-chunks0]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_unknown[x1-chunks1]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_unknown[x10-chunks10]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_unknown[x11-chunks11]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_unknown[x2-chunks2]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_unknown[x3-chunks3]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_unknown[x4-chunks4]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_unknown[x5-chunks5]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_unknown[x6-chunks6]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_unknown[x7-chunks7]
…
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_same_fully_unknown
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_same_fully_unknown_floats
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_same_partially_unknown
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_with_fully_unknown_dimension[x0-chunks0]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_with_fully_unknown_dimension[x1-chunks1]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_with_fully_unknown_dimension[x10-chunks10]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_with_fully_unknown_dimension[x11-chunks11]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_with_fully_unknown_dimension[x2-chunks2]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_with_fully_unknown_dimension[x3-chunks3]
distributed.shuffle.tests.test_rechunk ‑ test_rechunk_with_fully_unknown_dimension[x4-chunks4]
…

♻️ This comment has been updated with latest results.

Copy link
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hendrikmakait -- it looks like there are some legitimate rechunking errors here

.pre-commit-config.yaml Outdated Show resolved Hide resolved
@jrbourbeau jrbourbeau mentioned this pull request May 24, 2023
4 tasks
@hendrikmakait hendrikmakait changed the title Follow renaming of dask.array.rechunk._old_to_new Properly handle unknown chunk sizes in P2P rechunking May 25, 2023
Comment on lines +76 to +103
old_chunks = x.chunks
new_chunks = chunks

def is_unknown(dim: ChunkedAxis) -> bool:
return any(math.isnan(chunk) for chunk in dim)

old_is_unknown = [is_unknown(dim) for dim in old_chunks]
new_is_unknown = [is_unknown(dim) for dim in new_chunks]

if old_is_unknown != new_is_unknown or any(
new != old for new, old in compress(zip(old_chunks, new_chunks), old_is_unknown)
):
raise ValueError(
"Chunks must be unchanging along dimensions with missing values.\n\n"
"A possible solution:\n x.compute_chunk_sizes()"
)

old_known = [dim for dim, unknown in zip(old_chunks, old_is_unknown) if not unknown]
new_known = [dim for dim, unknown in zip(new_chunks, new_is_unknown) if not unknown]

old_sizes = [sum(o) for o in old_known]
new_sizes = [sum(n) for n in new_known]

if old_sizes != new_sizes:
raise ValueError(
f"Cannot change dimensions from {old_sizes!r} to {new_sizes!r}"
)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is currently copied from dask.array.rechunk.old_to_new. This should be cleaned up into a follow-up PR that moves validation logic into a helper.

distributed/shuffle/_worker_extension.py Show resolved Hide resolved
Comment on lines +636 to +650
pytest.param(
da.ones(shape=(1000, 10), chunks=(5, 10)),
(None, 5),
marks=pytest.mark.skip(reason="distributed#7757"),
),
pytest.param(
da.ones(shape=(1000, 10), chunks=(5, 10)),
{1: 5},
marks=pytest.mark.skip(reason="distributed#7757"),
),
pytest.param(
da.ones(shape=(1000, 10), chunks=(5, 10)),
(None, (5, 5)),
marks=pytest.mark.skip(reason="distributed#7757"),
),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These parametrizations are currently failing on CI due to horrible performance. My suspicion is that the performance problems are related to (but not necessarily exclusively caused by) #7757

@hendrikmakait
Copy link
Member Author

A/B tests did not show any performance impact: https://github.com/coiled/benchmarks/actions/runs/5078894598

@hendrikmakait hendrikmakait merged commit 6b04277 into dask:main May 25, 2023
0 of 3 checks passed
@hendrikmakait hendrikmakait deleted the renamed-old_to_new branch May 25, 2023 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants