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

Last change on this file since 2404 was 2404, checked in by ymipsl, 21 months ago

Add the possibility to launch a service on same ressource than an other.
YM

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