source: XIOS/dev/dev_ym/XIOS_COUPLING/src/transport/legacy_context_client.hpp @ 2343

Last change on this file since 2343 was 2343, checked in by ymipsl, 2 years ago
  • Implement new infrastructure for transfert protocol.
  • new purelly one sided protocol is now available, the previous protocol (legacy, mix send/recv and one sided) is still available. Other specific protocol could be implemented more easilly in future.
  • switch can be operate with "transport_protocol" variable in XIOS context :

ex:
<variable id="transport_protocol" type="string">one_sided</variable>

Available protocols are : one_sided, legacy or default. The default protocol is "legacy".

YM

  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#ifndef __LEGACY_CONTEXT_CLIENT_HPP__
2#define __LEGACY_CONTEXT_CLIENT_HPP__
3
4#include "xios_spl.hpp"
5#include "buffer_out.hpp"
6#include "buffer_in.hpp"
7#include "buffer_client.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 CLegacyContextClient
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  CLegacyContextClient processes and sends events from client to server where CContextServer receives these events
24  and processes them.
25  */
26  class CLegacyContextClient : public CContextClient
27  {
28    public:
29      // Contructor
30      CLegacyContextClient(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0);
31
32      // Send event to server
33      void sendEvent(CEventClient& event);
34      void eventLoop(void) ;
35      void releaseBuffers(void);
36      bool havePendingRequests(void);
37
38      bool isNotifiedFinalized(void) ;
39      void finalize(void);
40
41      void setBufferSize(const std::map<int,StdSize>& mapSize);
42
43
44    private:
45
46      // Functions to set/get buffers
47      bool getBuffers(const size_t timeLine, const list<int>& serverList, const list<int>& sizeList, list<CBufferOut*>& retBuffers, bool nonBlocking = false);
48      void newBuffer(int rank);
49      bool checkBuffers(list<int>& ranks);
50      bool checkBuffers(void);
51      void callGlobalEventLoop() ;
52      bool havePendingRequests(list<int>& ranks) ;
53      void setGrowableBuffer(void) { isGrowableBuffer_=true;}
54      void setFixedBuffer(void) { isGrowableBuffer_=false;}
55      void lockBuffers(list<int>& ranks) ;
56      void unlockBuffers(list<int>& ranks) ;
57
58
59      size_t timeLine; //!< Timeline of each event
60
61      MPI_Comm interCommMerged_; //!< Communicator of the client group + server group (intraCommunicator) needed for one sided communication.
62      MPI_Comm commSelf_ ; //!< Communicator for proc alone from interCommMerged
63
64      map<int,CClientBuffer*> buffers; //!< Buffers for connection to servers
65
66      bool pureOneSided ; //!< if true, client will communicated with servers only trough one sided communication. Otherwise the hybrid mode P2P /One sided is used.
67     
68      //! Mapping of server and buffer size for each connection to server
69      std::map<int,StdSize> mapBufferSize_;
70      //! Maximum event sizes estimated for each connection to server
71      std::map<int,StdSize> maxEventSizes;
72      //! Maximum number of events that can be buffered
73      StdSize maxBufferedEvents;
74
75      std::map<int, MPI_Comm> winComm_ ; //! Window communicators
76      std::map<int, std::vector<MPI_Win> >windows_ ; //! one sided mpi windows to expose client buffers to servers == windows[nbServers][2]
77      bool isGrowableBuffer_ = true ;
78
79      double latency_=0e-2 ;
80
81      bool locked_ = false ; //!< The context client is locked to avoid recursive checkBuffer
82  };
83}
84
85#endif // __LEGACY_CONTEXT_CLIENT_HPP__
Note: See TracBrowser for help on using the repository browser.