Changeset 2123


Ignore:
Timestamp:
04/02/21 21:06:04 (18 months ago)
Author:
ymipsl
Message:

Possibly fix deadlock in attched mode
YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src
Files:
3 edited

Legend:

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

    r2022 r2123  
    5454  //  if (contextInfo.serviceType != CServicesManager::CLIENT) // we must have an event scheduler => to be retrieve from the associated services 
    5555  //  { 
    56       if (!isAttachedModeEnabled()) eventScheduler_=CXios::getPoolRessource()->getService(contextInfo.serviceId,contextInfo.partitionId)->getEventScheduler() ; 
     56      //if (!isAttachedModeEnabled()) eventScheduler_=CXios::getPoolRessource()->getService(contextInfo.serviceId,contextInfo.partitionId)->getEventScheduler() ; 
     57      eventScheduler_=CXios::getPoolRessource()->getService(contextInfo.serviceId,contextInfo.partitionId)->getEventScheduler() ; 
     58 
    5759  //  } 
    5860 
     
    316318      if (event->isFull()) 
    317319      { 
    318         if (!scheduled && eventScheduler_) // Skip event scheduling for attached mode and reception on client side 
     320        if (!scheduled && !isAttachedModeEnabled()) // Skip event scheduling for attached mode and reception on client side 
    319321        { 
    320322          eventScheduler_->registerEvent(currentTimeLine,hashId); 
    321323          scheduled=true; 
    322324        } 
    323         else if (!eventScheduler_ || eventScheduler_->queryEvent(currentTimeLine,hashId) ) 
     325        else if (isAttachedModeEnabled() || eventScheduler_->queryEvent(currentTimeLine,hashId) ) 
    324326        { 
    325           MPI_Barrier(intraComm) ; 
     327          MPI_Request req ; 
     328          MPI_Status status ; 
     329 
     330          MPI_Ibarrier(intraComm,&req) ; 
     331          int flag=false ; 
     332          do   
     333          { 
     334            eventScheduler_->checkEvent()  ; 
     335            MPI_Test(&req,&flag,&status) ; 
     336          } while (!flag) ; 
     337 
     338          //MPI_Barrier(intraComm) ; 
    326339         // When using attached mode, synchronise the processes to avoid that differents event be scheduled by differents processes 
    327340         // The best way to properly solve this problem will be to use the event scheduler also in attached mode 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp

    r2022 r2123  
    716716  CATCH_DUMP_ATTR 
    717717 
    718     
    719  
    720   bool CContext::eventLoop(bool enableEventsProcessing) 
     718  bool CContext::scheduledEventLoop(bool enableEventsProcessing)  
    721719  { 
    722     bool finished=true;  
    723     bool out;  
     720    bool out, finished;  
    724721    size_t timeLine=timeLine_ ; 
    725722    if (serviceType_==CServicesManager::CLIENT) 
     
    731728    do 
    732729    {  
    733       if (client!=nullptr && !finalized) client->checkBuffers(); 
    734      
    735       for (int i = 0; i < clientPrimServer.size(); ++i) 
    736       { 
    737         if (!finalized) clientPrimServer[i]->checkBuffers(); 
    738         if (!finalized) finished &= serverPrimServer[i]->eventLoop(enableEventsProcessing); 
    739       } 
    740  
    741       for (auto couplerOut : couplerOutClient_) 
    742         if (!finalized) couplerOut.second->checkBuffers(); 
    743      
    744       for (auto couplerIn : couplerInClient_) 
    745         if (!finalized) couplerIn.second->checkBuffers(); 
    746      
    747       for (auto couplerOut : couplerOutServer_) 
    748         if (!finalized) couplerOut.second->eventLoop(enableEventsProcessing); 
    749  
    750       for (auto couplerIn : couplerInServer_) 
    751         if (!finalized) couplerIn.second->eventLoop(enableEventsProcessing); 
    752      
    753       if (server!=nullptr) if (!finalized) finished &= server->eventLoop(enableEventsProcessing); 
    754    
     730      finished=eventLoop(enableEventsProcessing) ; 
    755731      if (serviceType_==CServicesManager::CLIENT) out = eventScheduler_->queryEvent(timeLine,hashId_) ; 
    756732      else out=true ; 
    757733    }  while(!out) ; 
     734     
     735    return finished ; 
     736  } 
     737 
     738  bool CContext::eventLoop(bool enableEventsProcessing) 
     739  { 
     740    bool  finished;  
     741    if (client!=nullptr && !finalized) client->checkBuffers(); 
     742     
     743    for (int i = 0; i < clientPrimServer.size(); ++i) 
     744    { 
     745      if (!finalized) clientPrimServer[i]->checkBuffers(); 
     746      if (!finalized) finished &= serverPrimServer[i]->eventLoop(enableEventsProcessing); 
     747    } 
     748 
     749    for (auto couplerOut : couplerOutClient_) 
     750      if (!finalized) couplerOut.second->checkBuffers(); 
     751     
     752    for (auto couplerIn : couplerInClient_) 
     753      if (!finalized) couplerIn.second->checkBuffers(); 
     754     
     755    for (auto couplerOut : couplerOutServer_) 
     756      if (!finalized) couplerOut.second->eventLoop(enableEventsProcessing); 
     757 
     758    for (auto couplerIn : couplerInServer_) 
     759      if (!finalized) couplerIn.second->eventLoop(enableEventsProcessing); 
     760     
     761    if (server!=nullptr) if (!finalized) finished &= server->eventLoop(enableEventsProcessing); 
    758762    return finalized && finished ; 
    759763  } 
     
    10591063          couplersReady &= ready ; 
    10601064        } 
    1061         this->eventLoop() ; 
     1065        this->scheduledEventLoop() ; 
    10621066 
    10631067      } while (!couplersReady) ; 
    10641068       
    10651069      first=false ; 
    1066       this->eventLoop() ; 
     1070      this->scheduledEventLoop() ; 
    10671071 
    10681072    } while (!workflowGraphIsCompleted) ; 
     
    11981202      ok = true ; 
    11991203      for(auto& couplerOutClient : couplerOutClient_) ok &= isCouplerInCloseDefinition(couplerOutClient.second) ; 
    1200       this->eventLoop() ; 
     1204      this->scheduledEventLoop() ; 
    12011205    } while (!ok) ; 
    12021206 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp

    r2022 r2123  
    109109         // Put sever or client into loop state 
    110110         bool eventLoop(bool enableEventsProcessing=true); 
     111         bool scheduledEventLoop(bool enableEventsProcessing=true) ;  
    111112         void globalEventLoop(void); 
    112113 
Note: See TracChangeset for help on using the changeset viewer.