source: XIOS3/trunk/src/manager/pool_ressource.hpp @ 2545

Last change on this file since 2545 was 2523, checked in by ymipsl, 12 months ago

Adaptation to new hyper event scheduler.
YM

  • Property svn:executable set to *
File size: 3.3 KB
Line 
1#ifndef __POOL_RESSOURCE_HPP__
2#define __POOL_RESSOURCE_HPP__
3
4#include "mpi.hpp"
5#include "window_manager.hpp"
6#include "services_manager.hpp"
7#include "event_scheduler.hpp"
8
9
10namespace xios
11{
12 
13  class CService ;
14
15  class CPoolRessource 
16  {
17    private:
18     
19    const size_t maxBufferSize_=1024*1024 ;
20    const int localLeader_ = 0 ;
21
22    CWindowManager* winNotify_ ;
23   
24    private:
25    const int NOTIFY_NOTHING=0 ;
26    const int NOTIFY_CREATE_SERVICE=1 ;
27    const int NOTIFY_CREATE_SERVICE_ONTO=2 ;
28
29    public:
30    CPoolRessource(MPI_Comm poolComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& Id, bool isServer) ;
31    ~CPoolRessource() ;
32   
33    void createService(const std::string& serviceId, int type, int size, int nbPartition) ;
34    void createService(MPI_Comm serviceComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& serviceId, int partitionId, int type, int nbPartitions) ; 
35    void createServiceOnto(const std::string& serviceId, int type, const std::string& OnServiceId) ;
36    bool eventLoop(bool serviceOnly=false) ;
37    bool hasService(const std::string serviceId, int partitionId) {return services_.count(make_tuple(serviceId,partitionId))>0 ;}
38    CService* getService(const std::string serviceId, int partitionId) { return services_[make_tuple(serviceId,partitionId)]; }
39    void finalizeSignal(void) ;
40    string getId(void) { return Id_; }
41    const MPI_Comm& getCommunicator(void) { return poolComm_ ;}
42
43  private:
44    void createServiceNotify(int rank, const string& serviceId, int type, int size, int nbPartitions, bool in) ;
45    void createServiceOntoNotify(int rank, const string& serviceId, int type, const string& onServiceId) ;
46    void sendNotification(int rank) ;
47    void checkNotifications(void) ;
48    void notificationsDumpOut(CBufferOut& buffer) ;
49    void notificationsDumpIn(CBufferIn& buffer) ;
50    void createService(void) ;
51    void createServiceOnto(void) ;
52   
53//    void createServiceNotify(int rank, const std::string& serviceId, int type, int size, int nbPartitions, bool in) ;
54//    void createServiceDumpOut(CBufferOut& buffer) ;
55//    void createServiceDumpIn(CBufferIn& buffer) ;
56//    void checkCreateServiceNotification(void) ;
57    void createNewService(const std::string& serviceId, int type, int size, int nbPartitions, bool in) ;
58  public:
59    void createNewServiceOnto(const std::string& serviceId, int type, const string& onServiceId) ;
60   
61    private:
62    MPI_Comm poolComm_ ;
63   
64    std::multimap<int,int> occupancy_ ;
65
66//    std::list<std::tuple<std::string, int, int, int, bool> > notifications_;
67   
68    int notifyType_ ;
69    tuple<std::string, int, int, int, bool> notifyCreateService_ ;
70    tuple<std::string, int, std::string> notifyCreateServiceOnto_ ;
71
72
73    std::map< std::tuple<std::string, int>, CService*> services_ ;
74    std::string Id_ ;
75    bool finalizeSignal_ ;
76   
77    const double eventLoopLatency_=0; 
78    double lastEventLoop_=0. ;
79
80    private:
81      shared_ptr<CEventScheduler> eventScheduler_ ;
82      shared_ptr<CEventScheduler> freeRessourceEventScheduler_ ;
83      bool isFirstSplit_=true ;
84    public:
85      shared_ptr<CEventScheduler> getEventScheduler(void) { return eventScheduler_ ;}
86
87  };
88
89}
90
91
92
93#endif
Note: See TracBrowser for help on using the repository browser.