You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the upstream integration of AMD OpenFOAM changes by @suyashtnet al., it would be useful to easily handle (delete) memory that may or may not have been managed by umpire.
For this to work, would ideally wish to either have a return value from the ResourceManager::deallocate() or have a non-failing query for the associated allocator (if any).
For example,
auto& rm = umpire::ResourceManager::getInstance();
auto* strategy = rm.hasAllocationStrategy(ptr); // Like findAllocatorForPointer(), but non-failing
if (strategy)
{
// call Allocator(strategy).deallocate(....); - except that is a private constructor and really messy
}
else
{
// Not managed by umpire
delete ptr;
}
Another alternative might be to have a non-failing deallocate that returns a value.
For example,
auto& rm = umpire::ResourceManager::getInstance();
if (!rm.try_dealloc(ptr))
{
// Not managed by umpire
delete ptr;
}
I'm open to any simple solution that doesn't involve a try/catch.
The text was updated successfully, but these errors were encountered:
This is indeed adequate for the purpose, but does do a double lookup (first for the hasAllocator, second for the deallocate call), which may be preferable to avoid.
However, feel free to close with comment if you'd prefer to leave the API as is.
For the upstream integration of AMD OpenFOAM changes by @suyashtn et al., it would be useful to easily handle (delete) memory that may or may not have been managed by umpire.
For this to work, would ideally wish to either have a return value from the
ResourceManager::deallocate()
or have a non-failing query for the associated allocator (if any).For example,
Another alternative might be to have a non-failing deallocate that returns a value.
For example,
I'm open to any simple solution that doesn't involve a try/catch.
The text was updated successfully, but these errors were encountered: