From 297d26cfb77e677a6732612210b49f27d3501ffc Mon Sep 17 00:00:00 2001 From: Nils Kohl <nils.kohl@fau.de> Date: Tue, 30 Jun 2020 16:08:24 +0200 Subject: [PATCH] Some fixes in BufferSystemTest for unknown sender communication. --- tests/core/mpi/BufferSystemTest.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/core/mpi/BufferSystemTest.cpp b/tests/core/mpi/BufferSystemTest.cpp index fab4340bf..2ab979b7d 100644 --- a/tests/core/mpi/BufferSystemTest.cpp +++ b/tests/core/mpi/BufferSystemTest.cpp @@ -307,6 +307,17 @@ void gatherUsingAsymmetricCommunication(const bool useIProbe) void unknownRanksAllToAll() { + // The unknown-sender communication is more vulnerable when + // tags of other MPI communication routines are equal since + // it processes messages with MPI_ANY_SOURCE + // + // Therefore this barrier makes sure that previous tests + // do not impose race-conditions. + // + // This is safer than specifying "unique" tags, since + // tags are never "unique" :) + WALBERLA_MPI_BARRIER(); + const int rank = MPIManager::instance()->worldRank(); const int numProcesses = MPIManager::instance()->numProcesses(); @@ -331,6 +342,7 @@ void unknownRanksAllToAll() auto numReceives = 0; for (auto it = bs.begin(); it != bs.end(); ++it) { + WALBERLA_LOG_INFO( "Sender rank: " << it.rank() << ", msg size: " << it.buffer().size() ); WALBERLA_CHECK_EQUAL(it.buffer().size(), (it.rank() + 1) * 4); for (int i = 0; i < it.rank() + 1; ++i) { @@ -344,6 +356,17 @@ void unknownRanksAllToAll() } void unknownRanksAllToLower() { + // The unknown-sender communication is more vulnerable when + // tags of other MPI communication routines are equal since + // it processes messages with MPI_ANY_SOURCE + // + // Therefore this barrier makes sure that previous tests + // do not impose race-conditions. + // + // This is safer than specifying "unique" tags, since + // tags are never "unique" :) + WALBERLA_MPI_BARRIER(); + const int rank = MPIManager::instance()->worldRank(); const int numProcesses = MPIManager::instance()->numProcesses(); @@ -358,8 +381,8 @@ void unknownRanksAllToLower() sb << rank; } - //we await numProcesses messages on every rank - bs.setReceiverInfo(numProcesses); + //we await numProcesses - rank messages on every rank + bs.setReceiverInfo(numProcesses - rank); //equivalent to //std::set<mpi::MPIRank> recvs; //for (auto targetRank = numProcesses - 1; targetRank >=rank; --targetRank) @@ -456,6 +479,7 @@ int main(int argc, char**argv) debug::enterTestMode(); auto mpiManager = MPIManager::instance(); + mpiManager->useWorldComm(); int numProcesses = mpiManager->numProcesses(); if(numProcesses <= 2) -- GitLab