Last change
on this file since 2121 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:
1.5 KB
|
Rev | Line | |
---|
[300] | 1 | #ifndef __BUFFER_CLIENT_HPP__ |
---|
| 2 | #define __BUFFER_CLIENT_HPP__ |
---|
| 3 | |
---|
[591] | 4 | #include "xios_spl.hpp" |
---|
[300] | 5 | #include "buffer_out.hpp" |
---|
[382] | 6 | #include "mpi.hpp" |
---|
[509] | 7 | #include "cxios.hpp" |
---|
[300] | 8 | |
---|
[335] | 9 | namespace xios |
---|
[300] | 10 | { |
---|
| 11 | class CClientBuffer |
---|
| 12 | { |
---|
| 13 | public: |
---|
[732] | 14 | static size_t maxRequestSize; |
---|
[509] | 15 | |
---|
[1757] | 16 | CClientBuffer(MPI_Comm intercomm, vector<MPI_Win>& windows, int clientRank, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize); |
---|
[732] | 17 | ~CClientBuffer(); |
---|
[1757] | 18 | // void createWindows(MPI_Comm oneSidedComm) ; |
---|
| 19 | void freeWindows(void) ; |
---|
| 20 | void lockBuffer(void) ; |
---|
| 21 | void unlockBuffer(void) ; |
---|
| 22 | |
---|
[1227] | 23 | bool isBufferFree(StdSize size); |
---|
[1757] | 24 | CBufferOut* getBuffer(size_t timeLine, StdSize size); |
---|
| 25 | bool checkBuffer(bool send=false); |
---|
[732] | 26 | bool hasPendingRequest(void); |
---|
[1227] | 27 | StdSize remain(void); |
---|
[1757] | 28 | MPI_Aint getWinAddress(int numWindows) ; |
---|
| 29 | void infoBuffer(void) ; |
---|
| 30 | bool isNotifiedFinalized(void) ; |
---|
[732] | 31 | private: |
---|
| 32 | char* buffer[2]; |
---|
[1757] | 33 | char* bufferHeader[2]; |
---|
| 34 | size_t* firstTimeLine[2] ; |
---|
| 35 | size_t* bufferCount[2] ; |
---|
| 36 | size_t* control[2] ; |
---|
| 37 | size_t* finalize[2] ; |
---|
| 38 | bool winState[2] ; |
---|
[732] | 39 | int current; |
---|
[1227] | 40 | |
---|
| 41 | StdSize count; |
---|
| 42 | StdSize maxEventSize; |
---|
| 43 | const StdSize bufferSize; |
---|
| 44 | const StdSize estimatedMaxEventSize; |
---|
| 45 | |
---|
| 46 | |
---|
[917] | 47 | const int serverRank; |
---|
[1757] | 48 | const int clientRank_; |
---|
[732] | 49 | bool pending; |
---|
[509] | 50 | |
---|
[1639] | 51 | MPI_Request request; |
---|
[509] | 52 | |
---|
[732] | 53 | CBufferOut* retBuffer; |
---|
[1639] | 54 | const MPI_Comm interComm; |
---|
[1757] | 55 | std::vector<MPI_Win> windows_ ; |
---|
| 56 | bool hasWindows ; |
---|
| 57 | static const int headerSize=4*sizeof(size_t); |
---|
[732] | 58 | }; |
---|
[300] | 59 | } |
---|
| 60 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.