From: Timo Heister Date: Mon, 21 Oct 2019 11:19:43 +0000 (+0200) Subject: add a barrier to avoid MPI race in ConsensusAlgorithm X-Git-Tag: v9.2.0-rc1~960^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5bcf04365db318c3dc143b16d79cc28c2d27e6f1;p=dealii.git add a barrier to avoid MPI race in ConsensusAlgorithm As discussed in #8929, messages exchanged in this function can be mixed up if called twice in succesion. Add a Barrier to make sure this won't happen. --- diff --git a/include/deal.II/base/mpi_compute_index_owner_internal.h b/include/deal.II/base/mpi_compute_index_owner_internal.h index dea27428e4..00642c81b5 100644 --- a/include/deal.II/base/mpi_compute_index_owner_internal.h +++ b/include/deal.II/base/mpi_compute_index_owner_internal.h @@ -759,6 +759,11 @@ namespace Utilities } # endif + // This barrier is important to make sure that two successive calls + // to this functions do not overlap and we confuse messages. See the + // discussion in https://github.com/dealii/dealii/issues/8929 + MPI_Barrier(comm); + #endif // DEAL_II_WITH_MPI return requested_indices;