Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn on BP5+Blosc in ADIOS2 v2.9 up to patch level 1 #1497

Merged
merged 3 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,12 @@ class ADIOS2IOHandlerImpl
Extent const &extent,
adios2::IO &IO,
std::string const &var);

struct
{
bool noGroupBased = false;
bool blosc2bp5 = false;
} printedWarningsAlready;
}; // ADIOS2IOHandlerImpl

/*
Expand Down
36 changes: 36 additions & 0 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,42 @@ void ADIOS2IOHandlerImpl::createDataset(
parameters.extent.begin(), parameters.extent.end());

auto &fileData = getFileData(file, IfFileNotOpen::ThrowError);

#define HAS_BP5_BLOSC2_BUG \
(ADIOS2_VERSION_MAJOR * 100 + ADIOS2_VERSION_MINOR == 209 && \
ADIOS2_VERSION_PATCH <= 1)
#if HAS_BP5_BLOSC2_BUG
std::string engineType = fileData.getEngine().Type();
std::transform(
engineType.begin(),
engineType.end(),
engineType.begin(),
[](unsigned char c) { return std::tolower(c); });
if (!printedWarningsAlready.blosc2bp5 && engineType == "bp5writer")
{
for (auto const &op : operators)
{
std::string operatorType = op.op.Type();
std::transform(
operatorType.begin(),
operatorType.end(),
operatorType.begin(),
[](unsigned char c) { return std::tolower(c); });
if (operatorType == "blosc")
{
std::cerr << &R"(
[Warning] Use BP5+Blosc with care in ADIOS2 v2.9.0 and v2.9.1.
Unreadable data might be created, to mitigate either deactivate Blosc or use BP4+Blosc.
For further details see
https://github.com/ornladios/ADIOS2/issues/3504.
)"[1] << std::endl;
printedWarningsAlready.blosc2bp5 = true;
}
}
}
#endif
#undef HAS_BP5_BLOSC2_BUG

switchAdios2VariableType<detail::VariableDefiner>(
parameters.dtype, fileData.m_IO, varName, operators, shape);
fileData.invalidateVariablesMap();
Expand Down
16 changes: 15 additions & 1 deletion test/SerialIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,24 @@ std::vector<std::string> testedFileExtensions()
{
auto allExtensions = getFileExtensions();
auto newEnd = std::remove_if(
allExtensions.begin(), allExtensions.end(), [](std::string const &ext) {
allExtensions.begin(),
allExtensions.end(),
[]([[maybe_unused]] std::string const &ext) {
#if openPMD_HAVE_ADIOS2
#define HAS_ADIOS_2_9 (ADIOS2_VERSION_MAJOR * 100 + ADIOS2_VERSION_MINOR >= 209)
#if HAS_ADIOS_2_9
// sst and ssc need a receiver for testing
// bp5 is already tested via bp
return ext == "sst" || ext == "ssc" || ext == "bp5";
ax3l marked this conversation as resolved.
Show resolved Hide resolved
#else
// sst and ssc need a receiver for testing
// bp4 is already tested via bp
return ext == "sst" || ext == "ssc" || ext == "bp4";
#endif
#undef HAS_ADIOS_2_9
#else
return false;
#endif
});
return {allExtensions.begin(), newEnd};
}
Expand Down