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

Worlds and Universes: MPI_FINALIZE #142

Open
cavemanloverboy opened this issue Dec 5, 2022 · 5 comments
Open

Worlds and Universes: MPI_FINALIZE #142

cavemanloverboy opened this issue Dec 5, 2022 · 5 comments

Comments

@cavemanloverboy
Copy link

The Universe type calls MPI_FINALIZE() upon being dropped, but it is possible to hold a universe.world() after dropping a Universe and the internode communications methods are impl'd on the world. This is a problem.

I recently wrote a program that dropped a universe (unintentionally) and then tried to used the world but ran into issues since MPI_FINALIZE had been called. I wonder if it is possible to enforce that a universe outlive world through the lifetime system by, for example, requiring that world hold some reference to a dummy field on a universe.

@cavemanloverboy
Copy link
Author

Another solution would be to have some unit struct type Finalize which is held in an Arc<T> and held by the Universe and SystemCommunicator::world(). You could have the special Drop impl for Finalize which calls MPI_FINALIZE. Then, the final drop of Arc<Finalize> would call this whether it is Universe or the SystemCommunicator::world().

@jedbrown
Copy link
Contributor

jedbrown commented Dec 6, 2022

MPI doesn't have a concept of a universe as an object, and even the size (MPI_UNIVERSE_SIZE) is just an optional attribute (need not be present) on MPI_COMM_WORLD. I think we should handle this with PhantomData lifetimes so that communicators can't outlive the universe. Could you make a pull request that adds a reproducer in which your communicator outlives universe (and thus errors)?

@cavemanloverboy
Copy link
Author

Yea I’ll submit one later this week. I have a busy schedule these next three days.

@jedbrown
Copy link
Contributor

jedbrown commented Dec 6, 2022

Cool. There's also relevant discussion in #32.

@SolidTux
Copy link

SolidTux commented Nov 7, 2023

Are there any updates on this?

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

No branches or pull requests

3 participants