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

Recast partition_mesh in terms of generic part identifiers #308

Merged
merged 37 commits into from
Jun 30, 2022

Conversation

majosm
Copy link
Collaborator

@majosm majosm commented Mar 16, 2022

Should remove the need for a custom partition boundary tag in grudge.

Targets #307.

@majosm
Copy link
Collaborator Author

majosm commented Mar 16, 2022

@inducer Is there a way I can get the CI to run on this? (Not sure why it isn't; maybe because the target branch isn't main?)

@inducer
Copy link
Owner

inducer commented Mar 16, 2022

Looks like it was just taking a while...?

@matthiasdiener
Copy link
Collaborator

@inducer Is there a way I can get the CI to run on this? (Not sure why it isn't; maybe because the target branch isn't main?)

Github is having some issues today: https://www.githubstatus.com/

@majosm majosm marked this pull request as ready for review March 16, 2022 21:02
@majosm
Copy link
Collaborator Author

majosm commented Mar 16, 2022

I think this is ready for a look, apart from the doc failures (which I'm not sure how to fix).

@alexfikl
Copy link
Collaborator

I think this is ready for a look, apart from the doc failures (which I'm not sure how to fix).

You need to add mpi4py to intersphinx in docs/conf.py for that to work. Probably something like

"https://mpi4py.readthedocs.io/en/stable": None

@majosm majosm requested a review from inducer March 16, 2022 22:14
Copy link
Collaborator

@alexfikl alexfikl left a comment

Choose a reason for hiding this comment

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

I'm not familiar with the MPI parts of meshmode, but was looking a bit through this and left some nitpicks!

meshmode/distributed.py Outdated Show resolved Hide resolved
meshmode/distributed.py Outdated Show resolved Hide resolved
meshmode/distributed.py Outdated Show resolved Hide resolved
meshmode/mesh/processing.py Outdated Show resolved Hide resolved
meshmode/mesh/processing.py Outdated Show resolved Hide resolved
meshmode/mesh/processing.py Outdated Show resolved Hide resolved
meshmode/mesh/processing.py Outdated Show resolved Hide resolved
meshmode/distributed.py Outdated Show resolved Hide resolved
@inducer
Copy link
Owner

inducer commented Mar 17, 2022

Sorry about the conflicts! Turns out I had some uncommitted work lying around that was needed to get inducer/grudge#236 to go.

@inducer inducer force-pushed the generic-part-bdry branch 2 times, most recently from 16581c5 to 0ade9cc Compare March 17, 2022 05:45
@inducer
Copy link
Owner

inducer commented Mar 17, 2022

One question I have about this is to what extent this is at odds with the current approach in inducer/grudge#236, specifically when you say

Should remove the need for a custom partition boundary tag in grudge.

I feel like this is headed for BTAG_PARTITION(BTAG_MULTIVOL_PARTITION(...)), which seems not that convenient, even if the inner thing were renamed. Can you explain a bit what your thought would be on how this would look in grudge?

@majosm
Copy link
Collaborator Author

majosm commented Mar 17, 2022

I feel like this is headed for BTAG_PARTITION(BTAG_MULTIVOL_PARTITION(...)), which seems not that convenient, even if the inner thing were renamed. Can you explain a bit what your thought would be on how this would look in grudge?

I was picturing that part_id in the multivolume case would just be a tuple (vol, rank). Then BTAG_MULTIVOL_PARTITION(...) would be replaced by BTAG_PARTITION((vol, rank)). Is that not going to work? I haven't looked through the grudge PR closely yet.

@inducer
Copy link
Owner

inducer commented Mar 17, 2022

I was picturing that part_id in the multivolume case would just be a tuple (vol, rank).

The issue I see is that, on many occasions, grudge (at least as currently done in inducer/grudge#236, though I don't see how to avoid it) needs to pick apart the boundary tag to understand its components (to see which ranks/volumes are being connected), so making the parition IDs entirely opaque won't do.

@majosm
Copy link
Collaborator Author

majosm commented Mar 17, 2022

The issue I see is that, on many occasions, grudge (at least as currently done in inducer/grudge#236, though I don't see how to avoid it) needs to pick apart the boundary tag to understand its components (to see which ranks/volumes are being connected), so making the parition IDs entirely opaque won't do.

Right, that sounds fine to me. The idea here was to make it opaque to meshmode (and thus avoid the need to postprocess the partitioned mesh in order to relabel the tags). The grudge code can still use the partition identifier data however it wants.

@inducer
Copy link
Owner

inducer commented Mar 17, 2022

stamp out remaining traces of fun

That's no fun! :P

@inducer
Copy link
Owner

inducer commented Mar 17, 2022

and thus avoid the need to postprocess the partitioned mesh in order to relabel the tags

That's sort of my question though. Unless we make grudge live with BTAG_PARTITION(something), there's still a relabeling needed.

@majosm
Copy link
Collaborator Author

majosm commented Mar 17, 2022

Unless we make grudge live with BTAG_PARTITION(something),

That's kind of what I was thinking. I assume we will need a function in grudge that does the mesh partitioning anyway (using partition_mesh and mpi_distribute under the hood), so I figure at that time it can insert whatever data it needs into the partition ID and pull it out as needed later. All the uses of <instance of BTAG_MULTIVOL_PARTITION>.<whatever> would become <instance of BTAG_PARTITION>.part_id.<whatever>.

@inducer
Copy link
Owner

inducer commented Mar 17, 2022

Hmm. That's what I figured. The one fly in that ointment is that, currently, BTAG_MULTIVOL_PARTITION doesn't just identify the remote partition (as would be the case with your proposed approach), but also the local one (it has self_volume_tag). Representation-wise, that is sort of redundant, so I sort of see your point. Let me see how hard it is to get rid of self_volume_tag in inducer/grudge#236.

@majosm
Copy link
Collaborator Author

majosm commented Mar 17, 2022

Hmm. That's what I figured. The one fly in that ointment is that, currently, BTAG_MULTIVOL_PARTITION doesn't just identify the remote partition (as would be the case with your proposed approach), but also the local one (it has self_volume_tag). Representation-wise, that is sort of redundant, so I sort of see your point. Let me see how hard it is to get rid of self_volume_tag in inducer/grudge#236.

Would it possibly help if the facial adjacency groups had volumes associated with them? We'll need to read in the volume tags in read_gmsh, and at least the original plan was to store them inside the mesh (something like #292). We could potentially split the facial adjacency by volume tag the same way we do with boundary tags.

@inducer
Copy link
Owner

inducer commented Mar 17, 2022

Would it possibly help if the facial adjacency groups had volumes associated with them? We'll need to read in the volume tags in read_gmsh, and at least the original plan was to store them inside the mesh (something like #292). We could potentially split the facial adjacency by volume tag the same way we do with boundary tags.

That might be convenient for easier partitioning, but for the above problem, that's neither here nor there IMO. That's because by the time we get to grudge, each different volume is a separate Discretization, and therefore a separate Mesh.

@inducer
Copy link
Owner

inducer commented Mar 17, 2022

Let me see how hard it is to get rid of self_volume_tag in inducer/grudge#236.

The initial sense I'm getting is that this is a good direction. I should have that pushed in a bit.

@inducer
Copy link
Owner

inducer commented Mar 17, 2022

Urgh. So, in order to support the changes in inducer/grudge#236 that we discussed (which I still like), I ended up making some changes to #307 that I think duplicate some of what you did here. IOW, I made another mess of conflicts. Sorry!

@majosm majosm force-pushed the generic-part-bdry branch 3 times, most recently from 2d78953 to 772a3d4 Compare June 28, 2022 00:08
@majosm majosm mentioned this pull request Jun 28, 2022
@inducer
Copy link
Owner

inducer commented Jun 29, 2022

Ready to look at? Or would you like me to wait? (I ask because it's not draft, but there also isn't an explicit review request.)

@inducer inducer closed this Jun 29, 2022
@inducer inducer reopened this Jun 29, 2022
@inducer
Copy link
Owner

inducer commented Jun 29, 2022

Grrr, again. Sorry. :)

@majosm
Copy link
Collaborator Author

majosm commented Jun 29, 2022

If the CI passes, this should be ready for review now.

Couple of notes:

@majosm majosm requested a review from inducer June 29, 2022 18:16
@inducer inducer changed the title Recast partition_mesh in terms of generic partition identifiers Recast partition_mesh in terms of generic part identifiers Jun 29, 2022
Copy link
Owner

@inducer inducer left a comment

Choose a reason for hiding this comment

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

Thanks! Just a few minor things, then this is good to go. (Feel free to squash+merge when done.)

meshmode/mesh/processing.py Outdated Show resolved Hide resolved
meshmode/mesh/processing.py Outdated Show resolved Hide resolved
meshmode/mesh/processing.py Outdated Show resolved Hide resolved
meshmode/mesh/processing.py Outdated Show resolved Hide resolved
@majosm majosm merged commit 4f7bc42 into inducer:generic-part-bdry Jun 30, 2022
inducer added a commit that referenced this pull request Jul 1, 2022
* simplify partition_mesh interface

* add get_connected_partitions back to docs

* use opaque partition ID instead of number in partition_mesh

* use self/other instead of local/nonlocal

* fix compatibility

* remove unnecessary import

Co-authored-by: Alex Fikl <[email protected]>

* eliminate fun

Co-authored-by: Alex Fikl <[email protected]>

* stamp out remaining traces of fun

* rename membership_list_to_sets -> membership_list_to_map and store index sets as numpy arrays instead of python sets

* remove return_sets option from get_partition_by_pymetis

* fix bugs in MPIBoundaryCommSetupHelper

* flake8

* fix bug

* add a couple of fixmes

* handle groupless mesh case in dim/ambient_dim

* Revert "handle groupless mesh case in dim/ambient_dim"

not a good solution

* disable removal of empty mesh groups in partitioning

* fix some issues with partitioning docs

* remove empty-group filtering

* clarify part vs. partition terminology

* change some asserts to exceptions

* add a couple of FIXMEs

* cosmetic change

Co-authored-by: Andreas Klöckner <[email protected]>

* detect elements that belong to multiple parts

* add return_parts argument to partition_mesh

* add type hints to mesh partitioning

* Fix some annotations in mesh.processing

* add explicit part_id attribute to InterPartAdjacencyGroup

* cosmetic change

* fix some type annotations

* Dict -> Mapping

* fix outdated argument reference in docstring

* try using just dtype

dtype[Any] requires python 3.9

Co-authored-by: Alex Fikl <[email protected]>
Co-authored-by: Andreas Klöckner <[email protected]>
inducer added a commit that referenced this pull request Jul 1, 2022
* simplify partition_mesh interface

* add get_connected_partitions back to docs

* use opaque partition ID instead of number in partition_mesh

* use self/other instead of local/nonlocal

* fix compatibility

* remove unnecessary import

Co-authored-by: Alex Fikl <[email protected]>

* eliminate fun

Co-authored-by: Alex Fikl <[email protected]>

* stamp out remaining traces of fun

* rename membership_list_to_sets -> membership_list_to_map and store index sets as numpy arrays instead of python sets

* remove return_sets option from get_partition_by_pymetis

* fix bugs in MPIBoundaryCommSetupHelper

* flake8

* fix bug

* add a couple of fixmes

* handle groupless mesh case in dim/ambient_dim

* Revert "handle groupless mesh case in dim/ambient_dim"

not a good solution

* disable removal of empty mesh groups in partitioning

* fix some issues with partitioning docs

* remove empty-group filtering

* clarify part vs. partition terminology

* change some asserts to exceptions

* add a couple of FIXMEs

* cosmetic change

Co-authored-by: Andreas Klöckner <[email protected]>

* detect elements that belong to multiple parts

* add return_parts argument to partition_mesh

* add type hints to mesh partitioning

* Fix some annotations in mesh.processing

* add explicit part_id attribute to InterPartAdjacencyGroup

* cosmetic change

* fix some type annotations

* Dict -> Mapping

* fix outdated argument reference in docstring

* try using just dtype

dtype[Any] requires python 3.9

Co-authored-by: Alex Fikl <[email protected]>
Co-authored-by: Andreas Klöckner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants