Fix: Prevent MPI communicator growth in LCAO matrix output - #7676
Merged
Conversation
AsTonyshment
force-pushed
the
fix/MPI_comm_leak
branch
from
July 23, 2026 07:58
6dc57f6 to
1f6e7be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed?
This bug was discovered by @ESROAMER when an LCAO RT-TDDFT calculation failed at approximately electronic step 2370 with:
LCAO matrix-output code created a temporary BLACS process grid for each serial gather and then immediately called
set_serial().set_serial()overwrote the BLACS context with-1, so the temporary context could no longer be released. Repeated DMR or H/S(R) output during RT-TDDFT therefore consumed MPI communicator contexts until MPI failed.The affected output paths now construct their temporary
Parallel_Orbitalsdistributions directly withset_serial(). This is sufficient forgatherParallels(), which performs the data transfer independently of a BLACS context. The same redundant pattern was removed from DMR, H/S(R), derivative-H, decomposed-H, DeePKS H(R), and asynchronous-overlap output paths.There is no change to matrix values, output formats, filenames, output frequency semantics, numerical solver behavior, or INPUT parameters.
Unit Tests and/or Case Tests for my changes
The figure is plotted directly from the PMPI logs. In two-rank, nine-step RT-TDDFT runs, DMR and H/S(R) output previously added 4 and 8 live communicators per electronic step, respectively, or 12 when combined. After the fix, all output cases match the control and finish with
created=41, freed=41, live=0on each rank.The generated DMR and H/S(R) CSR files are byte-for-byte unchanged.
Governance Notes