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
RevLine 
[300]1#ifndef __CONTEXT_SERVER_HPP__
[327]2#define __CONTEXT_SERVER_HPP__
[591]3#include "xios_spl.hpp"
[300]4#include "event_server.hpp"
5#include "buffer_server.hpp"
[382]6#include "mpi.hpp"
[1761]7#include "event_scheduler.hpp"
[300]8
[335]9namespace xios
[300]10{
[345]11  class CContext ;
[1853]12  class CContextClient;
[511]13
[300]14  class CContextServer
15  {
16    public:
[511]17
[1639]18    CContextServer(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ;
[1054]19    bool eventLoop(bool enableEventsProcessing = true);
[300]20    void listen(void) ;
[1639]21    bool listenPendingRequest(MPI_Status& status) ;
[300]22    void checkPendingRequest(void) ;
[1757]23    void getBufferFromClient(size_t timeLine) ;
[1158]24    void processRequest(int rank, char* buff,int count) ;
[300]25    void processEvents(void) ;
[1054]26    bool hasFinished(void);
[300]27    void dispatchEvent(CEventServer& event) ;
[2230]28    bool isCollectiveEvent(CEventServer& event) ;
[300]29    void setPendingEvent(void) ;
30    bool hasPendingEvent(void) ;
[1757]31    bool isAttachedModeEnabled() const;
32    void releaseBuffers(void) ;
33    void notifyClientsFinalize(void) ;
34   
[1639]35    MPI_Comm intraComm ;
[300]36    int intraCommSize ;
37    int intraCommRank ;
[511]38
[1639]39    MPI_Comm interComm ;
[300]40    int commSize ;
[511]41
[1757]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
[300]46    map<int,CServerBuffer*> buffers ;
[1757]47    map<int,size_t> lastTimeLine ; //!< last event time line for a processed request
48    map<int,size_t>::iterator itLastTimeLine ; //!< iterator on lastTimeLine
[1639]49    map<int,MPI_Request> pendingRequest ;
[300]50    map<int,char*> bufferRequest ;
[511]51
[300]52    map<size_t,CEventServer*> events ;
53    size_t currentTimeLine ;
[345]54    CContext* context ;
[697]55     
[300]56    bool finished ;
57    bool pendingEvent ;
[492]58    bool scheduled  ;    /*!< event of current timeline is alreading scheduled ? */
[1757]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         
[492]62    size_t hashId ;
[1054]63
[1853]64    void setAssociatedClient(CContextClient* associatedClient) {associatedClient_=associatedClient ;}
65    CContextClient* getAssociatedClient(void) { return associatedClient_ ;}
66
[511]67    ~CContextServer() ;
68
69    private:
[2230]70
[1158]71      std::map<int, StdSize> mapBufferSize_;
[1757]72      vector<MPI_Win> windows ; //! one sided mpi windows to expose client buffers to servers ; No memory will be attached on server side.
[1761]73      CEventScheduler* eventScheduler_ ;
[1764]74      bool isProcessingEvent_ ;
[1853]75      CContextClient* associatedClient_ ;
[2130]76      size_t remoteHashId_; //!< the hash is of the calling context client
[2230]77     
78      MPI_Comm processEventBarrier_ ;
79      bool eventScheduled_=false;
80      MPI_Request processEventRequest_ ;
[300]81  } ;
82
83}
84
85#endif
Note: See TracBrowser for help on using the repository browser.