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 Aug 10, 2023
1 parent 15feda4 commit 97d2d7d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ ADIOS2IOHandlerImpl::ADIOS2IOHandlerImpl(
init(std::move(cfg));
}

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];

ADIOS2IOHandlerImpl::~ADIOS2IOHandlerImpl()
{
/*
Expand Down Expand Up @@ -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 Expand Up @@ -779,6 +797,13 @@ void ADIOS2IOHandlerImpl::openFile(
"Supplied directory is not valid: " + m_handler->directory);
}

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

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

auto file = std::get<PE_InvalidatableFile>(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 97d2d7d

Please sign in to comment.