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

Last change on this file since 1853 was 1757, checked in by ymipsl, 5 years ago

Implement one sided communication in client/server protocol to avoid dead-lock when some buffer are full.

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: 1.5 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    private:
32      char* buffer[2];
33      char* bufferHeader[2];
34      size_t* firstTimeLine[2] ;
35      size_t* bufferCount[2] ;
36      size_t* control[2] ;
37      size_t* finalize[2] ;
38      bool winState[2] ;
39      int current;
40
41      StdSize count;
42      StdSize maxEventSize;
43      const StdSize bufferSize;
44      const StdSize estimatedMaxEventSize;
45
46
47      const int serverRank;
48      const int clientRank_;
49      bool pending;
50
51      MPI_Request request;
52
53      CBufferOut* retBuffer;
54      const MPI_Comm interComm;
55      std::vector<MPI_Win> windows_ ;
56      bool hasWindows ;
57      static const int headerSize=4*sizeof(size_t);
58  };
59}
60#endif
Note: See TracBrowser for help on using the repository browser.