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

Decoupling raft handle from underlying resources #1111

Merged

Conversation

cjnolet
Copy link
Member

@cjnolet cjnolet commented Dec 19, 2022

This implements a design idea a few of us have been kicking around for a little while now to help decouple underlying resources from the raft handle and also allow users to never have to explicitly include headers for resources that are never used (such as cublas, cusolver, cusparse, comms, etc...).

This effectively breaks the existing raft::handle_t into separate headers for the various resources it contains, providing functions that can be individually included and invoked on a raft::resources. This still allows us to write something like a raft::device_resources (and also allows us to maintain API compatibility in the meantime by backing the existing raft::handle_t with a raft::resources.

One of the major goals of this PR is to also enable a handle to be used outside of just cuda resources and to allow for unused resources to not need to be loaded nor compiled at all into user code downstream.

Follow-on work after this PR will include:

  1. Updating all of RAFT's public functions to accept raft::resources and using the individual resource accessors instead of assuming device_resources everywhere.
  2. Deprecating the handle_t in favor of the more explicit device_resources

@cjnolet cjnolet added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Dec 19, 2022
@github-actions github-actions bot added the cpp label Dec 19, 2022
@cjnolet cjnolet self-assigned this Dec 21, 2022
@github-actions github-actions bot added the CMake label Dec 21, 2022
@cjnolet cjnolet marked this pull request as ready for review December 21, 2022 23:15
@cjnolet cjnolet requested review from a team as code owners December 21, 2022 23:15
@codecov-commenter
Copy link

codecov-commenter commented Dec 22, 2022

Codecov Report

Base: 87.68% // Head: 87.99% // Increases project coverage by +0.30% 🎉

Coverage data is based on head (e7573fd) compared to base (53ba226).
Patch coverage: 92.10% of modified lines in pull request are covered.

Additional details and impacted files
@@               Coverage Diff                @@
##           branch-23.02    #1111      +/-   ##
================================================
+ Coverage         87.68%   87.99%   +0.30%     
================================================
  Files                20       21       +1     
  Lines               471      483      +12     
================================================
+ Hits                413      425      +12     
  Misses               58       58              
Impacted Files Coverage Δ
python/pylibraft/pylibraft/common/ai_wrapper.py 88.88% <88.88%> (ø)
python/pylibraft/pylibraft/common/__init__.py 100.00% <100.00%> (ø)
python/pylibraft/pylibraft/common/cai_wrapper.py 100.00% <100.00%> (+11.11%) ⬆️

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.

@cjnolet cjnolet requested review from benfred and dantegd January 4, 2023 02:16
Copy link
Contributor

@wphicks wphicks left a comment

Choose a reason for hiding this comment

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

Really excited to see this change go in! Just one performance issue that I noticed, but otherwise it looks great.

cpp/include/raft/core/resource/sub_comms.hpp Show resolved Hide resolved
cpp/include/raft/core/resources.hpp Outdated Show resolved Hide resolved
Copy link
Member

@dantegd dantegd left a comment

Choose a reason for hiding this comment

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

Love the design and implementation

docs/source/developer_guide.md Show resolved Hide resolved
Copy link
Contributor

@wphicks wphicks left a comment

Choose a reason for hiding this comment

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

Looks great!

Copy link
Member

@benfred benfred left a comment

Choose a reason for hiding this comment

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

looks great!

Copy link
Contributor

@achirkin achirkin left a comment

Choose a reason for hiding this comment

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

Spotted a few minor things while I was getting used to the new code.

cpp/include/raft/core/resource/cuda_stream.hpp Outdated Show resolved Hide resolved
cpp/include/raft/core/resource/cuda_stream.hpp Outdated Show resolved Hide resolved
cpp/include/raft/core/resource/cuda_event.hpp Outdated Show resolved Hide resolved
cpp/include/raft/core/resource/cuda_stream_pool.hpp Outdated Show resolved Hide resolved
@cjnolet cjnolet requested a review from a team as a code owner January 10, 2023 17:18
Copy link
Member

@benfred benfred left a comment

Choose a reason for hiding this comment

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

lgtm!

cpp/test/random/multi_variable_gaussian.cu Outdated Show resolved Hide resolved
cpp/test/random/multi_variable_gaussian.cu Outdated Show resolved Hide resolved
cpp/test/random/multi_variable_gaussian.cu Outdated Show resolved Hide resolved
@cjnolet
Copy link
Member Author

cjnolet commented Jan 10, 2023

/merge

@rapids-bot rapids-bot bot merged commit 2c97abe into rapidsai:branch-23.02 Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake cpp improvement Improvement / enhancement to an existing function non-breaking Non-breaking change python
Projects
Development

Successfully merging this pull request may close these issues.

7 participants