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

setshape() should not touch the joined dim #1656

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
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
22 changes: 18 additions & 4 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,13 @@ namespace detail
variable + "'.");
}
adios2::Dims dims;
dims.reserve(newShape.size());
for (auto ext : newShape)
dims.assign(newShape.begin(), newShape.end());
// keep the joined dim intact
auto joined_dim = joinedDimension(var.Shape());
if (joined_dim.has_value())
{
dims.push_back(ext);
auto idx = joined_dim.value();
dims[idx] = var.Shape()[idx];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undefined behavior if the vector lengths are not the same

}
var.SetShape(dims);
}
Expand Down Expand Up @@ -2032,7 +2035,18 @@ namespace detail
}
else
{
var.SetShape(shape);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that the previous shape should be considered here at all.
This code is executed when the Variable was already part of the previous step. The Variable shape can be something completely new in the new step. If the user means to use a joined dimension again, Dataset::JOINED_DIMENSION should be specified again; we should not try to outsmart the user by trying to keep the joined dimension from the previous step.

// keep the joined dim intact
auto joined_dim = joinedDimension(var.Shape());
if (joined_dim.has_value())
{
adios2::Dims cc;
cc.assign(shape.begin(), shape.end());
cc[joined_dim.value()] = var.Shape()[joined_dim.value()];
var.SetShape(cc);
}
else
var.SetShape(shape);

if (count.size() > 0)
{
var.SetSelection({start, count});
Expand Down
Loading