TEST/TOOLING-ONLY. Temporarily overrides what
comm_env_compute_comm() returns to comm, until the matching
comm_env_pop_compute_comm().
Exists so a test can run a genuinely serial “reference” engine
(compute_size=1) on EVERY physical rank while still calling a
COLLECTIVE report (ocean_console_stats_report, which always
reduces over comm_env_compute_comm(), the real job
communicator): pushing a per-rank self-communicator around that
one call makes the collective an identity op on each rank’s own
copy instead of allreducing nprocs independent serial replicas
into one bogus sum. See
tests/mpi/test_ocean_decomp_bitid_mpi.F90’s
check_periodic_sponge_serial_out for the call site and
run_one’s HAZARD comment for the full story.
NOT for production code paths — it exists purely to let a test
stand up an alternate communicator around a fixed call without
threading a comm argument through every intermediate routine.
One-level only: a push while an override is already active is a
bug in the caller (a missing pop, or an attempt to nest) and
fails loud rather than silently discarding or stacking past
COMPUTE_COMM_OVERRIDE_MAX_DEPTH.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(comm_t), | intent(in) | :: | comm |
subroutine comm_env_push_compute_comm(comm) !! TEST/TOOLING-ONLY. Temporarily overrides what !! `comm_env_compute_comm()` returns to `comm`, until the matching !! `comm_env_pop_compute_comm()`. !! !! Exists so a test can run a genuinely serial "reference" engine !! (`compute_size=1`) on EVERY physical rank while still calling a !! COLLECTIVE report (`ocean_console_stats_report`, which always !! reduces over `comm_env_compute_comm()`, the real job !! communicator): pushing a per-rank self-communicator around that !! one call makes the collective an identity op on each rank's own !! copy instead of allreducing `nprocs` independent serial replicas !! into one bogus sum. See !! `tests/mpi/test_ocean_decomp_bitid_mpi.F90`'s !! `check_periodic_sponge_serial_out` for the call site and !! `run_one`'s HAZARD comment for the full story. !! !! NOT for production code paths — it exists purely to let a test !! stand up an alternate communicator around a fixed call without !! threading a `comm` argument through every intermediate routine. !! One-level only: a push while an override is already active is a !! bug in the caller (a missing pop, or an attempt to nest) and !! fails loud rather than silently discarding or stacking past !! `COMPUTE_COMM_OVERRIDE_MAX_DEPTH`. type(comm_t), intent(in) :: comm if (compute_comm_override_depth >= COMPUTE_COMM_OVERRIDE_MAX_DEPTH) then error stop "comm_env_push_compute_comm: override already active "// & "(one-level stack) -- call comm_env_pop_compute_comm first" end if compute_comm_override = comm compute_comm_override_depth = compute_comm_override_depth + 1 end subroutine comm_env_push_compute_comm