Skip to content
Snippets Groups Projects
Commit 0c697d8d authored by Markus Blatt's avatar Markus Blatt Committed by Christian Engwer
Browse files

[bugfix,parallel] Do not send or receive message of size zero.

There is not need to send message that contain no data. It might even
produce problems on  some implementation. Therfore this patch always
checks the size and simply sets the request to inactive (aka
MPI_REQUEST_NULL) if no data would be send or received.

The patch is to be cherry-picked to master if Christian approves.
parent 7d560280
No related branches found
No related tags found
No related merge requests found
......@@ -1433,15 +1433,23 @@ namespace Dune
if(FORWARD) {
assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= recvBufferSize );
Dune::dvverb<<rank<<": receiving "<<info->second.second.size_<<" from "<<info->first<<std::endl;
MPI_Irecv(recvBuffer+info->second.second.start_, info->second.second.size_,
MPI_BYTE, info->first, commTag_, communicator_,
recvRequests+i);
if(info->second.second.size_)
MPI_Irecv(recvBuffer+info->second.second.start_, info->second.second.size_,
MPI_BYTE, info->first, commTag_, communicator_,
recvRequests+i);
else
# Nothing to receive -> set request to inactive
recvRequests[i]=MPI_REQUEST_NULL;
}else{
assert(info->second.first.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.first.size_ <= recvBufferSize );
Dune::dvverb<<rank<<": receiving "<<info->second.first.size_<<" to "<<info->first<<std::endl;
MPI_Irecv(recvBuffer+info->second.first.start_, info->second.first.size_,
MPI_BYTE, info->first, commTag_, communicator_,
recvRequests+i);
if(info->second.first.size_)
MPI_Irecv(recvBuffer+info->second.first.start_, info->second.first.size_,
MPI_BYTE, info->first, commTag_, communicator_,
recvRequests+i);
else
# Nothing to receive -> set request to inactive
recvRequests[i]=MPI_REQUEST_NULL;
}
}
......@@ -1452,15 +1460,23 @@ namespace Dune
assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= recvBufferSize );
Dune::dvverb<<rank<<": sending "<<info->second.first.size_<<" to "<<info->first<<std::endl;
assert(info->second.first.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.first.size_ <= sendBufferSize );
MPI_Issend(sendBuffer+info->second.first.start_, info->second.first.size_,
MPI_BYTE, info->first, commTag_, communicator_,
sendRequests+i);
if(info->second.first.size_)
MPI_Issend(sendBuffer+info->second.first.start_, info->second.first.size_,
MPI_BYTE, info->first, commTag_, communicator_,
sendRequests+i);
else
# Nothing to send -> set request to inactive
sendRequests[i]=MPI_REQUEST_NULL;
}else{
assert(info->second.second.start_*sizeof(typename CommPolicy<Data>::IndexedType)+info->second.second.size_ <= sendBufferSize );
Dune::dvverb<<rank<<": sending "<<info->second.second.size_<<" to "<<info->first<<std::endl;
MPI_Issend(sendBuffer+info->second.second.start_, info->second.second.size_,
MPI_BYTE, info->first, commTag_, communicator_,
sendRequests+i);
if(info->second.second.size_)
MPI_Issend(sendBuffer+info->second.second.start_, info->second.second.size_,
MPI_BYTE, info->first, commTag_, communicator_,
sendRequests+i);
else
# Nothing to send -> set request to inactive
sendRequests[i]=MPI_REQUEST_NULL;
}
// Wait for completion of receive and immediately start scatter
......
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