-
Notifications
You must be signed in to change notification settings - Fork 438
AllGatherBoxes broadcasts Long count_tot with MPI_INT #5063
Copy link
Copy link
Closed
Description
- Type: Correctness / MPI data-type mismatch
- Severity: High
- Component: Box communication helper
- Location:
Src/Base/AMReX_Box.cpp:166Src/Base/AMReX_Box.cpp:176
Problem
AllGatherBoxes computes the total number of boxes in Long count_tot, then broadcasts it via
MPI_Bcast(&count_tot, 1, MPI_INT, root, comm);On LP64 platforms (Long = 64-bit), this is a type-size mismatch (MPI_INT = 32-bit).
Impact
- Non-root ranks receive only the low 32 bits of
count_tot. - High bits are lost/undefined, which can lead to incorrect buffer sizing and undefined behavior for large totals.
- The subsequent overflow guard runs on corrupted data on non-root ranks.
Suggested patch
Use the AMReX MPI typemap for Long (or MPI_LONG if guaranteed compatible).
--- a/Src/Base/AMReX_Box.cpp
+++ b/Src/Base/AMReX_Box.cpp
@@
- MPI_Bcast(&count_tot, 1, MPI_INT, root, comm);
+ MPI_Bcast(&count_tot, 1,
+ ParallelDescriptor::Mpi_typemap<Long>::type(),
+ root, comm);Prepared by Codex
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels