Skip to content

Commit

Permalink
HDF5: Correctly determine max_mfi_count (AMReX-Codes#4024)
Browse files Browse the repository at this point in the history
## Summary
Fixes a bug so that all processes correctly evaluate the maximum number
of mfi's across all processes, rather than just the preceding ones. This
resulted in lower-number ranks sometimes finishing the write early and
not correctly doing enough dummy writes to write collectively, causing a
crash.

Sorry, I just figured this out this afternoon, after previous pull was
merged.

## Checklist

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
arnav-singhal authored Jul 8, 2024
1 parent 1da9115 commit 8d9ff9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Src/Extern/HDF5/AMReX_ParticleHDF5.H
Original file line number Diff line number Diff line change
@@ -842,7 +842,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
my_real_count = 0;

int max_mfi_count = 0, write_count = 0;
for (int i = 0; i < ParallelDescriptor::MyProc(); i++) {
for (int i = 0; i < ParallelDescriptor::NProcs(); i++) {
if (max_mfi_count < all_mfi_cnt[i]) {
max_mfi_count = all_mfi_cnt[i];
}

0 comments on commit 8d9ff9a

Please sign in to comment.