source: XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/server_context.hpp @ 2130

Last change on this file since 2130 was 2130, checked in by ymipsl, 3 years ago

New management of client-server buffers.

  • buffers can grow automatically in intialization phase
  • buffers is evaluated after the close context definition phase and fixed at optimal value.

YM

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#ifndef __SERVER_CONTEXT_HPP__
2#define __SERVER_CONTEXT_HPP__
3#include "xios_spl.hpp"
4#include "window_manager.hpp"
5#include "mpi.hpp"
6
7namespace xios
8{
9  class CContext ;
10  class CService ;
11
12  class CServerContext
13  {
14    const int NOTIFY_NOTHING=0 ;
15    const int NOTIFY_CREATE_INTERCOMM=1 ;
16   
17    public:
18    CServerContext(CService* parentService, MPI_Comm contextComm, const std::string& poolId, const std::string& serviceId, 
19                  const int& partitionId, const std::string& contextId) ;
20    ~CServerContext() ;
21
22    bool createIntercomm(const string& poolId, const string& serviceId, const int& partitionId, const string& contextId, 
23                         const MPI_Comm& intraComm, MPI_Comm& interCommClient, MPI_Comm& interCommServer, bool wait=true) ;
24    void createIntercomm(int remoteLeader, const string& sourceContext) ;
25
26    void sendNotification(int rank); 
27    void checkNotifications(void) ;
28
29    bool eventLoop(bool serviceOnly=false) ;
30    void notificationsDumpOut(CBufferOut& buffer) ;
31    void notificationsDumpIn(CBufferIn& buffer) ;
32    void finalizeSignal(void) ;
33    void freeComm(void) ;
34    bool isAttachedMode(void) { return isAttachedMode_ ;}
35    CService* getParentService(void) {return parentService_ ; }
36
37    private:
38    void createIntercomm(void) ;
39   
40    static std::map<std::string, std::tuple<bool, MPI_Comm, MPI_Comm> > overlapedComm_ ;
41
42    MPI_Comm contextComm_ ;
43    MPI_Comm xiosComm_ ;
44
45    CContext* context_ ;
46    CService* parentService_ ;
47    std::string name_ ;
48
49    vector<MPI_Comm> clientsInterComm_ ;
50
51
52    const size_t maxBufferSize_=1024*1024 ;
53    CWindowManager* winNotify_ ;
54    int notifyInType_, notifyOutType_ ;
55    tuple<int, std::string> notifyInCreateIntercomm_, notifyOutCreateIntercomm_ ;
56
57    const int localLeader_=0 ;
58    int globalLeader_ ;
59    bool finalizeSignal_ ;
60    bool hasNotification_ ;
61    bool isAttachedMode_ ;
62
63    friend class CWindowManager ;
64  } ;
65
66}
67
68#endif
Note: See TracBrowser for help on using the repository browser.