Skip to content
Snippets Groups Projects
Commit a8337347 authored by Ansgar Burchardt's avatar Ansgar Burchardt Committed by Carsten Gräser
Browse files

[release,bugfix] Use correct number of expected recvRequests


Since 0c697d8d messages of size zero
are no longer sent. This can reduce the number of requests we have to
wait for.

(cherry picked from commit f35437e9)
Signed-off-by: default avatarCarsten Gräser <graeser@dune-project.org>
parent a99dc818
No related branches found
No related tags found
1 merge request!2512017-05 merge of upstream repository
......@@ -1420,6 +1420,8 @@ namespace Dune
MPI_Request* sendRequests = new MPI_Request[messageInformation_.size()];
MPI_Request* recvRequests = new MPI_Request[messageInformation_.size()];
/* Number of recvRequests that are not MPI_REQUEST_NULL */
size_t numberOfRealRecvRequests = 0;
// Setup receive first
typedef typename InformationMap::const_iterator const_iterator;
......@@ -1433,23 +1435,27 @@ 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;
if(info->second.second.size_)
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
numberOfRealRecvRequests += 1;
} 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;
if(info->second.first.size_)
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
numberOfRealRecvRequests += 1;
} else {
// Nothing to receive -> set request to inactive
recvRequests[i]=MPI_REQUEST_NULL;
}
}
}
......@@ -1486,7 +1492,7 @@ namespace Dune
MPI_Status status; //[messageInformation_.size()];
//MPI_Waitall(messageInformation_.size(), recvRequests, status);
for(i=0; i< messageInformation_.size(); i++) {
for(i=0; i< numberOfRealRecvRequests; i++) {
status.MPI_ERROR=MPI_SUCCESS;
MPI_Waitany(messageInformation_.size(), recvRequests, &finished, &status);
assert(finished != MPI_UNDEFINED);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment