source: XIOS/dev/dev_ym/XIOS_ONE_SIDED/src/context_server.hpp @ 1757

Last change on this file since 1757 was 1757, checked in by ymipsl, 5 years ago

Implement one sided communication in client/server protocol to avoid dead-lock when some buffer are full.

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.3 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
8namespace xios
9{
10  class CContext ;
11
12  class CContextServer
13  {
14    public:
15
16    CContextServer(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ;
17    bool eventLoop(bool enableEventsProcessing = true);
18    void listen(void) ;
19    bool listenPendingRequest(MPI_Status& status) ;
20    void checkPendingRequest(void) ;
21    void getBufferFromClient(size_t timeLine) ;
22    void processRequest(int rank, char* buff,int count) ;
23    void processEvents(void) ;
24    bool hasFinished(void);
25    void dispatchEvent(CEventServer& event) ;
26    void setPendingEvent(void) ;
27    bool hasPendingEvent(void) ;
28    bool isAttachedModeEnabled() const;
29    void releaseBuffers(void) ;
30    void notifyClientsFinalize(void) ;
31   
32    MPI_Comm intraComm ;
33    int intraCommSize ;
34    int intraCommRank ;
35
36    MPI_Comm interComm ;
37    int commSize ;
38
39    MPI_Comm interCommMerged; //!< Communicator of the client group + server group (intraCommunicator) needed for one sided communication.
40
41    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
42
43    map<int,CServerBuffer*> buffers ;
44    map<int,size_t> lastTimeLine ; //!< last event time line for a processed request
45    map<int,size_t>::iterator itLastTimeLine ; //!< iterator on lastTimeLine
46    map<int,MPI_Request> pendingRequest ;
47    map<int,char*> bufferRequest ;
48
49    map<size_t,CEventServer*> events ;
50    size_t currentTimeLine ;
51    CContext* context ;
52     
53    bool finished ;
54    bool pendingEvent ;
55    bool scheduled  ;    /*!< event of current timeline is alreading scheduled ? */
56    bool attachedMode ;  //! true if attached mode is enabled otherwise false
57    bool pureOneSided ; //!< if true, client will communicated with servers only trough one sided communication. Otherwise the hybrid mode P2P /One sided is used.
58         
59    size_t hashId ;
60
61    ~CContextServer() ;
62
63    private:
64      std::map<int, StdSize> mapBufferSize_;
65      vector<MPI_Win> windows ; //! one sided mpi windows to expose client buffers to servers ; No memory will be attached on server side.
66
67  } ;
68
69}
70
71#endif
Note: See TracBrowser for help on using the repository browser.