diff --git a/source/adios2/engine/bp3/BP3Writer.cpp b/source/adios2/engine/bp3/BP3Writer.cpp index 9b83c0a811..429a225c1b 100644 --- a/source/adios2/engine/bp3/BP3Writer.cpp +++ b/source/adios2/engine/bp3/BP3Writer.cpp @@ -187,17 +187,17 @@ void BP3Writer::InitTransports() if (m_BP3Serializer.m_Aggregator.m_IsConsumer) { if (m_BP3Serializer.m_Parameters.AsyncTasks) - { - m_FileDataManager.OpenFiles(bpSubStreamNames, m_OpenMode, - m_IO.m_TransportsParameters, - m_BP3Serializer.m_Profiler.m_IsActive); - } - else { m_FutureOpenFiles = m_FileDataManager.OpenFilesAsync( bpSubStreamNames, m_OpenMode, m_IO.m_TransportsParameters, m_BP3Serializer.m_Profiler.m_IsActive); } + else + { + m_FileDataManager.OpenFiles(bpSubStreamNames, m_OpenMode, + m_IO.m_TransportsParameters, + m_BP3Serializer.m_Profiler.m_IsActive); + } } } diff --git a/source/adios2/engine/bp4/BP4Writer.cpp b/source/adios2/engine/bp4/BP4Writer.cpp index ab87df387e..14da046584 100644 --- a/source/adios2/engine/bp4/BP4Writer.cpp +++ b/source/adios2/engine/bp4/BP4Writer.cpp @@ -182,11 +182,18 @@ void BP4Writer::InitTransports() if (m_BP4Serializer.m_Aggregator.m_IsConsumer) { - // std::cout << "rank " << m_BP4Serializer.m_RankMPI << ": " << - // bpSubStreamNames[0] << std::endl; - m_FileDataManager.OpenFiles(bpSubStreamNames, m_OpenMode, - m_IO.m_TransportsParameters, - m_BP4Serializer.m_Profiler.m_IsActive); + if (m_BP4Serializer.m_Parameters.AsyncTasks) + { + m_FutureOpenFiles = m_FileDataManager.OpenFilesAsync( + bpSubStreamNames, m_OpenMode, m_IO.m_TransportsParameters, + m_BP4Serializer.m_Profiler.m_IsActive); + } + else + { + m_FileDataManager.OpenFiles(bpSubStreamNames, m_OpenMode, + m_IO.m_TransportsParameters, + m_BP4Serializer.m_Profiler.m_IsActive); + } } if (m_BP4Serializer.m_RankMPI == 0) @@ -281,6 +288,10 @@ void BP4Writer::InitBPBuffer() if (m_BP4Serializer.m_Aggregator.m_IsConsumer) { + if (m_FutureOpenFiles.valid()) + { + m_FutureOpenFiles.get(); + } m_BP4Serializer.m_PreDataFileLength = m_FileDataManager.GetFileSize(0); }