-
Notifications
You must be signed in to change notification settings - Fork 28
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
Support malloc/free when configured with Umpire #1507
base: develop
Are you sure you want to change the base?
Conversation
New test uses all available memory spaces and reallocates memory between them. The test crashes because we assume memory is from Umpire even when it's Dynamic.
This fixes (1) Dynamic memory space allocation/reallocation and (2) reallocations betwen Dynamic memory space and Umpire spaces.
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 think we might need to discuss this further since the proposed change might lead to unexpected behaviors.
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.
@gunney1 and I discussed this today, and he will rework this PR.
It seems that he has a user request to support malloc
allocations through Axom's memory_management API even when Axom is configured with Umpire.
I recommended that this new use case should use an allocator ID that is not valid with umpire (e.g. a negative number other than -1, which we currently use as our INVALID_ALLOCATOR_ID
).
He will also remove/rename the DYNAMIC_ALLOCATOR_ID
global variable, which was only recently added since the name is confusing and it uses a potentially valid Umpire allocator ID (0
)
meaning. I had confused dynamic with malloc. There was no allocator specifically for malloc/free. Now there is.
Malloc always uses malloc/free. Dynamic uses Umpire when it can.
Summary
Malloc
memory space and its associatedMALLOC_ALLOCATOR_ID
. These use malloc, free and realloc.memory_management.hpp
crashes caused by assuming all pointers are from Umpire.memory_management.hpp
assumes that non-Umpire memory is from malloc and realloc.Malloc
memory space.axom:: getAllocatorIDFromPointer
to returnMALLOC_ALLOCATOR_ID
instead ofDYNAMIC_ALLOCATOR_ID
. The latter doesn't refer to a specific allocator but the current Umpire default allocator, which can change.DYNAMIC_ALLOCATOR_ID
, whose role was taken over byMALLOC_ALLOCATOR_ID
.