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

Fix bug in BP3/BP4 attribute merging process. When a global attribute… #3468

Merged
merged 1 commit into from Feb 6, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/adios2/toolkit/format/bp/bp3/BP3Serializer.cpp
Expand Up @@ -482,13 +482,13 @@ BP3Serializer::AggregateCollectiveMetadataIndices(helper::Comm const &comm,
size_t indexPosition = localPosition;
const ElementIndexHeader header = ReadElementIndexHeader(
serialized, indexPosition, helper::IsLittleEndian());
const size_t bufferSize = static_cast<size_t>(header.Length) + 4;

if (isRankConstant && deserialized.count(header.Name) == 1)
{
return;
localPosition += bufferSize;
continue;
}

const size_t bufferSize = static_cast<size_t>(header.Length) + 4;

std::vector<BP3Base::SerialElementIndex> *deserializedIndexes =
nullptr;
auto search = deserialized.find(header.Name);
Expand Down
8 changes: 5 additions & 3 deletions source/adios2/toolkit/format/bp/bp4/BP4Serializer.cpp
Expand Up @@ -841,13 +841,15 @@ void BP4Serializer::AggregateCollectiveMetadataIndices(helper::Comm const &comm,

lf_GetCharacteristics(serialized, indexPosition, header.DataType,
count, length, timeStep);

size_t attrIndexBufferSize = static_cast<size_t>(header.Length) + 4;

if (indicesInfo[timeStep][header.Name].size() == 1)
{
return;
localPosition += attrIndexBufferSize;
continue;
}

size_t attrIndexBufferSize = static_cast<size_t>(header.Length) + 4;

auto stepSearch = indicesInfo.find(timeStep);
if (stepSearch == indicesInfo.end())
{
Expand Down
Expand Up @@ -55,6 +55,9 @@ TEST_F(BPWriteReadAttributeTestMultirank, ADIOS2BPWriteReadArrayTypes)
{
adios2::IO io = adios.DeclareIO("TestIO");

io.DefineAttribute<std::string>("GlobalAttribute",
"Defined on all ranks");

auto var = io.DefineVariable<int>(varpath);
auto attr = io.DefineAttribute<std::string>(attrpath, desc);
(void)var;
Expand Down