[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" |
---|
[300] | 9 | |
---|
[335] | 10 | namespace xios |
---|
[300] | 11 | { |
---|
[2246] | 12 | class CServerBuffer : public CBufferClientServerBase |
---|
[300] | 13 | { |
---|
| 14 | public: |
---|
[1757] | 15 | CServerBuffer(vector<MPI_Win>& windows, vector<MPI_Aint>& winAddress, int windowsRank, StdSize bufSize) ; |
---|
[717] | 16 | ~CServerBuffer() ; |
---|
[509] | 17 | |
---|
[717] | 18 | bool isBufferFree(size_t count) ; |
---|
[2273] | 19 | bool isResizing(void) { return resizingBuffer_ ;} |
---|
[717] | 20 | void* getBuffer(size_t count) ; |
---|
| 21 | void freeBuffer(size_t count) ; |
---|
[2309] | 22 | void popBuffer(size_t count) ; |
---|
[1757] | 23 | void createWindows(MPI_Comm oneSidedComm) ; |
---|
| 24 | bool getBufferFromClient(size_t timeLine, char* & buffer, size_t& count) ; |
---|
| 25 | bool isBufferEmpty(void) ; |
---|
| 26 | void updateCurrentWindows(void) ; |
---|
| 27 | void lockBuffer(void) ; |
---|
| 28 | void unlockBuffer(void) ; |
---|
| 29 | void notifyClientFinalize(void) ; |
---|
[2246] | 30 | void notifyBufferResizing(void) ; |
---|
[2309] | 31 | size_t getUsed(void) { return used ;} |
---|
[717] | 32 | private: |
---|
| 33 | char* buffer; |
---|
| 34 | size_t first; // first occupied element |
---|
| 35 | size_t current; // first free element |
---|
| 36 | size_t end; |
---|
| 37 | size_t size; |
---|
[1757] | 38 | size_t used ; // count of element occupied |
---|
| 39 | std::vector<MPI_Win> windows_ ; |
---|
| 40 | std::vector<MPI_Aint> winAddress_ ; |
---|
[2130] | 41 | bool resizingBuffer_ = false ; |
---|
[1757] | 42 | int currentWindows ; |
---|
| 43 | bool hasWindows ; |
---|
| 44 | int windowsRank_ ; |
---|
[2260] | 45 | double bufferFromClientLatency_=0e-1 ; |
---|
[2246] | 46 | double bufferFromClientTime_ = 0; |
---|
| 47 | |
---|
[717] | 48 | }; |
---|
[300] | 49 | } |
---|
| 50 | |
---|
| 51 | #endif |
---|