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

Encapsulate HDF5 module #5031

Merged
merged 4 commits into from
Jan 24, 2025
Merged

Encapsulate HDF5 module #5031

merged 4 commits into from
Jan 24, 2025

Conversation

jngrad
Copy link
Member

@jngrad jngrad commented Jan 23, 2025

Description of changes:

  • bump version requirements of h5xx
  • source h5xx via FetchContent instead of submodules
    • the ESPResSo repository can now be cloned without --recursive
    • the creation of GitHub releases no longer depends on third-party tools and can be fully automated
  • hide hdf5 and h5xx header files and compiler flags from consumer targets
  • fix portability issues revealed by newer compiler toolchains

Drop support for Intel Classic. Provide a clear error message when an
unsupported compiler is detected. Also update C++ code to leverage
C++20 and address build issues with Clang compiler toolchains.
Rewrite h5xx and hdf5 bindings such that they no longer propagate
their compiler flags to the entire codebase.
@jngrad jngrad marked this pull request as ready for review January 23, 2025 21:18
@jngrad jngrad requested review from hidekb and reinaual January 23, 2025 21:18
@jngrad jngrad added the DevOps label Jan 23, 2025
if (!mass_unit().empty() and (m_fields & H5MD_OUT_MASS)) {
h5xx::write_attribute(datasets["particles/atoms/mass/value"], "unit",
h5xx::write_attribute(datasets.at("particles/atoms/mass/value"), "unit",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a benefit to making it a bound-checked access?

Copy link
Member Author

Choose a reason for hiding this comment

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

Muscle memory. I didn't think too much about it.

Marginal benefit: if the key doesn't exist, a default-constructed hdf5 dataset is created and returned by reference by operator[]. Your file then contains a dataset with no elements. Since this method is called only once per simulation, at file creation, overhead of exceptions isn't relevant, and is probably smaller than default-constructing an empty dataset. Plus, we get notified that the map isn't properly initialized.

Whether we need bound-checked accesses in the hot loop (File::write()) is debatable. The h5xx module will be removed from ESPResSo eventually, in favor of a yet-to-be-determined C++ wrapper library for hdf5. Whether that new library will offer bound-checked access is likely, but not guaranteed.

Copy link
Contributor

@hidekb hidekb left a comment

Choose a reason for hiding this comment

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

LGTM!

@jngrad jngrad added this to the ESPResSo 4.3.0 milestone Jan 24, 2025
@jngrad jngrad added the automerge Merge with kodiak label Jan 24, 2025
@kodiakhq kodiakhq bot merged commit e0be7c7 into espressomd:python Jan 24, 2025
10 checks passed
@jngrad jngrad deleted the submodules branch January 24, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants