Fix issues in AWH BiasSharing test
authorBerk Hess <hess@kth.se>
Thu, 7 Oct 2021 20:46:29 +0000 (22:46 +0200)
committerAndrey Alekseenko <al42and@gmail.com>
Mon, 11 Oct 2021 10:36:09 +0000 (10:36 +0000)
Recent commit bbcd5f1 introduced two issues in the new test
for the BiasSharing class which sometimes led to failures,
in particular with the TSAN build.

src/gromacs/applied_forces/awh/tests/biassharing.cpp

index fe1e649eb06fd25dcb2f67e7c342081cac5a6863..70f75e41cba52d7d576d05288d028a5d44813ecb 100644 (file)
@@ -78,9 +78,8 @@ void parallelTestFunction(const void gmx_unused* dummy)
     MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
     const int shareGroup = 1 + (myRank / c_numSharingBiases);
 
-    t_commrec commRecord;
-    commRecord.nnodes = 1;
-    commRecord.nodeid = 0;
+    t_commrec commRecord = { 0 };
+    commRecord.nnodes    = 1;
 
     const std::vector<char> serializedAwhParametersPerDim = awhDimParamSerialized();
     auto              awhDimArrayRef = gmx::arrayRefFromArray(&serializedAwhParametersPerDim, 1);
@@ -115,7 +114,7 @@ void parallelTestFunction(const void gmx_unused* dummy)
 
 TEST(BiasSharingTest, SharingWorks)
 {
-    if (tMPI_Init_fn(TRUE, c_numRanks, TMPI_AFFINITY_NONE, parallelTestFunction, static_cast<const void*>(this))
+    if (tMPI_Init_fn(FALSE, c_numRanks, TMPI_AFFINITY_NONE, parallelTestFunction, static_cast<const void*>(this))
         != TMPI_SUCCESS)
     {
         GMX_THROW(gmx::InternalError("Failed to spawn thread-MPI threads"));