-
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
[breaking] output more topological elements #1019
Conversation
So many feature PRs with net negative lines! Approach looks great, can test/debug later this week. This is a super important piece of putting KHARMA back on Parthenon develop. I'll have another interesting little piece to push upstream in the next week too, and then I can stop frankenbranching! Exciting. |
I'm not done yet. This is currently just cleanup. But the feature will be in soon. Hopefully before you look. :) |
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.
Just had quick look at the PR following our discussion on Thursday and it looks like a nice cleanup (though I didn't review the code in great detail yet).
Note, that I'm about to make the RestartReader
a base class so that I can derive for hdf5 and OpenPMD.
Do you expect to touch the restart parts (beyond the removed legacy code)?
I will need to touch the utility functions called by the restart reader, such as the pack/unpack variables. I will also need to change |
Right, but this is all going to be "internal" to restarting from hdf5, correct? |
Ah I see... I'm not sure. I was thinking of trying to loop the |
Alright, as far as I can tell right now my refactor won't be that intrusive, so I'll just go ahead and then we can mix/match later (especially as I'll probably use more from the change you implement here than the other way around). |
Co-authored-by: Adam M. Dempsey <[email protected]>
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.
Quite a rabbit hole, which came out nicely clean wrt to the changes to the hdf5 piece alone.
I'm done with the code review (with a couple of minor comments), and will approve tomorrow once I confirmed things are working (particularly restarting version 3 outputs) in AthenaPK.
@@ -212,7 +217,7 @@ class ParticleVariable { | |||
|
|||
KOKKOS_FORCEINLINE_FUNCTION | |||
auto GetDim(const int i) const { | |||
PARTHENON_DEBUG_REQUIRE(0 < i && i <= 6, "ParArrayNDGenerics are max 6D"); | |||
PARTHENON_DEBUG_REQUIRE(0 < i && i <= 6, "Index out of bounds"); |
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.
But it's also std::array<int, MAX_VARIABLE_DIMENSION> dims_;
below, isn't it?
print("value error!", len(components), ntensors, q.shape) | ||
raise ValueError( | ||
"Tensor rank not the same as number of specified components" |
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 reason for the separate preceding print statement rather than putting everything in the raised error message?
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.
The exceptions raised within a thread (since the code is thread-parallel) were not being propagated, so the script was just failing silently. This was my hacky way of dealing with it.
I just went back in and fixed it properly, by forcing python to raise exceptions.
scripts/python/packages/parthenon_tools/parthenon_tools/movie2d.py
Outdated
Show resolved
Hide resolved
for c in components: | ||
if c > (q.shape[1] - 1): |
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.
What's exactly happening here (in combination with the q = q[:, c]
below.
The for c in ...
make me believe there's more than one component, but then it's checked against a fixed index in q.
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.
the intent here is that q
always has the shape [blocks, some number of tensor components, k, j, i]
so q[1]
is always the index of the slowest-moving tensor component. Then q = q[:,c]
sets the slowest moving tensor-component to c
but leaves the block index free floating. If you iterate with this, q keeps changing shape, so you can walk throw all tensor components, slowest first. I added a comment in the code to explain.
If variable is a vector, each element of the returned numpy | ||
array is a vector of that length. |
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 having trouble parsing that statement. Does "length" here refer to the flattened length, i.e. you get a 2D numpy array back with [c,TotalCells]
with c
being the vector.
In that case, how about moving this statement after the first sentence of the following paragraph as (so that there's an explanation for "length".
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 don't think I wrote this line. I just moved it/reformated it. I also don't understand what it means. I've deleted it and modified the passage below it to explain.
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 updates.
I also just verified that things work in AthenaPK.
Ready to merge!
PR Summary
What it says on the can
PR Checklist