Ignore:
Timestamp:
10/18/19 14:55:57 (5 years ago)
Author:
ymipsl
Message:

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

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_ONE_SIDED/src/context_client.hpp

    r1639 r1757  
    3131      // Send event to server 
    3232      void sendEvent(CEventClient& event); 
    33       bool sendTemporarilyBufferedEvent(); 
    3433      void waitEvent(list<int>& ranks); 
    3534 
    3635      // Functions to set/get buffers 
    37       bool getBuffers(const list<int>& serverList, const list<int>& sizeList, list<CBufferOut*>& retBuffers, bool nonBlocking = false); 
     36      bool getBuffers(const size_t timeLine, const list<int>& serverList, const list<int>& sizeList, list<CBufferOut*>& retBuffers, bool nonBlocking = false); 
    3837      void newBuffer(int rank); 
    3938      bool checkBuffers(list<int>& ranks); 
     
    4847 
    4948      bool isAttachedModeEnabled() const; 
    50       bool hasTemporarilyBufferedEvent() const { return !tmpBufferedEvent.isEmpty(); }; 
    5149 
    5250      static void computeLeader(int clientRank, int clientSize, int serverSize, 
     
    5654      // Close and finalize context client 
    5755//      void closeContext(void);  Never been implemented. 
     56      bool isNotifiedFinalized(void) ; 
    5857      void finalize(void); 
    5958 
     
    7170      int serverSize; //!< Size of server group 
    7271 
    73       MPI_Comm interComm; //!< Communicator of server group 
     72      MPI_Comm interComm; //!< Communicator of server group (interCommunicator) 
     73 
     74      MPI_Comm interCommMerged; //!< Communicator of the client group + server group (intraCommunicator) needed for one sided communication. 
    7475 
    7576      MPI_Comm intraComm; //!< Communicator of client group 
    7677 
     78      MPI_Comm commSelf; //!< Communicator of the client alone. Needed to create a new communicator between 1 proc client and 1 proc server for one sided communication 
     79 
    7780      map<int,CClientBuffer*> buffers; //!< Buffers for connection to servers 
    7881 
     82      bool pureOneSided ; //!< if true, client will communicated with servers only trough one sided communication. Otherwise the hybrid mode P2P /One sided is used. 
     83 
    7984    private: 
     85      void lockBuffers(list<int>& ranks) ; 
     86      void unlockBuffers(list<int>& ranks) ; 
     87       
    8088      //! Mapping of server and buffer size for each connection to server 
    8189      std::map<int,StdSize> mapBufferSize_; 
     
    8492      //! Maximum number of events that can be buffered 
    8593      StdSize maxBufferedEvents; 
    86  
    87       struct { 
    88         std::list<int> ranks, sizes; 
    89         std::list<CBufferOut*> buffers; 
    90  
    91         bool isEmpty() const { return ranks.empty(); }; 
    92         void clear() { 
    93           ranks.clear(); 
    94           sizes.clear(); 
    95  
    96           for (std::list<CBufferOut*>::iterator it = buffers.begin(); it != buffers.end(); it++) 
    97             delete *it; 
    98  
    99           buffers.clear(); 
    100         }; 
    101       } tmpBufferedEvent; //! Event temporarily buffered (used only on the server) 
    10294 
    10395      //! Context for server (Only used in attached mode) 
     
    110102      std::list<int> ranksServerNotLeader; 
    111103 
     104      std::vector<std::vector<MPI_Win> >windows ; //! one sided mpi windows to expose client buffers to servers == windows[nbServers][2] 
     105 
     106 
    112107  }; 
    113108} 
Note: See TracChangeset for help on using the changeset viewer.