Finalise MPI. No-op if the comm-env was never initialised, so it is safe to call unconditionally at program exit – the shared per-test main does this for the few tests that init MPI, and it costs nothing for the rest (and on serial builds via the stub).
subroutine comm_env_finalize() !! Finalise MPI. No-op if the comm-env was never initialised, so it !! is safe to call unconditionally at program exit -- the shared !! per-test main does this for the few tests that init MPI, and it !! costs nothing for the rest (and on serial builds via the stub). if (.not. env_initialised) return if (allocated(cached_node_compute_ranks)) deallocate (cached_node_compute_ranks) call comm_global%finalize() call pic_mpi_finalize() env_initialised = .false. end subroutine comm_env_finalize