source: XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/services_manager.hpp @ 2246

Last change on this file since 2246 was 2246, checked in by ymipsl, 3 years ago
  • Update of the tranfer protocol using one sided communication
  • Introduce MPI_Improb/MPI_mrecv to listen incomming request
  • Introducing latency when looping over managers

YM

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#ifndef __SERVICES_MANAGER_HPP__
2#define __SERVICES_MANAGER_HPP__
3
4#include "xios_spl.hpp"
5#include "mpi.hpp"
6#include "buffer_in.hpp"
7#include "buffer_out.hpp"
8
9#include <string>
10#include <map>
11#include "window_manager.hpp"
12
13
14
15namespace xios
16{
17  class CServicesManager
18  {
19
20    public: 
21    static const int CLIENT=0 ;
22    static const int GATHERER=1 ;
23    static const int IO_SERVER=2 ;
24    static const int OUT_SERVER=3 ;
25
26    public:
27   
28    CServicesManager(bool isXiosServer) ;
29    ~CServicesManager() ;
30   
31    bool createServices(const std::string& poolId, const std::string& serviceId, int type, int size, int nbPartition, bool wait=true) ;
32    void createServicesNotify(int rank, const string& serviceId, int type, int size, int nbPartitions) ;
33    void checkCreateServicesNotification(void) ;
34    void eventLoop(void) ;
35    void notificationsDumpOut(CBufferOut& buffer) ;
36    void notificationsDumpIn(CBufferIn& buffer) ;
37   
38    void registerService(const std::string& poolId, const std::string& serviceId, const int& partitionId, int type, int size, int nbPartitions, int leader) ;
39    bool getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, int& size, int& nbPartition, int& leader) ;
40    bool getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader) ;
41    bool getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type) ;
42    bool getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartition) ;
43    bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ;
44    void servicesDumpOut(CBufferOut& buffer) ;
45    void servicesDumpIn(CBufferIn& buffer) ;
46   
47
48    private :
49   
50    CWindowManager* winServices_ ;
51    CWindowManager* winNotify_ ;
52    const size_t maxBufferSize_=1024*1024 ;
53
54    MPI_Comm xiosComm_ ;
55
56    std::list<std::tuple<std::string, int, int, int> > notifications_;
57   
58    std::map<tuple<std::string, std::string, int>, std::tuple<int, int, int, int> > services_ ;
59
60    int managerGlobalLeader_ ;
61
62    const double eventLoopLatency_=1e-2; 
63    double lastEventLoop_=0. ;
64   
65    friend class CWindowManager ;
66  } ;
67
68
69}
70
71
72
73#endif
Note: See TracBrowser for help on using the repository browser.