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

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

One sided protocol improvment.
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: 3.0 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    bool listenPendingRequest(MPI_Message &message, MPI_Status& status) ;
23    void checkPendingProbe(void) ;
24    void checkPendingRequest(void) ;
25    void getBufferFromClient(size_t timeLine) ;
26    void processRequest(int rank, char* buff,int count) ;
27    void processEvents(void) ;
28    bool hasFinished(void);
29    void dispatchEvent(CEventServer& event) ;
30    bool isCollectiveEvent(CEventServer& event) ;
31    void setPendingEvent(void) ;
32    bool hasPendingEvent(void) ;
33    bool isAttachedModeEnabled() const;
34    void releaseBuffers(void) ;
35    void notifyClientsFinalize(void) ;
36    void freeWindows(void) ; // !<< free Windows for one sided communication
37   
38    MPI_Comm intraComm ;
39    int intraCommSize ;
40    int intraCommRank ;
41
42    MPI_Comm interComm ;
43    int commSize ;
44    int clientSize_ ;
45
46    MPI_Comm interCommMerged; //!< Communicator of the client group + server group (intraCommunicator) needed for one sided communication.
47
48    map<int,CServerBuffer*> buffers ;
49    map<int,size_t> lastTimeLine ; //!< last event time line for a processed request
50    map<int,size_t>::iterator itLastTimeLine ; //!< iterator on lastTimeLine
51    map<int, list<std::pair<MPI_Message,MPI_Status> > > pendingProbe;
52    map<int,MPI_Request> pendingRequest ;
53    map<int,char*> bufferRequest ;
54
55    map<size_t,CEventServer*> events ;
56    size_t currentTimeLine ;
57    CContext* context ;
58     
59    bool finished ;
60    bool pendingEvent ;
61    bool scheduled  ;    /*!< event of current timeline is alreading scheduled ? */
62    bool attachedMode ;  //! true if attached mode is enabled otherwise false
63    bool pureOneSided ; //!< if true, client will communicated with servers only trough one sided communication. Otherwise the hybrid mode P2P /One sided is used.
64         
65    size_t hashId ;
66
67    void setAssociatedClient(CContextClient* associatedClient) {associatedClient_=associatedClient ;}
68    CContextClient* getAssociatedClient(void) { return associatedClient_ ;}
69
70    ~CContextServer() ;
71
72    private:
73
74      std::map<int, StdSize> mapBufferSize_;
75      std::vector<MPI_Comm>winComm_ ; //! Window communicators
76      std::vector<std::vector<MPI_Win> >windows_ ; //! one sided mpi windows to expose client buffers to servers ; No memory will be attached on server side.
77      CEventScheduler* eventScheduler_ ;
78      bool isProcessingEvent_ ;
79      CContextClient* associatedClient_ ;
80      size_t remoteHashId_; //!< the hash is of the calling context client
81     
82      MPI_Comm processEventBarrier_ ;
83      bool eventScheduled_=false;
84      MPI_Request processEventRequest_ ;
85  } ;
86
87}
88
89#endif
Note: See TracBrowser for help on using the repository browser.