source: XIOS/dev/dev_ym/XIOS_COUPLING/src/context_server.hpp @ 2230

Last change on this file since 2230 was 2230, checked in by ymipsl, 3 years ago

Fix some Dead-lock issue...
YM

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 2.8 KB
Line 
1#ifndef __CONTEXT_SERVER_HPP__
2#define __CONTEXT_SERVER_HPP__
3#include "xios_spl.hpp"
4#include "event_server.hpp"
5#include "buffer_server.hpp"
6#include "mpi.hpp"
7#include "event_scheduler.hpp"
8
9namespace xios
10{
11  class CContext ;
12  class CContextClient;
13
14  class CContextServer
15  {
16    public:
17
18    CContextServer(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ;
19    bool eventLoop(bool enableEventsProcessing = true);
20    void listen(void) ;
21    bool listenPendingRequest(MPI_Status& status) ;
22    void checkPendingRequest(void) ;
23    void getBufferFromClient(size_t timeLine) ;
24    void processRequest(int rank, char* buff,int count) ;
25    void processEvents(void) ;
26    bool hasFinished(void);
27    void dispatchEvent(CEventServer& event) ;
28    bool isCollectiveEvent(CEventServer& event) ;
29    void setPendingEvent(void) ;
30    bool hasPendingEvent(void) ;
31    bool isAttachedModeEnabled() const;
32    void releaseBuffers(void) ;
33    void notifyClientsFinalize(void) ;
34   
35    MPI_Comm intraComm ;
36    int intraCommSize ;
37    int intraCommRank ;
38
39    MPI_Comm interComm ;
40    int commSize ;
41
42    MPI_Comm interCommMerged; //!< Communicator of the client group + server group (intraCommunicator) needed for one sided communication.
43
44    MPI_Comm commSelf; //!< Communicator of the server alone. Needed to create a new communicator between 1 proc client and 1 proc server for one sided communication
45
46    map<int,CServerBuffer*> buffers ;
47    map<int,size_t> lastTimeLine ; //!< last event time line for a processed request
48    map<int,size_t>::iterator itLastTimeLine ; //!< iterator on lastTimeLine
49    map<int,MPI_Request> pendingRequest ;
50    map<int,char*> bufferRequest ;
51
52    map<size_t,CEventServer*> events ;
53    size_t currentTimeLine ;
54    CContext* context ;
55     
56    bool finished ;
57    bool pendingEvent ;
58    bool scheduled  ;    /*!< event of current timeline is alreading scheduled ? */
59    bool attachedMode ;  //! true if attached mode is enabled otherwise false
60    bool pureOneSided ; //!< if true, client will communicated with servers only trough one sided communication. Otherwise the hybrid mode P2P /One sided is used.
61         
62    size_t hashId ;
63
64    void setAssociatedClient(CContextClient* associatedClient) {associatedClient_=associatedClient ;}
65    CContextClient* getAssociatedClient(void) { return associatedClient_ ;}
66
67    ~CContextServer() ;
68
69    private:
70
71      std::map<int, StdSize> mapBufferSize_;
72      vector<MPI_Win> windows ; //! one sided mpi windows to expose client buffers to servers ; No memory will be attached on server side.
73      CEventScheduler* eventScheduler_ ;
74      bool isProcessingEvent_ ;
75      CContextClient* associatedClient_ ;
76      size_t remoteHashId_; //!< the hash is of the calling context client
77     
78      MPI_Comm processEventBarrier_ ;
79      bool eventScheduled_=false;
80      MPI_Request processEventRequest_ ;
81  } ;
82
83}
84
85#endif
Note: See TracBrowser for help on using the repository browser.