Changeset 2309


Ignore:
Timestamp:
03/14/22 14:33:17 (2 years ago)
Author:
ymipsl
Message:

Bug fix when resizing buffer on server size.

YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/buffer_server.cpp

    r2246 r2309  
    156156      first=0 ; 
    157157      count-- ; 
     158      used-- ; 
    158159      end=size ; 
    159160    } 
     
    182183          ERROR("void CServerBuffer::freeBuffer(size_t count)", 
    183184                 <<"cannot free required size in buffer") ; 
     185      } 
     186    } 
     187    used-=count ; 
     188  } 
     189 
     190  void CServerBuffer::popBuffer(size_t count) 
     191  { 
     192    if (count==0) return ; 
     193 
     194    if (current==0)   
     195    { 
     196      current = end ; 
     197      end=size ; 
     198    } 
     199     
     200 
     201    if (first<=current) 
     202    { 
     203      if (current-count >first) 
     204      { 
     205        current-=count ; 
     206      } 
     207      else 
     208      { 
     209          ERROR("void CServerBuffer::popBuffer(size_t count)", 
     210                 <<"cannot pop required size in buffer") ; 
     211      } 
     212 
     213    } 
     214    else 
     215    { 
     216      if (current-count>=0) 
     217      { 
     218        current-=count ; 
     219      } 
     220      else 
     221      { 
     222          ERROR("void CServerBuffer::freeBuffer(size_t count)", 
     223                 <<"cannot pop required size in buffer") ; 
    184224      } 
    185225    } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/buffer_server.hpp

    r2273 r2309  
    2020      void* getBuffer(size_t count) ; 
    2121      void freeBuffer(size_t count) ; 
     22      void popBuffer(size_t count) ; 
    2223      void createWindows(MPI_Comm oneSidedComm) ; 
    2324      bool getBufferFromClient(size_t timeLine, char* & buffer, size_t& count) ; 
     
    2829      void notifyClientFinalize(void) ; 
    2930      void notifyBufferResizing(void) ; 
     31      size_t getUsed(void) { return used ;} 
    3032    private: 
    3133      char* buffer; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/context_server.cpp

    r2307 r2309  
    305305        buffers[rank]->notifyBufferResizing() ; 
    306306        buffers[rank]->updateCurrentWindows() ; 
    307         buffers[rank]->freeBuffer(count) ; 
    308         info(100)<<"Context id "<<context->getId()<<" : Receive NotifyChangeBufferSize from client rank "<<rank<<endl ; 
     307        buffers[rank]->popBuffer(count) ; 
     308        info(100)<<"Context id "<<context->getId()<<" : Receive NotifyChangeBufferSize from client rank "<<rank<<endl 
     309                 <<"isBufferEmpty ? "<<buffers[rank]->isBufferEmpty()<<"  remaining count : "<<buffers[rank]->getUsed()<<endl; 
    309310      }  
    310311      else if (timeLine==timelineEventChangeBufferSize) 
Note: See TracChangeset for help on using the changeset viewer.