Skip to content

init: use MPIR_CVAR_FINALIZE_ATEXIT to bypass re-init - #7933

Open
hzhou wants to merge 5 commits into
pmodels:mainfrom
hzhou:2608_reinit
Open

init: use MPIR_CVAR_FINALIZE_ATEXIT to bypass re-init#7933
hzhou wants to merge 5 commits into
pmodels:mainfrom
hzhou:2608_reinit

Conversation

@hzhou

@hzhou hzhou commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Pull Request Description

As cc91750#r3758517489 show, we can't rely on local init_counter to collectively resolve conflicts between session re-init epochs. In fact, after a full-day's effort, I concluded there is no way to create a solution for

  1. pmix can't work with duplicate KVS key for business card exchange
  2. shared memory communication will corrupt between re-init epochs.

We just can't have a collective synchronization when we can't establish collective assumptions.

This PR reverts the previous attempts and add MPIR_CVAR_FINALIZE_ATEXIT to workaround. When the cvar is set, we delay the final MPII_Finalize to atexit, avoiding the necessity of re-initialize both shm and netmod.

Author Checklist

  • Provide Description
    Particularly focus on why, not what. Reference background, issues, test failures, xfail entries, etc.
  • Commits Follow Good Practice
    Commits are self-contained and do not do two things at once.
    Commit message is of the form: module: short description
    Commit message explains what's in the commit.
  • Passes All Tests
    Whitespace checker. Warnings test. Additional tests via comments.
  • Contribution Agreement
    For non-Argonne authors, check contribution agreement.
    If necessary, request an explicit comment from your companies PR approval manager.

@hzhou

hzhou commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

test:mpich/ch4/ofi
test:mpich/pmi

@sonjahapp sonjahapp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this PR!

Just found a few minor typo fixes for the testlist. 😉

Comment thread test/mpi/session/testlist Outdated
Comment thread test/mpi/session/testlist Outdated
Comment thread test/mpi/session/testlist Outdated
@hzhou

hzhou commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for this PR!

Just found a few minor typo fixes for the testlist. 😉

Thanks for the catch. I will fix them in the next push.

By the way, do you think we can remove the PMI atexit hook completely now we have the CVAR option?

@sonjahapp

Copy link
Copy Markdown
Collaborator

By the way, do you think we can remove the PMI atexit hook completely now we have the CVAR option?

Hmm... I would keep it.

It leaves freedom to the device to enable more "fine grained" solutions for re-init. The new CVAR is quite the "hammer" since it postpones almost the entire MPI cleanup to an atexit handler. For example, in the psp device we offer the ability to finalize most parts in MPID_Finalize but keep the connections alive. This will only continue to work if the PMI(x)_Finalize remains in an atexit handler as is.

Comment thread src/mpi/init/mpir_init.c Outdated
hzhou added 3 commits August 12, 2026 10:46
Add this cvar as a work-around for sessions re-init. There is no good
solution to synchronize shared memory over re-init now that we switched
to total asynchronous initialization. Consider the following case:

* Process A and B both initialized shm and both re-initialize.
* B re-init shm while A delays.
* B send a message to A via shm.
* A (still in the previous epoch) either discards the message or error.
* A re-init.
* A never receives the message B send.

Delay the final finalize via atexit avoids the re-init altogether.
Putting MPII_Finalize in atexit obviates the need for pmi atexit hook.
@hzhou

hzhou commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

test:mpich/ch4/ofi
test:mpich/pmi

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