-
Notifications
You must be signed in to change notification settings - Fork 757
Add managed_pointer that is compatible with STL. #1068
Add managed_pointer that is compatible with STL. #1068
Conversation
Internal shelve: 28110928. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
managed_pointer
is definitely the wrong name for this; it suggests that it is a smart pointer and will clean up the object itself.
Please call it universal_pointer
.
I think the right name is Others have implemented this functionality in the past, and it's been consistently referred to as "managed" pointer. |
|
Is this only in the cuda namespace?
Sent from Nine<http://www.9folders.com/>
…________________________________
From: Jared Hoberock <notifications@github.com>
Sent: Friday, March 13, 2020 17:07
To: thrust/thrust
Cc: Bryce Lelbach; Review requested
Subject: Re: [thrust/thrust] Add managed_pointer that is compatible with STL. (#1068)
Please call it universal_pointer.
I think the right name is managed_ptr. It's allocated by cudaMallocManaged. "Universal" doesn't mean anything to CUDA programmers. The _ptr suffix should also be used for consistency.
Others have implemented this functionality in the past, and it's been consistently referred to as "managed" pointer.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub<#1068 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AADBG4WGAWZRKQVKXJEUWH3RHLDCPANCNFSM4LF6F3GA>.
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
|
It's in a cuda specific |
OK, if it's in a detail namespace, it doesn't really matter what it's called :-) |
We should have a top-level way of spelling the pointer type returned by |
Should we have a |
Ya'll seem to have much stronger opinions on this than I do, so let's see if we can find a color for this bikeshed that we'll all be happy with 😄If I'm following correctly:
How about we go with |
As it stands, And if we had that, I think |
If the purpose of this allocator is to be useful in any Thrust backend, I'd prefer it simply be named That naming makes it obvious what it does when CUDA is not involved. |
Only concern I have there is that we're already using the term "universal" outside of cuda, eg. |
Yes, we need a top level alias for the allocator and for the pointer type. I'd suggest a quick meeting to discuss this. |
09cd854
to
eeca28d
Compare
The existing `cuda::pointer` uses a fancy reference that overloads `operator&`, and some STL implementations misbehave when that operator does not return the actual memory address of the object. Since universal_memory_resource allocates memory that works on both host and device, we need to be able to use these types with stl containers, such as std::vector, std::unique_ptr, etc. This patch adds a managed_pointer implementation that behaves like `cuda::pointer`, but returns a regular c++ reference, allowing the thrust universal allocator to work with STL containers.
eeca28d
to
3c9b9bd
Compare
@brycelelbach this is blocked on your change request. New Shelve: 28165473 |
The existing
cuda::pointer
uses a fancy reference that overloadsoperator&
, and some STL implementations misbehave when that operatordoes not return the actual memory address of the object.
Since universal_memory_resource allocates memory that works on both host
and device, we need to be able to use these types with stl containers,
such as std::vector.
This patch adds a managed_pointer implementation that behaves like
cuda::pointer
, but returns a regular c++ reference, allowingthe thrust universal allocator to work with STL containers.