-
Notifications
You must be signed in to change notification settings - Fork 198
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 pool_memory_resource::pool_size()
public
#962
Conversation
@gpucibot merge |
python/rmm/_lib/memory_resource.pyx
Outdated
return (<pool_memory_resource[device_memory_resource]*>( | ||
self.c_obj.get()))[0].pool_size() |
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.
This feels like a lot to cram into one line. Would it make sense to break this up a bit by assigning to variables?
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.
I tried to clean this up a bit. Unfortunately, unlike C++, I can't create a type alias for pool_memory_resource[device_memory_resource]
, so this is still a bit awkward looking.
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.
(Cython doesn't let you ctypedef
inside a function)
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.
The change looks much better! Thanks Ashwin 😄
Interesting guessing you tried ctypedef
? Did you try DEF
? In any event this seems less critical at least from my perspective
It's useful to know how much memory RMM has "to itself" at any given time. When using a
pool_memory_resource
, being able to query the current pool size is the only way to know that.This is to enable the use cases described in #956 (combined with a
CallbackMemoryResource
, for which I'll open a subsequent PR).