-
Notifications
You must be signed in to change notification settings - Fork 37
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: Bounds in output for Metadata::None variables #1188
Conversation
…dd to hdf5 regression tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find! Output bugs are always tricky to track down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! This breakage is definitely on me.
Looks like tests are failing @AstroBarker ? |
Looks like |
almost certainly. run locally and see what the error is. might need to update the gold files. |
Yeah they pass locally for me only if I update the goldfiles. I added a new output for the |
Run |
Head branch was pushed to by a user without write access
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the comment on filling the content of the new var: Should we also add a proper check that this is working, i.e., read the data of the variable to confirm that the data written is looking what it's supposed to look like?
if (test_metadata_none) { | ||
IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); | ||
IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); | ||
IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); | ||
|
||
// packing in principle unnecessary/convoluted here and just done for demonstration | ||
std::vector<std::string> vars({"metadata_none_var"}); | ||
PackIndexMap imap; | ||
const auto &v = rc->PackVariables(vars, imap); | ||
|
||
const int ivar = imap.get("metadata_none_var").first; | ||
pmb->par_for( | ||
PARTHENON_AUTO_LABEL, 0, 2, kb.s, kb.e, jb.s, jb.e, ib.s, ib.e, | ||
KOKKOS_LAMBDA(const int n, const int k, const int j, const int i) { | ||
v(ivar, n, k, j, i) = n + k * j * i; | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what/why this is happening here.
If I read the the field correctly, then it's a vector with 3 components and extents larger than the mesh size by one.
In this par_for
the block indices are used (without any global offset), so every block will have the same indices set to the same values and a large fraction of the index space will remain 0.
Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I didn't pay much mind to the contents of the fields, only that its shape reproduced the crash. This should be fixed to be filled now, I think.
v(ivar_lo, n, k, j, i) = n + k * j * i; | ||
v(ivar_lo + 1, n, k, j, i) = 1 + n + k * j * i; | ||
v(ivar_hi, n, k, j, i) = 2 + n + k * j * i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just looked at the updated loop.
While I understand the fix going from mesh to meshbock, I now don't get the ivar_lo
/ivar_hi
indexing.
What's supposed to happen here? I could see this working if ivar_lo
/ivar_hi replace the
n` index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any comment on this? ping @AstroBarker
I'm happy to merge this without adding test to read the data (which would be great), but I'd like to understand this loop before merging as from my current understanding it might seem like being an unintended bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the loop, removing the ivar_lo/hi
stuff, which I agree was not necessary in the loop, and added a section to the hdf5 test that checks the contents of this variable. Sorry for the delay!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
Formatter does not work on forks. I'm force merging. |
I don't see the force merge button any more? Am I missing sth? |
I already clicked auto merge. It seems like not all the "long" tests triggered. I will try to disable/re-enable. |
Yes, that's what I did earlier today and all tests passed (except for the formatting one that, as we know, does not report results for PRs from forks). |
If you want to force merge, disable auto-merge. Then there should be an option. |
That is basically my question. I don't see the button any more. |
Shoot you're right. I don't see it either. Maybe we submit a new MR on a branch and see if that goes through? Should figure out how to make fork merges work though... |
Aah I see. Ok sounds good. |
In updating
phoebus
to use up-to-dateparthenon
I ran into an issue where aMetadata::None
variable was failing to output due to view bounds accesses. There seems to have been an off-by-one error in the relevant code block inoutput_utils.hpp:313
. I've updated the bounds there to correctly outputMetadata::None
variables.To test this, I modified the advection example to have an optional
Metadata::None
variable (enabled in the input deck<Advection>/test_metadata_none
). I set the output_hdf5 test to use this variable.PR Checklist