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

Add CMake option for initializing all memory to 0 #209

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

adayton1
Copy link
Member

In some cases, it is desirable to have memory initialized to 0 (particularly for debugging). This option is controlled by passing CHAI_ENABLE_ZERO_INITIALIZED_MEMORY=ON to CMake. It is off by default to avoid imposing any overhead.

@adayton1
Copy link
Member Author

I don't think the CI failure is related to my change. Looks like some build artifacts are not cleaned up correctly.

@rrsettgast
Copy link
Contributor

Would it be also useful to be able to initialize values to like the maximum of the range so you would trigger an overflow if not initialized?

@adayton1
Copy link
Member Author

Are you thinking something like std::numeric_limits::max()? I like the idea, but it does get a little more complicated since the particular type is not available for the ArrayManager::allocate (it appears to be available for ArrayManager::reallocate, however). So either we would have to add the type for the ArrayManager::allocate call, or we would have to plumb this into the ManagedArray class itself. @davidbeckingsale, any ideas?

Copy link
Contributor

@robinson96 robinson96 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants