Skip to content

Commit

Permalink
Warning: group-based iteration encoding in ADIOS2
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Oct 18, 2023
1 parent 1248a43 commit 2abfe1c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,16 @@ ADIOS2IOHandlerImpl::flush(internal::ParsedFlushParams &flushParams)
return res;
}

static constexpr char const *warningADIOS2NoGroupbasedEncoding = &R"(
[Warning] Use of group-based encoding in ADIOS2 is discouraged as it can lead
to drastic performance issues, especially when **not** used in conjunction with
IO steps.
We advise you to pick either file-based encoding or variable-based
iteration encoding for use with ADIOS2.
For more details, refer to
https://openpmd-api.readthedocs.io/en/latest/usage/concepts.html#iteration-and-series)"
[1];

void ADIOS2IOHandlerImpl::createFile(
Writable *writable, Parameter<Operation::CREATE_FILE> const &parameters)
{
Expand All @@ -508,6 +518,14 @@ void ADIOS2IOHandlerImpl::createFile(

if (!writable->written)
{

if (!printedWarningsAlready.noGroupBased &&
parameters.encoding == IterationEncoding::groupBased)
{
std::cerr << warningADIOS2NoGroupbasedEncoding << std::endl;
printedWarningsAlready.noGroupBased = true;
}

std::string name = parameters.name + fileSuffix();

auto res_pair = getPossiblyExisting(name);
Expand Down
1 change: 1 addition & 0 deletions src/Iteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ void Iteration::flushFileBased(
/* create file */
Parameter<Operation::CREATE_FILE> fCreate;
fCreate.name = filename;
fCreate.encoding = s.iterationEncoding();
IOHandler()->enqueue(IOTask(&s.writable(), fCreate));

/* create basePath */
Expand Down
1 change: 1 addition & 0 deletions src/Series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,7 @@ void Series::readOneIterationFileBased(std::string const &filePath)
Parameter<Operation::READ_ATT> aRead;

fOpen.name = filePath;
fOpen.encoding = iterationEncoding();
IOHandler()->enqueue(IOTask(this, fOpen));
IOHandler()->flush(internal::defaultFlushParams);
series.iterations.parent() = getWritable(this);
Expand Down

0 comments on commit 2abfe1c

Please sign in to comment.