source: XIOS3/trunk/src/transport/one_sided_context_client.hpp @ 2571

Last change on this file since 2571 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 svn:executable set to *
File size: 3.3 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      void yield() ;
51      void synchronize() ;
52      bool havePendingRequests(list<int>& ranks) ;
53
54
55
56      void setGrowableBuffer(void) { isGrowableBuffer_=true;}
57      void setFixedBuffer(void) { isGrowableBuffer_=false;}
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      map<int,COneSidedClientBuffer*> buffers; //!< Buffers for connection to servers
64
65      bool pureOneSided ; //!< if true, client will communicated with servers only trough one sided communication. Otherwise the hybrid mode P2P /One sided is used.
66
67    private:
68     
69      //! Mapping of server and buffer size for each connection to server
70      std::map<int,StdSize> mapBufferSize_;
71      //! Maximum event sizes estimated for each connection to server
72      std::map<int,StdSize> maxEventSizes;
73      //! Maximum number of events that can be buffered
74      StdSize maxBufferedEvents;
75
76      std::map<int, MPI_Comm> winComm_ ; //! Window communicators
77      std::map<int, MPI_Win >window_ ; //! one sided mpi windows to expose client buffers to servers == windows[nbServers][2]
78
79      bool isGrowableBuffer_ = true ;
80      double growingFactor_ = 1.25 ;
81
82      double latency_=0e-2 ;
83
84      bool locked_ = false ; //!< The context client is locked to avoid recursive checkBuffer
85      shared_ptr<CEventScheduler> eventScheduler_ ;
86  };
87}
88
89#endif // __ONE_SIDED_CONTEXT_CLIENT_HPP__
Note: See TracBrowser for help on using the repository browser.