source: XIOS/dev/dev_olga/src/buffer_client.hpp @ 1077

Last change on this file since 1077 was 917, checked in by rlacroix, 8 years ago

Fix the client/server communication protocol.

In the some extreme cases a deadlock could occur. To fix this, the number of buffered events must be properly limited.

If you noticed decreased performance due to this commit, please let us know about it.

Fixes ticket #91.

  • 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: 852 bytes
Line 
1#ifndef __BUFFER_CLIENT_HPP__
2#define __BUFFER_CLIENT_HPP__
3
4#include "xios_spl.hpp"
5#include "buffer_out.hpp"
6#include "mpi.hpp"
7#include "cxios.hpp"
8
9namespace xios
10{
11  class CClientBuffer
12  {
13    public:
14      static size_t maxRequestSize;
15
16      CClientBuffer(MPI_Comm intercomm, int serverRank, StdSize bufferSize, StdSize maxBufferedEvents);
17      ~CClientBuffer();
18
19      bool isBufferFree(int size);
20      CBufferOut* getBuffer(int size);
21      bool checkBuffer(void);
22      bool hasPendingRequest(void);
23      int remain(void);
24
25    private:
26      char* buffer[2];
27
28      int current;
29      int count;
30      int bufferedEvents;
31      const int maxBufferedEvents;
32      const int bufferSize;
33      const int serverRank;
34      bool pending;
35
36      MPI_Request request;
37
38      CBufferOut* retBuffer;
39      const MPI_Comm interComm;
40  };
41}
42#endif
Note: See TracBrowser for help on using the repository browser.