Skip to content

Commit 882e19b

Browse files
authored
MergeBuffersForPlotfile: Barrier (#2608)
Make sure that all MPI ranks are in sync, i.e., have closed the files that they wrote, before trying to merge them.
1 parent b694e40 commit 882e19b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Source/Diagnostics/BTDiagnostics.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,12 @@ void BTDiagnostics::TMP_ClearSpeciesDataForBTD ()
662662

663663
void BTDiagnostics::MergeBuffersForPlotfile (int i_snapshot)
664664
{
665+
// Make sure all MPI ranks wrote their files and closed it
666+
// Note: additionally, since a Barrier does not guarantee a FS sync
667+
// on a parallel FS, we might need to add timeouts and retries
668+
// to the open calls below when running at scale.
669+
amrex::ParallelDescriptor::Barrier();
670+
665671
auto & warpx = WarpX::GetInstance();
666672
const amrex::Vector<int> iteration = warpx.getistep();
667673
if (amrex::ParallelContext::IOProcessorSub()) {

0 commit comments

Comments
 (0)