Skip to content

Fix restart where you lose a level and NReaders > NProcs()#5074

Open
atmyers wants to merge 3 commits intoAMReX-Codes:developmentfrom
atmyers:particle_nreaders
Open

Fix restart where you lose a level and NReaders > NProcs()#5074
atmyers wants to merge 3 commits intoAMReX-Codes:developmentfrom
atmyers:particle_nreaders

Conversation

@atmyers
Copy link
Member

@atmyers atmyers commented Feb 25, 2026

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

@WeiqunZhang
Copy link
Member

Do we need to fix Extern/HDF5/AMReX_ParticleHDF5.H as well?

$ git grep -n ">=\s*NReaders"
Extern/HDF5/AMReX_ParticleHDF5.H:1324:            if (rank >= NReaders) { return; }
Particle/AMReX_ParticleIO.H:855:            if (rank >= NReaders) { return; }

atmyers added a commit that referenced this pull request Mar 3, 2026
This fixes Issue #5056. Note, the test included here also would have
caught the NReaders bug fixed in #5074.

The proposed changes:
- [x] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX
users
- [ ] include documentation in the code and/or rst files, if appropriate
const int rank = ParallelDescriptor::MyProc();
const int NReaders = MaxReaders();
if (rank >= NReaders) { return; }
if (rank >= NReaders) { continue; }
Copy link
Member

Choose a reason for hiding this comment

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

There are memory leaks here. Before continue, we need to call H5*close just like how it's done at the end of the loop.

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