source: XIOS3/trunk/src/manager/services.hpp

Last change on this file 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: 2.9 KB
RevLine 
[1761]1#ifndef __SERVICE_HPP__
2#define __SERVICE_HPP__
3
4#include "xios_spl.hpp"
5#include "mpi.hpp"
6#include "services_manager.hpp"
7#include "event_scheduler.hpp"
8
9namespace xios
10{
11
12  class CServerContext ;
13
14  class CService
15  {
16    public:
17   
[1764]18    const int NOTIFY_NOTHING=0 ;
19    const int NOTIFY_CREATE_CONTEXT=1 ;
20
[2523]21    CService(MPI_Comm serviceComm, shared_ptr<CEventScheduler>, const std::string& poolId, const std::string& serviceId, const int& partitionId, 
22             int type, int nbPartitions) ;
[2274]23    ~CService() ;
24
[1764]25    bool eventLoop(bool serviceOnly=false) ;
[2547]26    void threadEventLoop(void) ;
[1761]27    void createContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ;
28    void checkCreateContextNotification(void) ;
29    void createContextNotify(int rank, const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ;
30    void createContextDumpOut(CBufferOut& buffer) ;
31    void createContextDumpIn(CBufferIn& buffer) ;
32    void createNewContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ;
33    CServerContext* getServerContext(const std::string& contextId) { return contexts_[contextId]; }
34    void finalizeSignal(void) ;
[2404]35    shared_ptr<CEventScheduler> getEventScheduler(void) ;
[1761]36
37    std::string getPoolId(void) {return poolId_;}
38    std::string getServiceId(void) {return serviceId_;}
39    int getPartitionId(void) {return partitionId_;}
40    int getType(void) {return type_;}
41    int getNbPartitions(void) {return nbPartitions_;}
[2404]42    const MPI_Comm& getCommunicator(void) { return serviceComm_ ;}
[2130]43   
[2547]44    private: 
45    bool finished_=false ;
46    public:
47    bool isFinished(void) { return finished_; }
48
[1761]49    private:
[1764]50    void sendNotification(int rank) ;
51    void notificationsDumpOut(CBufferOut& buffer) ;
52    void notificationsDumpIn(CBufferIn& buffer) ;
53    void checkNotifications(void) ;
54    void createContext(void) ;
55
[1761]56    MPI_Comm serviceComm_ ;
57    MPI_Comm globalComm_ ;
[1764]58
[1761]59    const size_t maxBufferSize_=1024*1024 ;
60    const int localLeader_=0 ;
61    int globalLeader_ ;
62    CWindowManager* winNotify_ ;
[1764]63   
64    std::string name_ ;
65
[1761]66    std::list<std::tuple<std::string, std::string, int, std::string>> notifications_;
[1764]67   
68    bool hasNotification_ ;
69    int notifyInType_,notifyOutType_ ;
70    std::tuple<std::string, std::string, int, std::string> notifyInCreateContext_, notifyOutCreateContext_ ;
71
[1761]72    std::map<std::string, CServerContext*> contexts_ ;
73    bool finalizeSignal_ ;
[2404]74    shared_ptr<CEventScheduler> eventScheduler_ ;
[1761]75
76    std::string poolId_ ;
77    std::string serviceId_ ;
78    int partitionId_ ;
79    int type_ ;
80    int nbPartitions_ ;
81
[2260]82    const double eventLoopLatency_=0; 
[2246]83    double lastEventLoop_=0. ;
84
[1761]85  };
86
87}
88
89
90
91#endif
Note: See TracBrowser for help on using the repository browser.