Repository navigation
Raise an error in debug builds when multi_sim_comm is used where it is a stand-in (#1443) - #1484
Merged
Merged
Conversation
…s a stand-in multi_sim_comm is given only to one process per replica; on the other processes it stays MPI_COMM_SELF, so using it there silently acts on a single replica (plumed#1443). Communicator gets a stand-in mark. updateReplicaIdentity() sets it on multi_sim_comm wherever it has size 1 although there is more than one replica. In debug builds, asking a stand-in for its rank or size, or communicating over it, raises an error; the message is also printed to stderr at once, because typically only some processes raise it and the log is written collectively. The regtest LOADs a small action that checks the mark and the error on every rank of 2 replicas with 2 ranks each. See plumed#1443.
This was referenced Oct 10, 2026
3 of 6 tasks
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.
Description
Closes #1487.
Option 1 of #1443 (see the table there): in debug builds, using
multi_sim_common a process that was not given it now raises an error instead of silently acting on a single replica.Communicatorgets a stand-in mark (setStandIn()/isStandIn()). In debug builds, asking a stand-in for its rank or size, or communicating over it, raises an error. In release builds the check compiles away.Set_comm()clears the mark, and copies keep it.PlumedMain::updateReplicaIdentity()(from Replica count and index on every rank of a replica (#1443, part C) #1481) marksmulti_sim_commas a stand-in on every process where it has size 1 although there is more than one replica, i.e. on all processes of a replica except the one the MD code gave the inter-replica communicator to.This adds a member to
Communicator, which changes its layout; that is why it targetsmasteronly.Target release
I would like my code to appear in release master (v2.11)
Type of contribution
Copyright
Tests
New regtest
basic/rt-multi-sim-comm-stand-inruns 2 replicas × 2 MPI ranks and LOADs a small action that checks, on every rank, thatmulti_sim_commis a stand-in exactly on the second rank of each replica, and that using it there raises an error in debug builds and does not in release builds. With the marking removed, the test fails.Locally, with
--enable-debug, the full suite gives 813 performed and 1 error,basic/rt-make-fortran08, the same libc++/libstdc++ mismatch in my build as on #1481. The new check fired only in the new regtest, so no existing regtest usesmulti_sim_commwhere it is a stand-in (21 of them run with more than one rank per replica).