source: XIOS3/trunk/src/transport/context_client.hpp @ 2401

Last change on this file since 2401 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: 4.0 KB
Line 
1#ifndef __CONTEXT_CLIENT_HPP__
2#define __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
13namespace xios
14{
15  class CContext;
16  class CContextServer ;
17  /*!
18  \class CContextClient
19  A context can be both on client and on server side. In order to differenciate the role of
20  context on each side, e.x client sending events, server receiving and processing events, there is a need of
21  concrete "context" classes for both sides.
22  CContextClient processes and sends events from client to server where CContextServer receives these events
23  and processes them.
24  */
25  class COneSidedContextClient ;
26
27  class CContextClient
28  {
29    public:
30      enum ETransport { generic, legacy, oneSided}  ;
31     
32      template<ETransport transport=generic> 
33      static CContextClient* getNew(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0) ;
34
35            // Contructor
36      CContextClient(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0);
37
38      bool isServerLeader(void) const;
39      bool isServerNotLeader(void) const;
40      const std::list<int>& getRanksServerLeader(void) const;
41      const std::list<int>& getRanksServerNotLeader(void) const;
42      bool isAttachedModeEnabled() const { return isAttached_ ; } 
43      static void computeLeader(int clientRank, int clientSize, int serverSize,
44                                std::list<int>& rankRecvLeader,
45                                std::list<int>& rankRecvNotLeader);
46      int getRemoteSize(void) {return serverSize;}
47      int getServerSize(void) {return serverSize;}
48      MPI_Comm getIntraComm(void)  {return intraComm ;} 
49      int getIntraCommSize(void) {return clientSize ;}
50      int getIntraCommRank(void) {return clientRank ;}
51      /*! set the associated server (dual chanel client/server) */     
52      void setAssociatedServer(CContextServer* associatedServer) { associatedServer=associatedServer_;}
53      /*! get the associated server (dual chanel client/server) */     
54      CContextServer* getAssociatedServer(void) { return associatedServer_;}
55     
56
57
58      // Send event to server
59      virtual void sendEvent(CEventClient& event)=0;
60      virtual void eventLoop(void)=0 ;
61      virtual void releaseBuffers(void)=0;
62      virtual bool havePendingRequests(void)=0;
63
64
65      virtual bool isNotifiedFinalized(void)=0 ;
66      virtual void finalize(void)=0;
67
68      virtual void setBufferSize(const std::map<int,StdSize>& mapSize)=0;
69
70
71    protected:
72
73      CContext* context_; //!< Context for client
74
75      CContext* parentServer; //!< Context for server (Only used in attached mode)
76
77      int clientRank; //!< Rank of current client
78
79      int clientSize; //!< Size of client group
80
81      int serverSize; //!< Size of server group
82
83      MPI_Comm interComm; //!< Communicator of server group (interCommunicator)
84
85      MPI_Comm intraComm; //!< Communicator of client group
86     
87      std::list<int> ranksServerLeader; //!< List of server ranks for which the client is leader
88
89      std::list<int> ranksServerNotLeader; //!< List of server ranks for which the client is not leader
90
91      size_t hashId_ ; //!< hash id on the context client that will be used for context server to identify the remote calling context client.
92
93      bool isAttached_ ;
94      CContextServer* associatedServer_ ; //!< The server associated to the pair client/server
95  };
96
97  template<>
98  CContextClient* CContextClient::getNew<CContextClient::generic>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer) ;
99 
100  template<>
101  CContextClient* CContextClient::getNew<CContextClient::oneSided>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer) ;
102
103  template<>
104  CContextClient* CContextClient::getNew<CContextClient::legacy>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer) ;
105
106
107}
108
109#endif // __CONTEXT_CLIENT_HPP__
Note: See TracBrowser for help on using the repository browser.