source: XIOS3/trunk/src/buffer_client.hpp @ 2547

Last change on this file since 2547 was 2547, checked in by ymipsl, 10 months ago

Major update :

  • New method to lock and unlock one-sided windows (window_dynamic) to avoid network overhead
  • Introducing multithreading on server sided to manage more efficiently dead-lock occuring (similar to co-routine which will be available and implemented in futur c++ standard), based on c++ threads
  • Suprression of old "attached mode" which is replaced by online writer and reder filters

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