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

Last change on this file since 2246 was 2246, checked in by ymipsl, 3 years ago
  • Update of the tranfer protocol using one sided communication
  • Introduce MPI_Improb/MPI_mrecv to listen incomming request
  • Introducing latency when looping over managers

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