source: XIOS/dev/dev_ym/XIOS_COUPLING/src/buffer_client.hpp @ 2130

Last change on this file since 2130 was 2130, checked in by ymipsl, 3 years ago

New management of client-server buffers.

  • buffers can grow automatically in intialization phase
  • buffers is evaluated after the close context definition phase and fixed at optimal value.

YM

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 2.0 KB
RevLine 
[300]1#ifndef __BUFFER_CLIENT_HPP__
2#define __BUFFER_CLIENT_HPP__
3
[591]4#include "xios_spl.hpp"
[300]5#include "buffer_out.hpp"
[382]6#include "mpi.hpp"
[509]7#include "cxios.hpp"
[300]8
[335]9namespace xios
[300]10{
11  class CClientBuffer
12  {
13    public:
[732]14      static size_t maxRequestSize;
[509]15
[1757]16      CClientBuffer(MPI_Comm intercomm, vector<MPI_Win>& windows, int clientRank, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize);
[732]17      ~CClientBuffer();
[1757]18//      void createWindows(MPI_Comm oneSidedComm) ;
19      void freeWindows(void) ;
20      void lockBuffer(void) ;
21      void unlockBuffer(void) ;
22     
[1227]23      bool isBufferFree(StdSize size);
[1757]24      CBufferOut* getBuffer(size_t timeLine, StdSize size);
25      bool checkBuffer(bool send=false);
[732]26      bool hasPendingRequest(void);
[1227]27      StdSize remain(void);
[1757]28      MPI_Aint getWinAddress(int numWindows) ;
29      void infoBuffer(void) ;
30      bool isNotifiedFinalized(void) ;
[2130]31      void setGrowableBuffer(double growFactor) { growFactor_=growFactor ; isGrowableBuffer_=true ;}
32      void fixBufferSize(size_t bufferSize) { newBufferSize_=bufferSize ; isGrowableBuffer_=false ; resizingBufferStep_=1 ;}
33      void fixBuffer(void) { isGrowableBuffer_=false ;}
[732]34    private:
[2130]35       void resizeBuffer(size_t newSize) ;
36       void resizeBufferNotify(void) ;
37
38
[732]39      char* buffer[2];
[1757]40      char* bufferHeader[2];
41      size_t* firstTimeLine[2] ;
42      size_t* bufferCount[2] ;
43      size_t* control[2] ;
44      size_t* finalize[2] ;
45      bool winState[2] ;
[732]46      int current;
[2130]47     
48      double growFactor_=1.2 ;
49      bool isGrowableBuffer_=true ;
[1227]50
[2130]51      int resizingBufferStep_ = 0 ;
52      size_t newBufferSize_ ;
[1227]53      StdSize count;
54      StdSize maxEventSize;
[2130]55      StdSize bufferSize;
[1227]56      const StdSize estimatedMaxEventSize;
57
58
[917]59      const int serverRank;
[1757]60      const int clientRank_;
[732]61      bool pending;
[509]62
[1639]63      MPI_Request request;
[509]64
[732]65      CBufferOut* retBuffer;
[1639]66      const MPI_Comm interComm;
[1757]67      std::vector<MPI_Win> windows_ ;
68      bool hasWindows ;
69      static const int headerSize=4*sizeof(size_t);
[732]70  };
[300]71}
72#endif
Note: See TracBrowser for help on using the repository browser.