Ignore:
Timestamp:
05/15/17 15:00:24 (7 years ago)
Author:
oabramkina
Message:

Two-level server: merging new grid functionalities and changes in the communication protocol (e.g. non-blocking context finalize, registries, oasis).

Tests on curie: test_client, test_complete, nemo (test_xios2_cmip6.exe).

To do: non-structured grid, check reading, possible bug in client/server initialization (?).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/context_client.cpp

    r1077 r1130  
    1111#include "timer.hpp" 
    1212#include "cxios.hpp" 
     13#include "server.hpp" 
    1314 
    1415namespace xios 
     
    8990        list<int> sizes = event.getSizes(); 
    9091 
    91         // We force the getBuffers call to be non-blocking on the servers 
     92        // We force the getBuffers call to be non-blocking on classical servers 
    9293        list<CBufferOut*> buffList; 
    93 //        bool couldBuffer = getBuffers(ranks, sizes, buffList, CXios::isServer); 
    94         bool couldBuffer = getBuffers(ranks, sizes, buffList, false); 
     94        bool couldBuffer = getBuffers(ranks, sizes, buffList, (!CXios::isClient && (CServer::serverLevel == 0) )); 
     95        //bool couldBuffer = getBuffers(ranks, sizes, buffList, false ); 
    9596 
    9697        if (couldBuffer) 
     
    212213        { 
    213214          checkBuffers(); 
    214  
    215          // WHY DO WE PUT HERE SERVER INTO LISTENING LOOP AT ALL???? 
    216 //            context->server->listen(); 
    217 //            for (int i = 0; i < context->serverPrimServer.size(); ++i) 
    218 //              context->serverPrimServer[i]->listen(); 
     215          if (CServer::serverLevel == 0) 
     216            context->server->listen(); 
     217 
     218          else if (CServer::serverLevel == 1) 
     219          { 
     220            context->server->listen(); 
     221            for (int i = 0; i < context->serverPrimServer.size(); ++i) 
     222              context->serverPrimServer[i]->listen(); 
     223          } 
     224 
     225          else if (CServer::serverLevel == 2) 
     226            context->server->listen(); 
     227 
    219228        } 
    220229      } while (!areBuffersFree && !nonBlocking); 
     230 
    221231      CTimer::get("Blocking time").suspend(); 
    222232 
     
    256266      map<int,CClientBuffer*>::iterator itBuff; 
    257267      bool pending = false; 
    258       for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) pending |= itBuff->second->checkBuffer(); 
     268      for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) 
     269        pending |= itBuff->second->checkBuffer(); 
    259270      return pending; 
    260271   } 
     
    274285   \return state of buffers, pending(true), ready(false) 
    275286   */ 
    276 //   bool CContextClient::checkBuffers(list<int>& ranks) 
    277287   bool CContextClient::checkBuffers(list<int>& ranks) 
    278288   { 
     
    358368 
    359369   /*! 
    360    Finalize context client and do some reports 
    361    */ 
    362 //  void CContextClient::finalize(void) 
    363   void CContextClient::finalize() 
     370   * Finalize context client and do some reports. Function is non-blocking. 
     371   */ 
     372  void CContextClient::finalize(void) 
    364373  { 
    365374    map<int,CClientBuffer*>::iterator itBuff; 
     
    386395 
    387396    CTimer::get("Blocking time").resume(); 
    388     while (!stop) 
     397//    while (!stop) 
    389398    { 
    390399      checkBuffers(); 
     
    393402 
    394403      stop = true; 
    395       for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) stop &= !itBuff->second->hasPendingRequest(); 
     404//      for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) stop &= !itBuff->second->hasPendingRequest(); 
    396405    } 
    397406    CTimer::get("Blocking time").suspend(); 
     
    409418    report(0) << " Memory report : Context <" << context->getId() << "> : client side : total memory used for buffer " << totalBuf << " bytes" << endl; 
    410419 
    411     releaseBuffers(); 
     420    //releaseBuffers(); // moved to CContext::finalize() 
    412421  } 
     422 
     423  /*! 
     424  */ 
     425  bool CContextClient::havePendingRequests(void) 
     426  { 
     427    bool pending = false; 
     428    map<int,CClientBuffer*>::iterator itBuff; 
     429    for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) 
     430      pending |= itBuff->second->hasPendingRequest(); 
     431    return pending; 
     432  } 
     433 
     434 
    413435} 
Note: See TracChangeset for help on using the changeset viewer.