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
Line 
1#ifndef __BUFFER_CLIENT_HPP__
2#define __BUFFER_CLIENT_HPP__
3
4#include "xios_spl.hpp"
5#include "buffer_out.hpp"
6#include "mpi.hpp"
7#include "cxios.hpp"
8
9namespace xios
10{
11  class CClientBuffer
12  {
13    public:
14      static size_t maxRequestSize;
15
16      CClientBuffer(MPI_Comm intercomm, vector<MPI_Win>& windows, int clientRank, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize);
17      ~CClientBuffer();
18//      void createWindows(MPI_Comm oneSidedComm) ;
19      void freeWindows(void) ;
20      void lockBuffer(void) ;
21      void unlockBuffer(void) ;
22     
23      bool isBufferFree(StdSize size);
24      CBufferOut* getBuffer(size_t timeLine, StdSize size);
25      bool checkBuffer(bool send=false);
26      bool hasPendingRequest(void);
27      StdSize remain(void);
28      MPI_Aint getWinAddress(int numWindows) ;
29      void infoBuffer(void) ;
30      bool isNotifiedFinalized(void) ;
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 ;}
34    private:
35       void resizeBuffer(size_t newSize) ;
36       void resizeBufferNotify(void) ;
37
38
39      char* buffer[2];
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] ;
46      int current;
47     
48      double growFactor_=1.2 ;
49      bool isGrowableBuffer_=true ;
50
51      int resizingBufferStep_ = 0 ;
52      size_t newBufferSize_ ;
53      StdSize count;
54      StdSize maxEventSize;
55      StdSize bufferSize;
56      const StdSize estimatedMaxEventSize;
57
58
59      const int serverRank;
60      const int clientRank_;
61      bool pending;
62
63      MPI_Request request;
64
65      CBufferOut* retBuffer;
66      const MPI_Comm interComm;
67      std::vector<MPI_Win> windows_ ;
68      bool hasWindows ;
69      static const int headerSize=4*sizeof(size_t);
70  };
71}
72#endif
Note: See TracBrowser for help on using the repository browser.