Skip to content

Read the replica index on rank 0 in DIMER, grid output and OUTPUT_ANALYSIS_DATA_TO_COLVAR (#1443) - #1483

Merged
carlocamilloni merged 3 commits into
plumed:v2.9from
aalhossary:issue1443-guards
Oct 10, 2026
Merged

carlocamilloni merged 3 commits into
plumed:v2.9from
aalhossary:issue1443-guards

Conversation

@aalhossary

Copy link
Copy Markdown
Contributor
Description

The v2.9 part of #1443. multi_sim_comm is valid only on rank 0 of each replica, but three actions read it on every rank. With more than one MPI rank per replica (domain decomposition) they get the wrong replica index on the other ranks:

action symptom
DIMER aborts: "Mismatch between provided sigmas and number of replicas"
DUMPGRID, DUMPCUBE, GRID_TO_XYZ (GridPrintingBase) replica 1 also writes its grid although REPLICA=0 (histo.1)
OUTPUT_ANALYSIS_DATA_TO_COLVAR replica 1 also writes its data although REPLICA=0 (frames.1)

The plan on #1443 was to guard such actions with an explicit error. Reading the index on rank 0 and broadcasting it over comm is the same few lines and makes them work instead, so this fixes them. One commit per action.

I checked every other use of multi_sim_comm on v2.9: they either use the same rank-0 pattern already or run inside rank-0 blocks. LOGMFD is tracked separately in #1480. On master these actions use the helpers from #1481 (DIMER) or no longer exist (the other two).

Target release

I would like my code to appear in release v2.9

Type of contribution
  • changes to code or doc authored by PLUMED developers, or additions of code in the core or within the default modules
  • changes to a module not authored by you
  • new module contribution or edit of a module authored by you
Copyright
  • I agree to transfer the copyright of the code I have written to the PLUMED developers or to the author of the code I am modifying.
Tests
  • I added a new regtest or modified an existing regtest to validate my changes.
  • I verified that all regtests are passed successfully on GitHub Actions.

Three new regtests, each with 2 replicas × 2 MPI ranks under driver --debug-dd yes:

  • basic/rt-dimer-multi-dd (same as on master): forces match the 1-rank-per-replica run exactly. Without the fix it aborts.
  • basic/rt-dumpgrid-multi-dd and basic/rt-output-colvar-multi-dd: output matches the 1-rank-per-replica run, and the list of files written is checked. Without the fix an extra .1 file appears and the test fails.

Locally the full suite gives 614 performed and 2 errors, both Fortran tests that are unrelated to this change: rt-make-fortran (my gfortran rejects the argument type mismatches in the legacy interface) and rt-make-fortran08 (as on master).

multi_sim_comm is valid only on rank 0 of each replica. DIMER read it on
every rank, so with more than one MPI rank per replica the other ranks
took replica 0's DSIGMA, and the run aborted with "Mismatch between
provided sigmas and number of replicas".

The regtest runs 2 replicas with 2 ranks each under driver --debug-dd;
its forces match the run with one rank per replica.

See plumed#1443.
GridPrintingBase chose whether to write by reading multi_sim_comm, which
is valid only on rank 0 of each replica. With more than one MPI rank per
replica, the other ranks of every replica saw index 0, so with the
default REPLICA=0 replica 1 also wrote its grid (histo.1).

The regtest runs 2 replicas with 2 ranks each under driver --debug-dd
and checks both the grids and the list of files written.

See plumed#1443.
…broadcast it

OutputColvarFile chose whether to write by reading multi_sim_comm, which
is valid only on rank 0 of each replica. With more than one MPI rank per
replica, the other ranks of every replica saw index 0, so with the
default REPLICA=0 replica 1 also wrote its data (frames.1).

The regtest runs 2 replicas with 2 ranks each under driver --debug-dd
and checks both the data and the list of files written.

See plumed#1443.
@carlocamilloni
carlocamilloni merged commit b6b3fc0 into plumed:v2.9 Oct 10, 2026
11 checks passed
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