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

Fix partitioning in explicit-comms shuffle #1356

Merged
merged 4 commits into from
Jul 9, 2024

Conversation

rjzamora
Copy link
Member

@rjzamora rjzamora commented Jul 3, 2024

Closes #1355

Current version of the explicit-comms shuffle does not produce partitioning that is consistent with dask.dataframe.

@rjzamora rjzamora added bug Something isn't working 2 - In Progress Currently a work in progress non-breaking Non-breaking change labels Jul 3, 2024
@rjzamora rjzamora self-assigned this Jul 3, 2024
@github-actions github-actions bot added the python python code needed label Jul 3, 2024
Comment on lines +545 to +546
# Make sure partitions are properly ordered
futures = [_futures.pop(i) for i in range(npartitions)]
Copy link
Member Author

Choose a reason for hiding this comment

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

@ayushdg - FYI: I think this means the ordering of partitions could have been "wrong" even before the dtype-casting change in dask :/

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see. Based on the limited testing I've done the biggest change in results on my tests were from #1323 , even when paired with an older version of Dask prior to the dtype change.

Comment on lines -144 to +150
ddf = dd.from_pandas(df.copy(), npartitions=input_nparts).persist(
workers=all_workers
)
ddf1 = dd.from_pandas(df.copy(), npartitions=input_nparts)
Copy link
Member Author

Choose a reason for hiding this comment

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

Strange Finding: Even without the changes in this PR, I get a "cancelled" error when I persist ddf and then perform both an explicit comms shuffle and then a task-based shuffle. I don't understand the cause of this yet.

Copy link
Member

Choose a reason for hiding this comment

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

Are we ok still moving ahead with the changes even though there's a cancelation error?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The changes in this PR are independent of the cancellation error (it happens in branch-24.08 without these changes).

Another important detail: I only get the error when query-planning is disabled. Therefore, I assume the problem has to do with a key-name collision that doesn't happen with dask-expr (which is much more disciplined about key names than the legacy API is).

Comment on lines -152 to +156
ddf,
ddf1,
Copy link
Member Author

Choose a reason for hiding this comment

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

Seems a bit confusing to me that we were previously modifying the initial collection.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense to avoid that. I think @madsbk may have an idea if this was an oversight or was intentional when he gets back.

Copy link
Member

Choose a reason for hiding this comment

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

I think it was a oversight :)

@rjzamora rjzamora marked this pull request as ready for review July 5, 2024 14:59
@rjzamora rjzamora requested a review from a team as a code owner July 5, 2024 14:59
Copy link
Member

@pentschev pentschev left a comment

Choose a reason for hiding this comment

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

This seems sensible to me, thanks @rjzamora . I've left a few questions, but I don't think any of them should be blockers if you're satisfied, feel free to merge it if you think there's nothing more to be done.

Comment on lines -144 to +150
ddf = dd.from_pandas(df.copy(), npartitions=input_nparts).persist(
workers=all_workers
)
ddf1 = dd.from_pandas(df.copy(), npartitions=input_nparts)
Copy link
Member

Choose a reason for hiding this comment

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

Are we ok still moving ahead with the changes even though there's a cancelation error?

Comment on lines -152 to +156
ddf,
ddf1,
Copy link
Member

Choose a reason for hiding this comment

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

Makes sense to avoid that. I think @madsbk may have an idea if this was an oversight or was intentional when he gets back.

Comment on lines 200 to 201
# TODO: Use `partition_by_hash` if/when dtype-casting is added
# (See: https://github.com/rapidsai/dask-cuda/pull/1356)
Copy link
Member

Choose a reason for hiding this comment

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

The link refers to this PR, what is there exactly to see here for additional information on this TODO?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah good catch! I was planning to file an issue to add a cast_dtype argument to partition_by_hash (similar to the argument added to partitioning_index in dask/dask#10705). I'll update the link before this gets merged.

@rjzamora rjzamora added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 2 - In Progress Currently a work in progress labels Jul 9, 2024
@rjzamora
Copy link
Member Author

rjzamora commented Jul 9, 2024

/merge

@rapids-bot rapids-bot bot merged commit fe23e45 into rapidsai:branch-24.08 Jul 9, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge bug Something isn't working non-breaking Non-breaking change python python code needed
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Explicit-comms shuffle produces different partitioning than "tasks"
4 participants