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 | |
---|
8 | namespace 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 |
---|