Skip to content

Prevent communication on SFs with no leaves - #5748

Open
achanbour wants to merge 1 commit into
mainfrom
achanbour/prevent-communication-sfs-no-leaves
Open

achanbour wants to merge 1 commit into
mainfrom
achanbour/prevent-communication-sfs-no-leaves

Conversation

@achanbour

Copy link
Copy Markdown
Contributor

Based on #5745

I would like to avoid data being exchanged over SFs which have no leaves on any rank (has_leaves=False) such as in the case of VoMs. As described in the related PR, this leads to spawning unnecessary SFs and doing collective operations on them which are wasteful and incur overhead.

Until #5747 is implemented, I suggest we explicitly prevent bcast/reduce from happening on these SFs.

Comment thread pyop3/sf.py
def __init__(self, sf: PETSc.SF, comm: MPI.Comm, has_leaves: bool | None = None) -> None:
object.__setattr__(self, "sf", sf)
object.__setattr__(self, "_comm", comm)
self._has_leaves = has_leaves

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that this attribute is part of the wider refactor I was suggesting. I think the decorator you've added makes sense as a standalone change, but if we are modifying the API like this I would really like to tackle the full refactor we discussed. Basically, I am not certain that this is the right design, and we won't know if it is or not unless we do the full refactor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK. We can dedicate this PR to the refactor then.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool. I think the first thing is probably we want to rename this to something which doesn't make sense to have True, False and None as reasonable answers. Honestly I think it makes the most sense to make the PETSc SF be None if we only have a serial thing, but then we still need to give it a comm... tricky

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What about other properties that depend on the PETSc SF? self.graph and all dependent properties self.ilocal etc. wouldn't work if the PETSc SF is None... these would need special casing at the least.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah there are definitely differences.

Maybe another option is just to rename NullStarForest to LocalStarForest.

@achanbour

Copy link
Copy Markdown
Contributor Author

WIP: refactor SF/NullSF

This branch has not been deployed

No deployments
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.

2 participants