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

WIP: Pass H5MM calls to stdlib counterparts by default #1929

Closed
wants to merge 6 commits into from

Conversation

jhendersonHDF
Copy link
Collaborator

@jhendersonHDF jhendersonHDF commented Jul 25, 2022

Profiling of a synthetic benchmark for the Mathworks folks shows that the pass through from H5MM_malloc -> HDmalloc and similar adds a slight bit of overhead. Since the H5MM stuff generally doesn't add anything but overhead when the memory alloc sanity check option is off, let's just map those directly to their stdlib counterparts by default.

The only real functional change that should be here is that H5MM_realloc would be non-portable if you call it like H5MM_realloc(ptr, 0), but "let's not do that". I've left H5MM_xfree, xfree_const and xstrdup as they are, since they rely on different NULL pointer behavior from their stdlib counterparts.

@derobins
Copy link
Member

I think these test failures are due to a library bug that's just being exposed here. clang emits warnings in the long double code in H5Tconv.c.

Copy link
Contributor

@qkoziol qkoziol left a comment

Choose a reason for hiding this comment

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

I understand the motivation and generally like this change. But, I'm concerned that the #ifdef'd code will languish and then rot (i.e. not work correctly) without a regular (if perhaps not terribly frequent) automated regression test that sets H5_MEMORY_ALLOC_SANITY_CHECK. Is that possible?

@jhendersonHDF
Copy link
Collaborator Author

I understand the motivation and generally like this change. But, I'm concerned that the #ifdef'd code will languish and then rot (i.e. not work correctly) without a regular (if perhaps not terribly frequent) automated regression test that sets H5_MEMORY_ALLOC_SANITY_CHECK. Is that possible?

I think this would certainly be a good candidate for a github action, either a compile-only or full workflow. I wish I could turn it on by default for my developer build mode PR, but unfortunately that will cause problems with filter plugins and probably confuse some future new developers.

@jhendersonHDF jhendersonHDF marked this pull request as draft July 26, 2022 16:29
@jhendersonHDF
Copy link
Collaborator Author

Marking this PR as a draft for now, since it looks like it's exposing an issue in the H5T code for long double -> float and long double -> double conversions.

@derobins
Copy link
Member

derobins commented Jul 26, 2022

I feel like the memory alloc sanity check code is unnecessary and we should just have a GitHub action that uses -fsanitize or valgrind or whatnot. We shouldn't be reinventing the wheel in HDF5.

@derobins
Copy link
Member

The failing tests might be fixed by #1956

@qkoziol
Copy link
Contributor

qkoziol commented Jul 31, 2022

I feel like the memory alloc sanity check code is unnecessary and we should just have a GitHub action that uses -fsanitize or valgrind or whatnot. We shouldn't be reinventing the wheel in HDF5.

This is valuable when debugging on platforms without those tools.

@qkoziol
Copy link
Contributor

qkoziol commented Jul 31, 2022

I feel like the memory alloc sanity check code is unnecessary and we should just have a GitHub action that uses -fsanitize or valgrind or whatnot. We shouldn't be reinventing the wheel in HDF5.

This is valuable when debugging on platforms without those tools.

Which includes some cloud platforms I know about, e.g. AWS Graviton, etc...

@gnuoyd
Copy link
Contributor

gnuoyd commented Aug 1, 2022 via email

@derobins derobins changed the title Pass H5MM calls to stdlib counterparts by default WIP: Pass H5MM calls to stdlib counterparts by default Dec 17, 2022
@derobins derobins self-assigned this Feb 17, 2023
@derobins
Copy link
Member

I'll use my branch and PR for fixing the underlying MacOS type conversion bug

@derobins derobins closed this Feb 17, 2023
@jhendersonHDF jhendersonHDF deleted the H5MM_changes branch September 27, 2023 19:22
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