Skip to content

Commit 2caf62c

Browse files
committed
Does this really improve serialization?
1 parent aa2cc99 commit 2caf62c

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

src/IO/ADIOS/ADIOS2File.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ void WriteDataset::call(ADIOS2File &ba, detail::BufferedPut &bp)
109109
std::nullopt,
110110
ba.variables());
111111

112-
engine.Put(var, ptr);
112+
// @todo cache this
113+
auto is_bp5 = ba.m_impl->realEngineType() == "bp5" ||
114+
auxiliary::lowerCase(engine.Type()) == "bp5writer";
115+
auto do_defer =
116+
is_bp5 ? adios2::Mode::Sync : adios2::Mode::Deferred;
117+
engine.Put(var, ptr, do_defer);
113118
}
114119
else if constexpr (std::is_same_v<
115120
ptr_type,
@@ -180,7 +185,11 @@ struct RunUniquePtrPut
180185
bufferedPut.name,
181186
std::nullopt,
182187
ba.variables());
183-
engine.Put(var, ptr);
188+
// @todo cache this
189+
auto is_bp5 = ba.m_impl->realEngineType() == "bp5" ||
190+
auxiliary::lowerCase(engine.Type()) == "bp5writer";
191+
auto do_defer = is_bp5 ? adios2::Mode::Sync : adios2::Mode::Deferred;
192+
engine.Put(var, ptr, do_defer);
184193
}
185194

186195
static constexpr char const *errorMsg = "RunUniquePtrPut";
@@ -1136,9 +1145,15 @@ void ADIOS2File::flush_impl(ADIOS2FlushParams flushParams, bool writeLatePuts)
11361145
m_uniquePtrPuts.clear();
11371146
m_updateSpans.clear();
11381147
break;
1139-
case CleanedFlushTarget::Buffer:
1140-
engine.PerformPuts();
1141-
break;
1148+
case CleanedFlushTarget::Buffer: { // @todo cache this
1149+
auto is_bp5 = m_impl->realEngineType() == "bp5" ||
1150+
auxiliary::lowerCase(engine.Type()) == "bp5writer";
1151+
if (!is_bp5)
1152+
{
1153+
engine.PerformPuts();
1154+
}
1155+
}
1156+
break;
11421157
case CleanedFlushTarget::Step:
11431158
if (streamStatus != StreamStatus::DuringStep)
11441159
{

0 commit comments

Comments
 (0)