source: XIOS3/trunk/src/event_server.cpp @ 2628

Last change on this file since 2628 was 2343, checked in by ymipsl, 2 years ago
  • Implement new infrastructure for transfert protocol.
  • new purelly one sided protocol is now available, the previous protocol (legacy, mix send/recv and one sided) is still available. Other specific protocol could be implemented more easilly in future.
  • switch can be operate with "transport_protocol" variable in XIOS context :

ex:
<variable id="transport_protocol" type="string">one_sided</variable>

Available protocols are : one_sided, legacy or default. The default protocol is "legacy".

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
  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1#include "xios_spl.hpp"
2#include "buffer_in.hpp"
3#include "type.hpp"
4#include "event_server.hpp"
5#include "buffer_server.hpp"
6
7namespace xios
8{
9  void CEventServer::push(int rank, CServerBuffer* serverBuffer, char* startBuffer, int size)
10  {
11    CBufferIn buffer(startBuffer, size);
12    size_t timeLine;
13    int myClassId, myType, myNbSender;
14 
15    buffer >> size >> timeLine >> myNbSender >> myClassId >> myType;
16 
17    if (subEvents.empty())
18    { 
19      nbSender = myNbSender;
20      classId = myClassId;
21      type = myType;
22    }
23    else
24    {
25      if (classId != myClassId || type != myType || nbSender != myNbSender)
26        ERROR("void CEventServer::push(int rank, CServerBuffer* serverBuffer, char* startBuffer, int size)",
27              << "The callers of event " << timeLine << " are not coherent." << std::endl
28              << "Received subevent: classId = " << myClassId << ", type = " << myType << ", nbSender = " << myNbSender << std::endl
29              << "Expected subevent: classId = " << classId << ", type = " << type << ", nbSender = " << nbSender);
30    }
31
32    SSubEvent ev;
33    ev.rank = rank;
34    ev.serverBuffer = serverBuffer;
35    ev.buffer = new CBufferIn(buffer.ptr(), buffer.remain());
36    ev.size = size; 
37    ev.startBuffer = startBuffer ; // for one sided, take ownership of buffer for now
38    subEvents.push_back(ev);
39 
40    if (subEvents.size() > nbSender)
41    {
42        ERROR("void CEventServer::push(int rank, CServerBuffer* serverBuffer, char* startBuffer, int size)",
43              << "The callers of event " << timeLine << " are not coherent." << std::endl
44              << "Too many subevents have been received (" << subEvents.size() << " instead of " << nbSender << ").");
45    }
46  }
47
48
49  bool CEventServer::isFull(void) 
50  {
51    return (nbSender == subEvents.size());
52  }
53
54  CEventServer::~CEventServer()
55  {
56    list<SSubEvent>::iterator it;
57    for (it = subEvents.begin(); it != subEvents.end(); it++)
58    {
59      if (it->serverBuffer==nullptr) // one_sided case
60      {
61        delete [] it->startBuffer ;
62        delete it->buffer;
63      }
64      else // legacy case
65      {
66        it->serverBuffer->freeBuffer(it->size);
67        delete it->buffer;
68      }
69    }
70  }
71}
Note: See TracBrowser for help on using the repository browser.