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

Feature transfer_search #297

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from

Conversation

ljcarlin
Copy link
Contributor

@ljcarlin ljcarlin commented Mar 22, 2024

This is an abstracted version of the algorithm I wrote for the GMT example.

p4est_transfer_search is a collective, point-to-point transfer for maintaining a distributed collection of points. After communication, points are stored (only) on the processes whose domains they intersect.

Points can be instances of an arbitrary struct. Point-quadrant intersection is specified by a user supplied callback. A single point may intersect multiple process domains, and after communication will be known to each of these processes.

Each process is responsible for propagating a subset of the points it knows. Before communication, exactly one process should be responsible for propagating each point. The intersecting processes for each point are determined - by the responsible process - with p4est_search_partition. Points are then communicated to the relevant processes. Points known to a process before communication that do not intersect its domain are forgotten. The algorithm ensures that after communication exactly one process is responsible for the propagation of each point. This is the process with the lowest rank among processes intersecting the point.

I have rewritten my portion of the GMT example to use this abstracted version. This rewrite breaks the other parts of the example, due to typing changes, such as the intersection callback having a different type. The rewrite can be found here: https://github.com/ljcarlin/p4est/tree/feature-gmt

@cburstedde cburstedde marked this pull request as ready for review March 25, 2024 15:00
@ljcarlin
Copy link
Contributor Author

@cburstedde I added more documentation and a \file so that p4est_communication.h is parsed by doxygen. If it was intentional not to have that then I can remove it again.

I also noticed that doxygen mistakes \ref p4est_transfer_search as referring to the structure p4est_transfer_search behind the type p4est_transfer_search_t rather than the function p4est_transfer_search. Basically when you typedef and define a struct at the same time then doxygen interprets the comment as referring to the struct rather than the type. I think this happens elsewhere in p4est too.

@cburstedde
Copy link
Owner

cburstedde commented Apr 1, 2024 via email

@ljcarlin
Copy link
Contributor Author

ljcarlin commented Apr 7, 2024

This is unfortunate; thanks for figuring this out. So would we want to rename every struct behind a typedef by adding _s? That would affect quite a bit of the code.

Yes, it seems quite unfortunate.

Another approach is to declare the struct first (without documentation) and then document the _t typedef. I think this makes the code a bit less readable though, and it requires just as much code change.

@cburstedde
Copy link
Owner

@cburstedde I added more documentation and a \file so that p4est_communication.h is parsed by doxygen. If it was intentional not to have that then I can remove it again.

This is very helpful; thanks! We're behind on some documentation.

I also noticed that doxygen mistakes \ref p4est_transfer_search as referring to the structure p4est_transfer_search behind the type p4est_transfer_search_t rather than the function p4est_transfer_search. Basically when you typedef and define a struct at the same time then doxygen interprets the comment as referring to the struct rather than the type. I think this happens elsewhere in p4est too.

Outside of this PR, which other struct names may be in need of a _s suffix?

@cburstedde
Copy link
Owner

I'm now thinking about the unowned points. By definition they are part of the propagated portion of the points array (?). Should we indicate which of the propagated are unowned? We may put these into a contiguous range right in the beginning and add a num_unowned member?

@ljcarlin
Copy link
Contributor Author

Outside of this PR, which other struct names may be in need of a _s suffix?

I noticed you fixed this just by changing the name of the struct. This is probably a better solution. I don't think the issue actually appears very frequently, I had a quick look and couldn't see it anywhere else.

@ljcarlin
Copy link
Contributor Author

I'm now thinking about the unowned points. By definition they are part of the propagated portion of the points array (?). Should we indicate which of the propagated are unowned? We may put these into a contiguous range right in the beginning and add a num_unowned member?

Sure, that sounds reasonable. As is, a search based refinement would be refining with the irrelevant unowned points, which is a bit silly.

@cburstedde
Copy link
Owner

cburstedde commented Jul 14, 2024 via email

@cburstedde
Copy link
Owner

cburstedde commented Jul 14, 2024 via email

@cburstedde
Copy link
Owner

What we might also do is adding a third variable to the context, num_total. This is redundant but maybe a nice feature for consistency.

@cburstedde
Copy link
Owner

Ok, let's not to the dummy p4est since your code aligns perfectly with the search_gf* routines.

Just remaining to look into the errsend question and indenting the .c file (I've done it for the .h).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants