Ignore:
Timestamp:
10/11/21 14:41:56 (3 years ago)
Author:
ymipsl
Message:
  • Update of the tranfer protocol using one sided communication
  • Introduce MPI_Improb/MPI_mrecv to listen incomming request
  • Introducing latency when looping over managers

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/services.cpp

    r2230 r2246  
    55#include "server_context.hpp" 
    66#include "event_scheduler.hpp" 
     7#include "timer.hpp" 
    78 
    89namespace xios 
     
    1415 
    1516  { 
     17    info(40)<<"CService::CService  : new service created ; serviceId : "<<serviceId<<endl ; 
     18    
    1619    int localRank, globalRank, commSize ; 
    1720 
     
    4447    int commSize ; 
    4548    MPI_Comm_size(serviceComm_, &commSize) ; 
    46      
     49    info(40)<<"CService::createContext  : notify CreateContext to all services members ; serviceId : "<<serviceId<<" ; contextId : "<<contextId<<endl ; 
     50 
    4751    for(int rank=0; rank<commSize; rank++)  
    4852    { 
     
    5155      sendNotification(rank) ; 
    5256    } 
     57    info(40)<<"CService::createContext  : notify CreateContext to all services members : DONE "<<endl ; 
    5358  } 
    5459/* 
     
    99104  { 
    100105    //checkCreateContextNotification() ; 
    101     checkNotifications() ; 
     106    CTimer::get("CService::eventLoop").resume(); 
     107     
     108//    double time=MPI_Wtime() ; 
     109//    if (time-lastEventLoop_ > eventLoopLatency_)  
     110//    { 
     111      checkNotifications() ; 
     112//      lastEventLoop_=time ; 
     113//    } 
     114 
    102115 
    103116    eventScheduler_->checkEvent() ; 
     
    111124      } ; 
    112125    } 
    113  
     126    CTimer::get("CService::eventLoop").suspend(); 
    114127    if (contexts_.empty() && finalizeSignal_) return true ; 
    115128    else return false ; 
     
    144157      if (notifyInType_==NOTIFY_CREATE_CONTEXT) 
    145158      { 
    146         info(10)<<"NotifyDumpOut"<<endl ; 
    147159        auto& arg=notifyInCreateContext_ ; 
    148160        buffer >> std::get<0>(arg)>> std::get<1>(arg) >> std::get<2>(arg)>> std::get<3>(arg); 
     
    158170    if (!hasNotification_) 
    159171    { 
    160       int commRank ; 
    161       MPI_Comm_rank(serviceComm_, &commRank) ; 
    162       winNotify_->lockWindow(commRank,0) ; 
    163       winNotify_->popFromWindow(commRank, this, &CService::notificationsDumpIn) ; 
    164       winNotify_->unlockWindow(commRank,0) ; 
     172      double time=MPI_Wtime() ; 
     173      if (time-lastEventLoop_ > eventLoopLatency_)  
     174      { 
     175        int commRank ; 
     176        MPI_Comm_rank(serviceComm_, &commRank) ; 
     177        winNotify_->lockWindow(commRank,0) ; 
     178        winNotify_->popFromWindow(commRank, this, &CService::notificationsDumpIn) ; 
     179        winNotify_->unlockWindow(commRank,0) ; 
    165180       
    166       if (notifyInType_!= NOTIFY_NOTHING) 
    167       { 
    168         hasNotification_=true ; 
    169         std::hash<string> hashString ; 
    170         size_t hashId = hashString(name_) ; 
    171         size_t currentTimeLine=0 ; 
    172         eventScheduler_->registerEvent(currentTimeLine,hashId);  
     181        if (notifyInType_!= NOTIFY_NOTHING) 
     182        { 
     183          hasNotification_=true ; 
     184          std::hash<string> hashString ; 
     185          size_t hashId = hashString(name_) ; 
     186          size_t currentTimeLine=0 ; 
     187          info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler"<<endl ; 
     188          eventScheduler_->registerEvent(currentTimeLine,hashId);  
     189        } 
     190        lastEventLoop_=time ; 
    173191      } 
    174192    } 
     
    179197      size_t hashId = hashString(name_) ; 
    180198      size_t currentTimeLine=0 ; 
     199      info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : eventIsReceived ?"<<endl ; 
    181200      if (eventScheduler_->queryEvent(currentTimeLine,hashId)) 
    182201      { 
    183202        eventScheduler_->popEvent() ; 
     203        info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : RECEIVED"<<endl ; 
    184204        if (notifyInType_==NOTIFY_CREATE_CONTEXT) createContext() ; 
    185205        hasNotification_=false ; 
     
    190210 
    191211 
    192  
     212//ym not use any more 
    193213  void CService::checkCreateContextNotification(void) 
    194214  { 
     
    210230  void CService::createContext(void) 
    211231   { 
     232     info(40)<<"CService::createContext(void)  : receive createContext notification"<<endl ; 
    212233     auto& arg=notifyInCreateContext_ ; 
    213234     string poolId = get<0>(arg) ; 
     
    218239   } 
    219240 
    220    //to remove 
     241   //to remove, not used anymore 
    221242   void CService::createNewContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) 
    222243   { 
Note: See TracChangeset for help on using the changeset viewer.