Skip to content
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

refactor(memory): update mem_reallocate to copy optional interface #1518

Closed
wants to merge 2 commits into from

Conversation

mjreno
Copy link
Contributor

@mjreno mjreno commented Dec 20, 2023

Update:
The mem_reallocate interface has been updated to include an optional copy argument. It has been refactored to copy by default, however, this can be overriden with the optional arg. The interface will now throw an error if the array size has shrunk and copy is set to TRUE. The mem_reset interface has been removed.


The MemoryManager mem_reallocate interface for the most part assumes a size increasing reallocation and then copies existing array values into the new array. This new interface is meant to reallocate to any size (including 0) and to never copy existing values. The existing mem_reallocate interface could probably be updated to alternatively provide this same behavior so this PR represents one way forward.

This is needed by IDM when Dynamic list based array data is loaded across periods that do not have an explicit dimension- TVK and TVS are examples. In these cases, maxbound implicitly is the number of reduced nodes, however to reduce memory overhead it might preferred to reallocate these arrays to the size needed for each period. This interface supports the idea of resetting allocated memory from the previous period.

@mjreno mjreno marked this pull request as draft December 20, 2023 15:38
@mjreno mjreno requested a review from mjr-deltares December 20, 2023 16:42
Copy link
Contributor

@mjr-deltares mjr-deltares left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mjreno , I see no obstacles but I would like to discuss this offline to better get the gist of it. I will contact you.

@mjreno mjreno force-pushed the mem_reset_interface branch from 6b64c5b to 22c8707 Compare January 10, 2024 14:01
@mjreno mjreno added the onhold Waiting for something label Jan 10, 2024
@mjreno mjreno force-pushed the mem_reset_interface branch from 22c8707 to 37f69a8 Compare January 11, 2024 21:24
@mjreno mjreno changed the title extend(MemoryManager): add mem_reset interface extend(MemoryManager): update mem_reallocate to copy optional interface Jan 12, 2024
@mjreno mjreno changed the title extend(MemoryManager): update mem_reallocate to copy optional interface extend(memory): update mem_reallocate to copy optional interface Jan 13, 2024
@mjreno mjreno added this to the 6.5.0 milestone Jan 15, 2024
@mjreno mjreno removed the onhold Waiting for something label Jan 15, 2024
@mjreno mjreno marked this pull request as ready for review January 16, 2024 00:59
@mjreno mjreno changed the title extend(memory): update mem_reallocate to copy optional interface refactor(memory): update mem_reallocate to copy optional interface Jan 21, 2024
@mjreno
Copy link
Contributor Author

mjreno commented Feb 7, 2024

Closing as these changes have been added to PR #1581.

@mjreno mjreno closed this Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants