-
Notifications
You must be signed in to change notification settings - Fork 52
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
Get the Total Amount of Umpire Memory Allocated #929
base: develop
Are you sure you want to change the base?
Conversation
auto& rm = umpire::ResourceManager::getInstance(); | ||
std::size_t total_memory{0}; | ||
|
||
for (auto s : rm.getResourceNames()) { |
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.
Is this limited to the base resources (PINNED, UNIFIED_MEMORY, DEVICE, HOST, etc...)? Or does it include the pools built on top of them? Just want to make sure we're not double counting.
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 resources - this is the correct way to get everything (including any alignment adjustments) without double counting.
…into feature/get-total-mem-usage
@@ -328,6 +328,7 @@ class ResourceManager { | |||
util::AllocationMap m_allocations; | |||
|
|||
std::list<std::unique_ptr<strategy::AllocationStrategy>> m_allocators; | |||
std::vector<std::string> m_shared_allocators_by_name; |
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.
std::vector<std::string> m_shared_allocators_by_name; | |
std::vector<std::string> m_shared_allocator_names; |
The by_name
suggests it's a structure to access the allocators by their names (like a map). This isn't the case, so I suggest a slightly different name.
@@ -347,6 +348,7 @@ class ResourceManager { | |||
friend std::vector<util::AllocationRecord> get_allocator_records(Allocator); | |||
friend strategy::ZeroByteHandler; | |||
friend strategy::mixins::AllocateNull; | |||
friend std::size_t get_total_memory_allocated(); |
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.
Add a method to the get the names, rather than having this be a friend
and accessing the data structure directly
auto& rm = umpire::ResourceManager::getInstance(); | ||
std::size_t total_memory{0}; | ||
|
||
for (auto s : rm.getResourceNames()) { |
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 resources - this is the correct way to get everything (including any alignment adjustments) without double counting.
No description provided.