-
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
Updates to DataCollection
#1092
Updates to DataCollection
#1092
Conversation
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 cleaning this up. I think these are good changes.
if (stage_name_ == "base") { | ||
const auto &swarm_container = GetSwarmData(); | ||
swarm_container->Initialize(resolved_packages, GetBlockSharedPointer()); | ||
} |
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.
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 see any issue with this. Swarms are OneCopy
-like and always belong to the base stage so it doesn't really make sense to Add
a new MeshBlockData
to the DataCollection
based on an existing MeshBlockData
. We have thought a bit about the best way to express this through the parthenon interface but don't have any good thoughts at the moment.
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 was the concern here? Sorry I am late to the party...
We currently adopt a model wherein the "base" MeshBlockData register contains our swarm data. We have checks that swarms are only accessed through said register.
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 wanted to know if this was the desired behavior and if there were any side effects of what I did.
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'll test downstream first thing tomorrow.
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.
Did the test happen? @pdmullen
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.
They did, there is an old comment from Patrick below.
…-meshblockdata-initialization
w.r.t. swarms, I tested this downstream and all looks good. I noticed that this PR is targeting |
@pdmullen: yeah, but only because I was using the new test I added there to check that removing the |
@lroberts36 are we waiting for someone to review this? |
@Yurlungur: @pgrete said he would on Thursday, but I think he has been under the weather the last few days. |
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.
LGTM
"Remove Initialize methods and replace them with constructors since they break RAII" is possibly meant for a future PR, isn't it? In that case -> new issue?
std::string GetKey(const std::string &stage_label, std::optional<int> partition_id, | ||
std::optional<int> gmg_level) { | ||
std::string key = stage_label; | ||
if (partition_id) key = key + "_part-" + std::to_string(*partition_id); | ||
if (gmg_level) key = key + "_gmg-" + std::to_string(*gmg_level); |
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.
Should there be a debug_require that only partition_id or gmg_level or neither is passed?
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.
no, the GMG levels are also partitioned. Although to be fair, partitioning has always been broken for multigrid, i.e. it only works when all blocks are included in the partition. This is on my list of things to fix.
if (stage_name_ == "base") { | ||
const auto &swarm_container = GetSwarmData(); | ||
swarm_container->Initialize(resolved_packages, GetBlockSharedPointer()); | ||
} |
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.
Did the test happen? @pdmullen
if (stage == 1) { | ||
for (int i = 0; i < blocks.size(); i++) { | ||
auto &pmb = blocks[i]; | ||
// first make other useful containers | ||
auto &base = pmb->meshblock_data.Get(); | ||
pmb->meshblock_data.Add("dUdt", base); | ||
for (int s = 1; s < integrator->nstages; s++) | ||
pmb->meshblock_data.Add(stage_name[s], base); | ||
} | ||
} |
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.
Should this be removed in the other examples, too, to decrease likelihood of reusing this pattern?
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.
Probably, but let's leave it for a future PR. I think it would be nice to work to clean up the examples in the near future.
@pgrete: I think I was just annoyed when I wrote this comment. It is probably not worth the effort to remove the initialization methods and replace them with constructors. |
PR Summary
This PR makes some changes to
DataCollection
so that callingpmesh->mesh_data.GetOrAdd(some_label, partition)
works whether or notsome_label
has been previously added to theMeshBlockData
container. Additionally, it makes it so thatAdd
will now work correctly forMeshData
(previously it didn't use the correct labeling and containers could be overwritten).Possible other things to do:
Mesh
DataCollection
interface to work with bothMesh
andMeshData
Initialize
methods and replace them with constructors since they break RAIIPR Checklist