-
Notifications
You must be signed in to change notification settings - Fork 209
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
Enable constructing DeviceBuffers using a non-default memory resource and correctly manage memory resource lifetime in DeviceBuffer #953
Conversation
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.
Thanks Ashwin! 😄
Had a couple suggestions below
Also should we add this to functions like to_device
, etc.?
@@ -47,7 +47,8 @@ cdef class DeviceBuffer: | |||
def __cinit__(self, *, | |||
uintptr_t ptr=0, | |||
size_t size=0, | |||
Stream stream=DEFAULT_STREAM): | |||
Stream stream=DEFAULT_STREAM, | |||
DeviceMemoryResource mr=None): |
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.
May need to cimport
this and device_memory_resource
above
Co-authored-by: jakirkham <[email protected]>
|
||
with nogil: | ||
c_ptr = <const void*>ptr | ||
c_stream_view = stream.view() | ||
c_mr = mr.c_obj.get() |
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.
Just a side note, it may be possible to use get_mr
here, but that method would need to be marked nogil
rmm/python/rmm/_lib/memory_resource.pyx
Lines 167 to 168 in d94bdfd
cdef device_memory_resource* get_mr(self): | |
return self.c_obj.get() |
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.
Ah, that's probably what we should do
This PR has been labeled |
@shwina can we bump this to next release? |
Thanks - did so. |
This PR has been labeled |
This PR has been labeled |
I'm going to go ahead and close this one out as it's beyond stale. |
Closes #944