Changeset 1192


Ignore:
Timestamp:
07/03/17 14:34:22 (7 years ago)
Author:
rlacroix
Message:

Display a warning message if an event has a size greater than the estimated maximum event size.

This should not happen in theory and must be fixed.

Location:
XIOS/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/buffer_client.cpp

    r917 r1192  
    1212  size_t CClientBuffer::maxRequestSize = 0; 
    1313 
    14   CClientBuffer::CClientBuffer(MPI_Comm interComm, int serverRank, StdSize bufferSize, StdSize maxBufferedEvents) 
     14  CClientBuffer::CClientBuffer(MPI_Comm interComm, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize, StdSize maxBufferedEvents) 
    1515    : interComm(interComm) 
    1616    , serverRank(serverRank) 
    1717    , bufferSize(bufferSize) 
     18    , estimatedMaxEventSize(estimatedMaxEventSize) 
     19    , maxEventSize(0) 
    1820    , current(0) 
    1921    , count(0) 
     
    4244  bool CClientBuffer::isBufferFree(int size) 
    4345  { 
    44     if (size > maxRequestSize) maxRequestSize = size; 
    45  
    4646    if (size > bufferSize) 
    4747      ERROR("bool CClientBuffer::isBufferFree(int size)", 
    4848            << "The requested size (" << size << " bytes) is too big to fit the buffer (" << bufferSize << " bytes), please increase the client buffer size." << endl); 
     49 
     50    if (size > maxEventSize) 
     51    { 
     52      maxEventSize = size; 
     53 
     54      if (size > estimatedMaxEventSize) 
     55        error(0) << "WARNING: Unexpected event of size " << size << " for server " << serverRank 
     56                 << " (estimated max event size = " << estimatedMaxEventSize << ")" << std::endl; 
     57 
     58      if (size > maxRequestSize) maxRequestSize = size; 
     59    } 
     60 
    4961 
    5062    return (size <= remain() && bufferedEvents < maxBufferedEvents); 
  • XIOS/trunk/src/buffer_client.hpp

    r917 r1192  
    1414      static size_t maxRequestSize; 
    1515 
    16       CClientBuffer(MPI_Comm intercomm, int serverRank, StdSize bufferSize, StdSize maxBufferedEvents); 
     16      CClientBuffer(MPI_Comm intercomm, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize, StdSize maxBufferedEvents); 
    1717      ~CClientBuffer(); 
    1818 
     
    2929      int count; 
    3030      int bufferedEvents; 
     31      int maxEventSize; 
    3132      const int maxBufferedEvents; 
    3233      const int bufferSize; 
     34      const int estimatedMaxEventSize; 
    3335      const int serverRank; 
    3436      bool pending; 
  • XIOS/trunk/src/context_client.cpp

    r1033 r1192  
    234234        error(0) << "WARNING: Unexpected request for buffer to communicate with server " << rank << std::endl; 
    235235        mapBufferSize_[rank] = CXios::minBufferSize; 
    236       } 
    237       CClientBuffer* buffer = buffers[rank] = new CClientBuffer(interComm, rank, mapBufferSize_[rank], maxBufferedEvents); 
     236        maxEventSizes[rank] = CXios::minBufferSize; 
     237      } 
     238      CClientBuffer* buffer = buffers[rank] = new CClientBuffer(interComm, rank, mapBufferSize_[rank], maxEventSizes[rank], maxBufferedEvents); 
    238239      // Notify the server 
    239240      CBufferOut* bufOut = buffer->getBuffer(sizeof(StdSize)); 
     
    283284   { 
    284285     mapBufferSize_ = mapSize; 
     286     maxEventSizes = maxEventSize; 
    285287 
    286288     // Compute the maximum number of events that can be safely buffered. 
  • XIOS/trunk/src/context_client.hpp

    r1033 r1192  
    7676      //! Mapping of server and buffer size for each connection to server 
    7777      std::map<int,StdSize> mapBufferSize_; 
     78      //! Maximum event sizes estimated for each connection to server 
     79      std::map<int,StdSize> maxEventSizes; 
    7880      //! Maximum number of events that can be buffered 
    7981      StdSize maxBufferedEvents; 
Note: See TracChangeset for help on using the changeset viewer.