source: XIOS3/trunk/src/manager/servers_ressource.hpp @ 2547

Last change on this file since 2547 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.0 KB
Line 
1#ifndef __SERVERS_RESSOURCE_HPP__
2#define __SERVERS_RESSOURCE_HPP__
3
4#include "window_manager.hpp"
5#include "event_scheduler.hpp"
6#include "mpi.hpp"
7#include <vector>
8#include <string>
9
10
11
12namespace xios
13{
14
15  class CPoolRessource ;
16
17  class CServersRessource
18  {
19
20    const int NOTIFY_NOTHING=0 ;
21    const int NOTIFY_CREATE_POOL=1 ;
22    const int NOTIFY_FINALIZE=2 ;
23
24    public:
25   
26    CServersRessource(MPI_Comm serverComm) ;
27    ~CServersRessource() ;
28    void createPool(const string& poolId, const int size) ;
29    void createPool(void) ;
30    bool eventLoop(bool serviceOnly=false) ;
31    void sendNotification(int rank) ;
32    void notificationsDumpOut(CBufferOut& buffer) ;
33    void notificationsDumpIn(CBufferIn& buffer) ;
34    void checkNotifications(void) ;
35    CPoolRessource* getPoolRessource(void) { return poolRessource_; } 
36    const MPI_Comm& getCommunicator(void) { return serverComm_ ;}
37    bool isServerLeader(void) ;
38    void finalize(void) ;
39    void finalizeSignal(void) ;
40
41    const int localLeader_=0 ;
42    vector<int> freeRessourcesRank_ ; // only for leader
43    MPI_Comm serverComm_ ;
44    MPI_Comm freeRessourcesComm_ ;
45
46
47    const size_t maxBufferSize_=1024*1024 ;
48    CWindowManager* winNotify_ ;
49   
50    int notifyInType_,notifyOutType_ ;
51    std::tuple<std::string, bool> notifyInCreatePool_,notifyOutCreatePool_ ;
52    CPoolRessource* poolRessource_ ;
53    bool finalizeSignal_ ;
54
55    const double eventLoopLatency_=0; 
56    double lastEventLoop_=0. ;
57   
58    private:
59      bool finished_=false;
60    public:
61      bool isFinished(void) { return finished_ ;}
62    private:
63      void synchronize(void) ;
64      void threadEventLoop(void) ;
65      shared_ptr<CEventScheduler> eventScheduler_ ;
66      shared_ptr<CEventScheduler> freeRessourceEventScheduler_ ;
67      bool isFirstSplit_=true ;
68    public:
69      shared_ptr<CEventScheduler> getEventScheduler(void) { return eventScheduler_ ;}
70    friend class CWindowManager ;
71  } ;
72
73}
74
75
76
77#endif
Note: See TracBrowser for help on using the repository browser.