Skip to content

Expose "explicit-comms" option in shuffle-based dask_cudf functions#11576

Merged
rapids-bot[bot] merged 14 commits intorapidsai:branch-22.10from
rjzamora:ec-shuffle-option
Sep 27, 2022
Merged

Expose "explicit-comms" option in shuffle-based dask_cudf functions#11576
rapids-bot[bot] merged 14 commits intorapidsai:branch-22.10from
rjzamora:ec-shuffle-option

Conversation

@rjzamora
Copy link
Member

@rjzamora rjzamora commented Aug 22, 2022

Description

This PR exposes an option to use Dask-CUDA's explicit-comms shuffle for the primary shuffle-based dask_cudf.DataFrame methods: shuffle, sort_values, and set_index. Although "explicit-comms" is still experimental, the explicit-shuffle algorithm is known to consistently outperform the "task"-based shuffle.

As far as I can tell, it is not currently possible to use an "explicit-comms" shuffle in dask_cudf without directly importing the function from Dask-CUDA (@madsbk - please do correct me if I am mistaken). In order to simplify benchmarking, and to utilize the optimized shuffle within high-cardinality groupby code, I propose that we make it easier to access the explicit shuffle.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@rjzamora rjzamora added 2 - In Progress Currently a work in progress improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Aug 22, 2022
@rjzamora rjzamora self-assigned this Aug 22, 2022
@github-actions github-actions bot added the Python Affects Python cuDF API. label Aug 22, 2022
@madsbk
Copy link
Member

madsbk commented Aug 23, 2022

As far as I can, it is not currently possible to use an "explicit-comms" shuffle in dask_cudf without directly importing the function from Dask-CUDA (@madsbk - please do correct me if I am mistaken).

Correct, and I think it is a good idea to introduce a new shuffle argument!
But notice, it should be possible to enable explicit-comms shuffle in Dask by setting DASK_EXPLICIT_COMMS=True and importing Dask-CUDA see: https://github.com/rapidsai/dask-cuda/blob/branch-22.10/dask_cuda/__init__.py#L21

@rjzamora
Copy link
Member Author

But notice, it should be possible to enable explicit-comms shuffle in Dask by setting DASK_EXPLICIT_COMMS=True and importing Dask-CUDA

Aha - I thought I remembered there being a way to use explicit-comms from dask/dask_cudf. Thanks for pointing that out!

Do you know if anyone is using that config option? I do like that the monkey-patching approach enables explicit-comms for both cudf and pandas-backed data. However, I don't love that we are using explicit comms when shuffle="tasks". It would be more intuitive for there to be a distinct option, and for the default setting to be configurable (so that using ddf.shuffle(..., shuffle="tasks") will always use the task-based shuffle). Unfortunately, this behavior may be tricky to accomplish with the current interaction between dask and dask_cudf.

I may need to hold off on this PR for a bit until I can figure out a way to keep things simple.

@rjzamora rjzamora marked this pull request as ready for review September 20, 2022 16:14
@rjzamora rjzamora requested a review from a team as a code owner September 20, 2022 16:14
@rjzamora rjzamora added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels Sep 20, 2022
@codecov
Copy link

codecov bot commented Sep 20, 2022

Codecov Report

❗ No coverage uploaded for pull request base (branch-22.10@b2ffea7). Click here to learn what that means.
Patch has no changes to coverable lines.

❗ Current head 6a99f1e differs from pull request most recent head 0cc0d22. Consider uploading reports for the commit 0cc0d22 to get more accurate results

Additional details and impacted files
@@               Coverage Diff               @@
##             branch-22.10   #11576   +/-   ##
===============================================
  Coverage                ?   87.40%           
===============================================
  Files                   ?      133           
  Lines                   ?    21833           
  Branches                ?        0           
===============================================
  Hits                    ?    19084           
  Misses                  ?     2749           
  Partials                ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

A few small questions.

rapids-bot bot pushed a commit to rapidsai/dask-cuda that referenced this pull request Sep 27, 2022
Motivated by discussions in rapidsai/cudf#11576 (primarilty [here](rapidsai/cudf#11576 (comment))). This PR updates the `rearrange_by_columns_tasks` wrapper to target `rearrange_by_columns` instead. The updated wrapper also handles the case that `shuffle="explicit-comms"`.

Authors:
  - Richard (Rick) Zamora (https://github.com/rjzamora)

Approvers:
  - Mads R. B. Kristensen (https://github.com/madsbk)
  - Lawrence Mitchell (https://github.com/wence-)

URL: #992
@rjzamora
Copy link
Member Author

@wence- @madsbk - This PR is now needed to utilize the changes in rapidsai/dask-cuda#992 in dask_cudf. That is, we need this PR to use the explicit-comms shuffle by using code like ddf.shuffle/sort_values/set_index/merge/join(..., shuffle="explicit-comms").

Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

I think there is one possibility of a sequencing bug meaning that a call to sort_values wouldn't get an explicit-comms shuffle.

Other than that, a suggestion for refactoring _set_shuffle: WDYT?

@rjzamora
Copy link
Member Author

@gpucibot merge

@rjzamora rjzamora added 5 - Ready to Merge Testing and reviews complete, ready to merge 4 - Needs Dask Reviewer and removed 3 - Ready for Review Ready for review by team 5 - Ready to Merge Testing and reviews complete, ready to merge labels Sep 27, 2022
@rapids-bot rapids-bot bot merged commit bcf361f into rapidsai:branch-22.10 Sep 27, 2022
@quasiben
Copy link
Member

I'll add @wence- to the list of reviewers for next time

@rjzamora rjzamora deleted the ec-shuffle-option branch September 27, 2022 21:01
rjzamora added a commit to rjzamora/cudf that referenced this pull request Sep 28, 2022
rapids-bot bot pushed a commit that referenced this pull request Sep 28, 2022
Due to some unfortunate issues with #11576 and rapidsai/dask-cuda#992, I feel that these PRs should be reverted before the 22.10 release.  This PRs roll back some recent changes that allow users to explicitly pass `shuffle="explicit-comms"` to certain shuffle-based algorithms.

cc @wence-

Authors:
  - Richard (Rick) Zamora (https://github.com/rjzamora)

Approvers:
  - GALI PREM SAGAR (https://github.com/galipremsagar)
  - Lawrence Mitchell (https://github.com/wence-)

URL: #11803
@vyasr vyasr added 4 - Needs Review Waiting for reviewer to review or respond and removed 4 - Needs Dask Reviewer labels Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4 - Needs Review Waiting for reviewer to review or respond improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants