From 5bcf04365db318c3dc143b16d79cc28c2d27e6f1 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 21 Oct 2019 13:19:43 +0200 Subject: [PATCH] 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. --- include/deal.II/base/mpi_compute_index_owner_internal.h | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.39.5