Changeset 634


Ignore:
Timestamp:
07/15/15 16:36:38 (6 years ago)
Author:
rlacroix
Message:

Transformations: Fix some errors in MPI communications

  • Some communications could have caused deadlocks.
  • Some communications were not properly checked for completion.
Location:
XIOS/trunk/src/transformation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/transformation/grid_transformation.cpp

    r631 r634  
    471471 if (0 != sendBuffSize) sendBuff = new unsigned long [sendBuffSize]; 
    472472 for (StdSize idx = 0; idx < sendBuffSize; ++idx) sendBuff[idx] = NumTraits<Scalar>::sfmax(); 
     473 
     474 std::map<int, MPI_Request> requests; 
    473475 
    474476 int currentBuffPosition = 0; 
     
    488490   } 
    489491   currentSendBuff = sendBuff + currentBuffPosition; 
    490    MPI_Send(currentSendBuff, countSize, MPI_UNSIGNED_LONG, destRank, 14, client->intraComm); 
     492   MPI_Isend(currentSendBuff, countSize, MPI_UNSIGNED_LONG, destRank, 14, client->intraComm, &requests[destRank]); 
    491493   currentBuffPosition += countSize; 
    492494 } 
     
    551553 } 
    552554 
     555 std::map<int, MPI_Request>::iterator itRequest; 
     556 for (itRequest = requests.begin(); itRequest != requests.end(); ++itRequest) 
     557   MPI_Wait(&itRequest->second, MPI_STATUS_IGNORE); 
     558 
    553559 if (0 != sendBuffSize) delete [] sendBuff; 
    554560 if (0 != recvBuffSize) delete [] recvBuff; 
  • XIOS/trunk/src/transformation/transformation_mapping.cpp

    r630 r634  
    140140  if (0 != buffSize) recvBuffGlobalIndex = new unsigned long [buffSize]; 
    141141 
     142  std::map<int, MPI_Request> requests; 
     143 
    142144  // Inform all "source clients" about index that they need to send 
    143145  for (itMapSrc = itbMapSrc; itMapSrc != iteMapSrc; ++itMapSrc) 
    144146  { 
    145     MPI_Request request; 
    146147    unsigned long* sendPtr = const_cast<unsigned long*>(&(itMapSrc->second)[0]); 
    147148    MPI_Isend(sendPtr, 
     
    151152              11, 
    152153              client->intraComm, 
    153               &request); 
     154              &requests[itMapSrc->first]); 
    154155  } 
    155156 
     
    177178  } 
    178179 
     180  std::map<int, MPI_Request>::iterator itRequest; 
     181  for (itRequest = requests.begin(); itRequest != requests.end(); ++itRequest) 
     182    MPI_Wait(&itRequest->second, MPI_STATUS_IGNORE); 
     183 
    179184  delete [] sendBuff; 
    180185  delete [] recvBuff; 
Note: See TracChangeset for help on using the changeset viewer.