From: Daniel Arndt Date: Wed, 5 May 2021 23:06:14 +0000 (-0400) Subject: Move barrier between step-6 and step-7 X-Git-Tag: v9.3.0-rc1~128^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f3fc4527263561a854f233f8d41c9624f0e8fad;p=dealii.git Move barrier between step-6 and step-7 --- diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index 6f0eddc8b0..9f093a09d4 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -1510,6 +1510,10 @@ AlignedVector::replicate_across_communicator(const MPI_Comm & communicator, new (&aligned_shmem_pointer[i]) T(std::move(elements[i])); } + // Make sure that the shared memory host has copied the data before we try to + // access it. + MPI_Barrier(shmem_group_communicator); + // **** Step 7 **** // Finally, we need to set the pointers of this object to what we just // learned. This also releases all memory that may have been in use @@ -1553,10 +1557,6 @@ AlignedVector::replicate_across_communicator(const MPI_Comm & communicator, used_elements_end = elements.get() + array_size; allocated_elements_end = used_elements_end; - // Make sure that the shared memory host has copied the data before we try to - // access it. - MPI_Barrier(shmem_group_communicator); - // **** Consistency check **** // At this point, each process should have a copy of the data. // Verify this in some sort of round-about way