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

Last change on this file since 1853 was 1853, checked in by ymipsl, 4 years ago

Coupling branch : replace hasServer and hasClient combination by the name of correct service : CLIENT, GATHERER or OUT_SERVER.

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.6 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    void setPendingEvent(void) ;
29    bool hasPendingEvent(void) ;
30    bool isAttachedModeEnabled() const;
31    void releaseBuffers(void) ;
32    void notifyClientsFinalize(void) ;
33   
34    MPI_Comm intraComm ;
35    int intraCommSize ;
36    int intraCommRank ;
37
38    MPI_Comm interComm ;
39    int commSize ;
40
41    MPI_Comm interCommMerged; //!< Communicator of the client group + server group (intraCommunicator) needed for one sided communication.
42
43    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
44
45    map<int,CServerBuffer*> buffers ;
46    map<int,size_t> lastTimeLine ; //!< last event time line for a processed request
47    map<int,size_t>::iterator itLastTimeLine ; //!< iterator on lastTimeLine
48    map<int,MPI_Request> pendingRequest ;
49    map<int,char*> bufferRequest ;
50
51    map<size_t,CEventServer*> events ;
52    size_t currentTimeLine ;
53    CContext* context ;
54     
55    bool finished ;
56    bool pendingEvent ;
57    bool scheduled  ;    /*!< event of current timeline is alreading scheduled ? */
58    bool attachedMode ;  //! true if attached mode is enabled otherwise false
59    bool pureOneSided ; //!< if true, client will communicated with servers only trough one sided communication. Otherwise the hybrid mode P2P /One sided is used.
60         
61    size_t hashId ;
62
63    void setAssociatedClient(CContextClient* associatedClient) {associatedClient_=associatedClient ;}
64    CContextClient* getAssociatedClient(void) { return associatedClient_ ;}
65
66    ~CContextServer() ;
67
68    private:
69      std::map<int, StdSize> mapBufferSize_;
70      vector<MPI_Win> windows ; //! one sided mpi windows to expose client buffers to servers ; No memory will be attached on server side.
71      CEventScheduler* eventScheduler_ ;
72      bool isProcessingEvent_ ;
73      CContextClient* associatedClient_ ;
74  } ;
75
76}
77
78#endif
Note: See TracBrowser for help on using the repository browser.