Skip to content
Snippets Groups Projects
Commit 45f48a1d authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Merge remote-tracking branch...

Merge remote-tracking branch 'origin/feature/fix-variablesizecom-with-empty-interface' into releases/2.4

Merge on request of Markus Blatt
parents 54bb4e2b 20309d46
No related branches found
No related tags found
No related merge requests found
......@@ -125,6 +125,12 @@ int main(int argc, char** argv)
}
else
{
// We also want to check the case where the interface is empty on some
// processes. Therefore we artificially lower the numer of processes
// if it is larger than two. Thus the last rank will not send anything
// and we check for deadlocks.
if(procs>2)
--procs;
int N=100000;
int num_per_proc=N/procs;
int start, end;
......@@ -142,7 +148,7 @@ int main(int argc, char** argv)
assert(N==end);
typedef Dune::VariableSizeCommunicator<>::InterfaceMap Interface;
Interface inf;
if(rank)
if(rank && rank<procs) // rank==procs might hold and produce a deadlock otherwise!
{
Dune::InterfaceInformation send, recv;
send.reserve(2);
......@@ -165,6 +171,9 @@ int main(int argc, char** argv)
recv.add(end);
inf[rank+1]=std::make_pair(send, recv);
}
if(rank==procs)
std::cout<<" rank "<<rank<<" has empty interface "<<inf.size()<<std::endl;
Dune::VariableSizeCommunicator<> comm(MPI_COMM_WORLD, inf, 6);
MyDataHandle handle(rank);
comm.forward(handle);
......
......@@ -1145,6 +1145,11 @@ template<class Allocator>
template<bool FORWARD, class DataHandle>
void VariableSizeCommunicator<Allocator>::communicate(DataHandle& handle)
{
if( interface_->size() == 0)
// Simply return as otherwise we will index an empty container
// either for MPI_Wait_all or MPI_Test_some.
return;
if(handle.fixedsize())
communicateFixedSize<FORWARD>(handle);
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment