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

Make thrust_allocator deallocate safe in multi-device setting #1533

Merged
merged 6 commits into from
Apr 16, 2024

Conversation

wence-
Copy link
Contributor

@wence- wence- commented Apr 15, 2024

Description

Previously, the user had to arrange that the device active when a
thrust_allocator object was created was also active when allocate and
deallocate was called. This is hard to manage if exceptions are
thrown. Instead, save the active device on construction and ensure
that it is active when calling deallocate and deallocate. This means
that device_vector is safe to destruct with RAII semantics in a
multi-device setting.

Add tests of this facility, and correct the parameterization usage in
the other thrust allocator tests such that we actually check the MRs
we're parameterizing over.

Checklist

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

Previously, the user had to arrange that the device active when a
thrust_allocator object was created was also active when allocate and
deallocate was called. This is hard to manage if exceptions are
thrown. Instead, save the active device on construction and ensure
that it is active when calling deallocate and deallocate. This means
that device_vector is safe to destruct with RAII semantics in a
multi-device setting.

Add tests of this facility, and correct the parameterization usage in
the other thrust allocator tests such that we actually check the MRs
we're parameterizing over.

- Closes rapidsai#1527
@wence- wence- requested a review from a team as a code owner April 15, 2024 16:04
@wence- wence- requested review from rongou and vyasr April 15, 2024 16:04
@wence- wence- added non-breaking Non-breaking change improvement Improvement / enhancement to an existing function labels Apr 15, 2024
@github-actions github-actions bot added cpp Pertains to C++ code and removed non-breaking Non-breaking change improvement Improvement / enhancement to an existing function labels Apr 15, 2024
README.md Show resolved Hide resolved
Copy link
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

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

Some minor edits. Looks great!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
tests/mr/device/thrust_allocator_tests.cu Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@wence-
Copy link
Contributor Author

wence- commented Apr 16, 2024

/merge

@wence- wence- added non-breaking Non-breaking change improvement Improvement / enhancement to an existing function labels Apr 16, 2024
@rapids-bot rapids-bot bot merged commit 588928f into rapidsai:branch-24.06 Apr 16, 2024
52 checks passed
@wence- wence- deleted the wence/fix/1527 branch April 16, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpp Pertains to C++ code improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[FEA] Make device_vector safer to use in multi-device setting
3 participants