[300] | 1 | #ifndef __BUFFER_SERVER_HPP__ |
---|
| 2 | #define __BUFFER_SERVER_HPP__ |
---|
| 3 | |
---|
[2246] | 4 | #include "buffer_cs_base.hpp" |
---|
[591] | 5 | #include "xios_spl.hpp" |
---|
[342] | 6 | #include "buffer.hpp" |
---|
[382] | 7 | #include "mpi.hpp" |
---|
[509] | 8 | #include "cxios.hpp" |
---|
[2547] | 9 | #include "window_dynamic.hpp" |
---|
[300] | 10 | |
---|
[2547] | 11 | |
---|
[335] | 12 | namespace xios |
---|
[300] | 13 | { |
---|
[2246] | 14 | class CServerBuffer : public CBufferClientServerBase |
---|
[300] | 15 | { |
---|
| 16 | public: |
---|
[2558] | 17 | CServerBuffer(int clientRank, vector<CWindowDynamic*>& windows, vector<MPI_Aint>& winAddress, int windowsRank, StdSize bufSize) ; |
---|
[717] | 18 | ~CServerBuffer() ; |
---|
[509] | 19 | |
---|
[717] | 20 | bool isBufferFree(size_t count) ; |
---|
[2273] | 21 | bool isResizing(void) { return resizingBuffer_ ;} |
---|
[717] | 22 | void* getBuffer(size_t count) ; |
---|
| 23 | void freeBuffer(size_t count) ; |
---|
[2309] | 24 | void popBuffer(size_t count) ; |
---|
[1757] | 25 | void createWindows(MPI_Comm oneSidedComm) ; |
---|
| 26 | bool getBufferFromClient(size_t timeLine, char* & buffer, size_t& count) ; |
---|
| 27 | bool isBufferEmpty(void) ; |
---|
| 28 | void updateCurrentWindows(void) ; |
---|
| 29 | void lockBuffer(void) ; |
---|
| 30 | void unlockBuffer(void) ; |
---|
| 31 | void notifyClientFinalize(void) ; |
---|
[2246] | 32 | void notifyBufferResizing(void) ; |
---|
[2309] | 33 | size_t getUsed(void) { return used ;} |
---|
[717] | 34 | private: |
---|
| 35 | char* buffer; |
---|
| 36 | size_t first; // first occupied element |
---|
| 37 | size_t current; // first free element |
---|
| 38 | size_t end; |
---|
| 39 | size_t size; |
---|
[1757] | 40 | size_t used ; // count of element occupied |
---|
[2547] | 41 | std::vector<CWindowDynamic*> windows_ ; |
---|
[1757] | 42 | std::vector<MPI_Aint> winAddress_ ; |
---|
[2130] | 43 | bool resizingBuffer_ = false ; |
---|
[1757] | 44 | int currentWindows ; |
---|
| 45 | bool hasWindows ; |
---|
[2558] | 46 | int clientRank_ ; // for debugging |
---|
[1757] | 47 | int windowsRank_ ; |
---|
[2323] | 48 | double bufferFromClientLatency_=1e-1 ; |
---|
[2246] | 49 | double bufferFromClientTime_ = 0; |
---|
| 50 | |
---|
[717] | 51 | }; |
---|
[300] | 52 | } |
---|
| 53 | |
---|
| 54 | #endif |
---|