Add missing MPI_Barrier to MpiTest
authorMark Abraham <mark.j.abraham@gmail.com>
Mon, 1 Nov 2021 07:58:18 +0000 (08:58 +0100)
committerArtem Zhmurov <zhmurov@gmail.com>
Mon, 1 Nov 2021 14:38:07 +0000 (14:38 +0000)
Fixes #4261

src/testutils/tests/mpitest.cpp

index f3d8c0f4eca09bef4bea9c4eaa7090aec062614b..8d3b9521fc081002087296ad7a74b2acefc0034f 100644 (file)
@@ -74,6 +74,9 @@ TEST_F(MpiSelfTest, Runs)
     {
         reached_.resize(getNumberOfTestMpiRanks(), 0);
     }
+    // Needed for thread-MPI so that we resize the buffer before we
+    // fill it on non-master ranks.
+    MPI_Barrier(MPI_COMM_WORLD);
     int value = 1;
     MPI_Gather(&value, 1, MPI_INT, reached_.data(), 1, MPI_INT, 0, MPI_COMM_WORLD);
     if (gmx_node_rank() == 0)