source: XIOS3/dev/XIOS_ATTACHED/src/transport/one_sided_context_client.hpp @ 2482

Last change on this file since 2482 was 2482, checked in by ymipsl, 15 months ago

First guess in supression of attached mode replaced by online reader and write filters

YM

  • Property svn:executable set to *
File size: 3.2 KB
Line 
1#ifndef __ONE_SIDED_CONTEXT_CLIENT_HPP__
2#define __ONE_SIDED_CONTEXT_CLIENT_HPP__
3
4#include "xios_spl.hpp"
5#include "buffer_out.hpp"
6#include "buffer_in.hpp"
7#include "one_sided_client_buffer.hpp"
8#include "event_client.hpp"
9#include "event_server.hpp"
10#include "mpi.hpp"
11#include "registry.hpp"
12#include "context_client.hpp"
13
14namespace xios
15{
16  class CContext;
17  class CContextServer ;
18  /*!
19  \class CContextClient
20  A context can be both on client and on server side. In order to differenciate the role of
21  context on each side, e.x client sending events, server receiving and processing events, there is a need of
22  concrete "context" classes for both sides.
23  CContextClient processes and sends events from client to server where CContextServer receives these events
24  and processes them.
25  */
26  class COneSidedContextClient : public CContextClient
27  {
28    public:
29      // Contructor
30      COneSidedContextClient(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0);
31
32      ETransport getType(void) {return oneSided ;}
33      // Send event to server
34      void sendEvent(CEventClient& event);
35      bool havePendingRequests(void);
36      void releaseBuffers(void);
37      bool isNotifiedFinalized(void) ;
38      void finalize(void);
39      void setBufferSize(const std::map<int,StdSize>& mapSize);
40   
41    private:
42
43      // Functions to set/get buffers
44//      bool getBuffers(const size_t timeLine, const list<int>& serverList, const list<int>& sizeList, list<CBufferOut*>& retBuffers, bool nonBlocking = false);
45      void newBuffer(int rank);
46      bool checkBuffers(list<int>& ranks);
47      bool checkBuffers(void);
48      void eventLoop(void) ;
49      void callGlobalEventLoop() ;
50      bool havePendingRequests(list<int>& ranks) ;
51
52
53
54      void setGrowableBuffer(void) { isGrowableBuffer_=true;}
55      void setFixedBuffer(void) { isGrowableBuffer_=false;}
56
57      size_t timeLine; //!< Timeline of each event
58
59      MPI_Comm interCommMerged_; //!< Communicator of the client group + server group (intraCommunicator) needed for one sided communication.
60      MPI_Comm commSelf_ ; //!< Communicator for proc alone from interCommMerged
61      map<int,COneSidedClientBuffer*> buffers; //!< Buffers for connection to servers
62
63      bool pureOneSided ; //!< if true, client will communicated with servers only trough one sided communication. Otherwise the hybrid mode P2P /One sided is used.
64
65    private:
66     
67      //! Mapping of server and buffer size for each connection to server
68      std::map<int,StdSize> mapBufferSize_;
69      //! Maximum event sizes estimated for each connection to server
70      std::map<int,StdSize> maxEventSizes;
71      //! Maximum number of events that can be buffered
72      StdSize maxBufferedEvents;
73
74      std::map<int, MPI_Comm> winComm_ ; //! Window communicators
75      std::map<int, MPI_Win >window_ ; //! one sided mpi windows to expose client buffers to servers == windows[nbServers][2]
76
77      bool isGrowableBuffer_ = true ;
78      double growingFactor_ = 1.25 ;
79
80      double latency_=0e-2 ;
81
82      bool locked_ = false ; //!< The context client is locked to avoid recursive checkBuffer
83  };
84}
85
86#endif // __ONE_SIDED_CONTEXT_CLIENT_HPP__
Note: See TracBrowser for help on using the repository browser.