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

Small Bugfix: Fix an issue outputting >4GB single variables per rank #1146

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

bprather
Copy link
Collaborator

parthenon_hdf5.cpp allocates a std::vector cache of the largest per-block variable size times the number of blocks. However, both numbers are declared as ints, so when they are multiplied it overflows when outputting a variable of total size >4GB from a single MPI rank.

Oddly, this raises the following tangentially-related error:

terminate called after throwing an instance of 'std::length_error'
  what():  cannot create std::vector larger than max_size()

There are various ways of fixing this, but I chose the easy one.

PR Checklist

  • Code passes cpplint
  • New features are documented.
  • Adds a test for any bugs fixed. Adds tests for new features.
  • Code is formatted
  • Changes are summarized in CHANGELOG.md
  • Change is breaking (API, behavior, ...)
    • Change is additionally added to CHANGELOG.md in the breaking section
    • PR is marked as breaking
    • Short summary API changes at the top of the PR (plus optionally with an automated update/fix script)
  • CI has been triggered on Darwin for performance regression tests.
  • Docs build
  • (@lanl.gov employees) Update copyright on changed files

`parthenon_hdf5.cpp` allocates a vector cache of the largest per-block variable size times the number of blocks.  However, both numbers are declared as `int`s, so when they are multiplied it overflows when outputting a variable of total size >4GB from a single MPI rank.
Copy link
Collaborator

@lroberts36 lroberts36 left a comment

Choose a reason for hiding this comment

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

LGTM

@lroberts36 lroberts36 enabled auto-merge August 1, 2024 01:31
@lroberts36 lroberts36 merged commit d87cde6 into develop Aug 1, 2024
53 checks passed
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.

3 participants