Changeset 2523 for XIOS3/trunk/src


Ignore:
Timestamp:
06/23/23 14:46:51 (12 months ago)
Author:
ymipsl
Message:

Adaptation to new hyper event scheduler.
YM

Location:
XIOS3/trunk/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk/src/client.cpp

    r2458 r2523  
    188188      
    189189      CXios::launchDaemonsManager(false) ; 
    190       poolRessource_ = new CPoolRessource(clientComm, codeId, false) ; 
     190      shared_ptr<CEventScheduler> eventScheduler ; 
     191      poolRessource_ = new CPoolRessource(clientComm, eventScheduler, codeId, false) ; 
    191192 
    192193      ///////////////////////////////////////// 
     
    196197      MPI_Request req ; 
    197198      MPI_Status status ; 
    198       MPI_Ibarrier(xiosGlobalComm,&req) ; // be sure that all services are created now, could be remove later if more asynchronisity 
     199      MPI_Ibarrier(CXios::getXiosComm(),&req) ; // be sure that all services are created now, could be remove later if more asynchronisity 
    199200      int ok=false ; 
    200201      while (!ok) 
     
    443444      MPI_Comm_rank(contextComm,&commRank) ; 
    444445      MPI_Comm_size(contextComm,&commSize) ; 
    445  
    446       getPoolRessource()->createService(contextComm, id, 0, CServicesManager::CLIENT, 1) ; 
    447       getPoolRessource()->createService(contextComm, id+"_"+CXios::defaultWriterId, 0, CServicesManager::WRITER, 1) ; 
    448       getPoolRessource()->createService(contextComm, id+"_"+CXios::defaultReaderId, 0, CServicesManager::READER, 1) ; 
     446       
     447      shared_ptr<CEventScheduler> eventScheduler ; 
     448       
     449      getPoolRessource()->createService(contextComm, eventScheduler, id, 0, CServicesManager::CLIENT, 1) ; 
     450//      getPoolRessource()->createService(contextComm, eventScheduler, id+"_"+CXios::defaultWriterId, 0, CServicesManager::WRITER, 1) ; 
     451      getPoolRessource()->createNewServiceOnto(id+"_"+CXios::defaultWriterId, CServicesManager::WRITER, id) ; 
     452//      getPoolRessource()->createService(contextComm, eventScheduler, id+"_"+CXios::defaultReaderId, 0, CServicesManager::READER, 1) ; 
     453      getPoolRessource()->createNewServiceOnto(id+"_"+CXios::defaultReaderId, CServicesManager::READER, id) ; 
    449454 
    450455      if (commRank==0) while (!CXios::getServicesManager()->hasService(getPoolRessource()->getId(), id, 0)) { CXios::getDaemonsManager()->eventLoop();} 
  • XIOS3/trunk/src/manager/contexts_manager.hpp

    r2260 r2523  
    7575    MPI_Comm xiosComm_ ; 
    7676 
    77     int notifyType_ ; 
     77    int notifyType_ = NOTIFY_NOTHING ; 
    7878    tuple<std::string, std::string, int, std::string> notifyCreateContext_ ; 
    7979    tuple<std::string, std::string, int, std::string, int, std::string> notifyCreateIntercomm_ ; 
  • XIOS3/trunk/src/manager/pool_ressource.cpp

    r2517 r2523  
    77#include "cxios.hpp" 
    88#include "timer.hpp" 
     9#include "event_scheduler.hpp" 
    910 
    1011namespace xios 
    1112{ 
    12   CPoolRessource::CPoolRessource(MPI_Comm poolComm, const std::string& Id, bool isServer) : Id_(Id), finalizeSignal_(false) 
     13  CPoolRessource::CPoolRessource(MPI_Comm poolComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& Id, bool isServer) : Id_(Id), finalizeSignal_(false) 
    1314  { 
    1415    int commRank, commSize ; 
     
    2930    winNotify_->updateToExclusiveWindow(commRank, this, &CPoolRessource::notificationsDumpOut) ; 
    3031    MPI_Barrier(poolComm_) ; 
     32    if (eventScheduler) eventScheduler_=eventScheduler ; 
     33    else eventScheduler_= make_shared<CEventScheduler>(poolComm) ; 
     34    freeRessourceEventScheduler_ = eventScheduler_ ; 
    3135  } 
    3236 
     
    3640     
    3741    auto it=occupancy_.begin() ; 
     42 
     43    // ym obsolete, service cannot overlap, only created on separate ressource or matching excatly existing service 
     44    // occupancy management must not be used anymore => simplification 
     45    // for now raise a message error when no ressources are availables 
     46     
    3847    int commSize ; 
    3948    MPI_Comm_size(poolComm_, &commSize) ; 
     
    4352    for(int i=0; i<size; i++)  
    4453    { 
     54      if (it->first != 0) ERROR("void CPoolRessource::createService(const std::string& serviceId, int type, int size, int nbPartitions)", 
     55                                 << "No enough free ressources on pool id="<<getId()<<" to launch service id="<<serviceId); 
    4556      procs_in[it->second]=true ; 
    4657      procs_update.push_back(std::pair<int,int>(it->first+1,it->second)) ; 
    4758      ++it ; 
    4859    } 
    49      
     60 
     61 
    5062    occupancy_.erase(occupancy_.begin(),it) ; 
    5163    occupancy_.insert(procs_update.begin(),procs_update.end()) ; 
     
    247259  { 
    248260      
    249      info(40)<<"CPoolRessource::createNewService  : receive createService notification ; serviceId : "<<serviceId<<endl ; 
    250      MPI_Comm serviceComm, newServiceComm ; 
    251      int commRank ; 
    252      MPI_Comm_rank(poolComm_,&commRank) ; 
    253      MPI_Comm_split(poolComm_, in, commRank, &serviceComm) ; 
    254      if (in) 
    255      { 
    256        int serviceCommSize ; 
    257        int serviceCommRank ; 
    258        MPI_Comm_size(serviceComm,&serviceCommSize) ; 
    259        MPI_Comm_rank(serviceComm,&serviceCommRank) ; 
    260  
    261        info(10)<<"Service  "<<serviceId<<" created "<<"  service size : "<<serviceCommSize<< "   service rank : "<<serviceCommRank  
    262                             <<" on rank pool "<<commRank<<endl ; 
     261    info(40)<<"CPoolRessource::createNewService  : receive createService notification ; serviceId : "<<serviceId<<endl ; 
     262    MPI_Comm serviceComm, newServiceComm, freeComm ; 
     263    int commRank ; 
     264      
     265    int color; 
     266    if (!services_.empty()) color = 0 ; 
     267    else color=1 ;  
     268    MPI_Comm_rank(poolComm_,&commRank) ; 
     269    MPI_Comm_split(poolComm_, color, commRank, &freeComm) ;  // workaround 
     270     
     271    if (services_.empty())  
     272    { 
     273      MPI_Comm_rank(freeComm,&commRank) ; 
     274      MPI_Comm_split(freeComm, in, commRank, &serviceComm) ; 
     275 
     276      // temporary for event scheduler, we must using hierarchical split of free ressources communicator. 
     277      // we hope for now that spliting using occupancy make this match 
     278 
     279      if (in) 
     280      { 
     281        int serviceCommSize ; 
     282        int serviceCommRank ; 
     283        MPI_Comm_size(serviceComm,&serviceCommSize) ; 
     284        MPI_Comm_rank(serviceComm,&serviceCommRank) ; 
     285 
     286        info(10)<<"Service  "<<serviceId<<" created "<<"  service size : "<<serviceCommSize<< "   service rank : "<<serviceCommRank  
     287                              <<" on rank pool "<<commRank<<endl ; 
    263288        
    264        int partitionId ;  
    265        if ( serviceCommRank >= (serviceCommSize/nbPartitions+1)*(serviceCommSize%nbPartitions) ) 
    266        { 
    267          int rank =  serviceCommRank - (serviceCommSize/nbPartitions+1)*(serviceCommSize%nbPartitions) ; 
    268          partitionId = serviceCommSize%nbPartitions +  rank / (serviceCommSize/nbPartitions) ; 
    269        } 
    270        else  partitionId = serviceCommRank / (serviceCommSize/nbPartitions + 1) ; 
    271  
    272        MPI_Comm_split(serviceComm, partitionId, commRank, &newServiceComm) ; 
     289        int partitionId ;  
     290        if ( serviceCommRank >= (serviceCommSize/nbPartitions+1)*(serviceCommSize%nbPartitions) ) 
     291        { 
     292          int rank =  serviceCommRank - (serviceCommSize/nbPartitions+1)*(serviceCommSize%nbPartitions) ; 
     293          partitionId = serviceCommSize%nbPartitions +  rank / (serviceCommSize/nbPartitions) ; 
     294        } 
     295        else  partitionId = serviceCommRank / (serviceCommSize/nbPartitions + 1) ; 
     296 
     297        MPI_Comm_split(serviceComm, partitionId, commRank, &newServiceComm) ; 
     298 
     299        MPI_Comm_size(newServiceComm,&serviceCommSize) ; 
     300        MPI_Comm_rank(newServiceComm,&serviceCommRank) ; 
     301        info(10)<<"Service  "<<serviceId<<" created "<<"  partition : " <<partitionId<<" service size : "<<serviceCommSize 
     302                << " service rank : "<<serviceCommRank <<" on rank pool "<<commRank<<endl ; 
     303       
     304        shared_ptr<CEventScheduler> parentScheduler, childScheduler ; 
     305        freeRessourceEventScheduler_->splitScheduler(newServiceComm, parentScheduler, childScheduler) ; 
     306        if (isFirstSplit_) eventScheduler_ = parentScheduler ; 
     307        isFirstSplit_=false ; 
     308 
     309        services_[std::make_tuple(serviceId,partitionId)] = new CService(newServiceComm, childScheduler, Id_, serviceId, partitionId, type, nbPartitions) ; 
    273310        
    274        MPI_Comm_size(newServiceComm,&serviceCommSize) ; 
    275        MPI_Comm_rank(newServiceComm,&serviceCommRank) ; 
    276        info(10)<<"Service  "<<serviceId<<" created "<<"  partition : " <<partitionId<<" service size : "<<serviceCommSize 
    277                << " service rank : "<<serviceCommRank <<" on rank pool "<<commRank<<endl ; 
    278        
    279        services_[std::make_tuple(serviceId,partitionId)] = new CService(newServiceComm, Id_, serviceId, partitionId, type, nbPartitions) ; 
    280         
    281        MPI_Comm_free(&newServiceComm) ; 
    282      } 
    283      MPI_Comm_free(&serviceComm) ; 
     311        MPI_Comm_free(&newServiceComm) ; 
     312      } 
     313      else 
     314      { 
     315        shared_ptr<CEventScheduler> parentScheduler, childScheduler ; 
     316        freeRessourceEventScheduler_->splitScheduler(serviceComm, parentScheduler, childScheduler) ; 
     317        if (isFirstSplit_) eventScheduler_ = parentScheduler ; 
     318        freeRessourceEventScheduler_ = childScheduler ; 
     319        isFirstSplit_=false ; 
     320      } 
     321      MPI_Comm_free(&serviceComm) ; 
     322    } 
     323    MPI_Comm_free(&freeComm) ; 
    284324  } 
    285325   
     
    300340        shared_ptr<CEventScheduler>  eventScheduler = service.second->getEventScheduler() ; 
    301341        info(40)<<"CPoolRessource::createNewServiceOnto ; found onServiceId : "<<onServiceId<<endl  ; 
    302         services_[std::make_tuple(serviceId,partitionId)] = new CService(newServiceComm, Id_, serviceId, partitionId, type, 
    303                                                                          nbPartitions, eventScheduler) ;        
    304       } 
    305     } 
    306      
    307   } 
    308  
    309   void CPoolRessource::createService(MPI_Comm serviceComm, const std::string& serviceId, int partitionId, int type, int nbPartitions) // for clients & attached 
    310   { 
    311     services_[std::make_tuple(serviceId,partitionId)] = new CService(serviceComm, Id_, serviceId, partitionId, type, nbPartitions) ; 
     342        services_[std::make_tuple(serviceId,partitionId)] = new CService(newServiceComm, eventScheduler, Id_, serviceId, partitionId, type, 
     343                                                                         nbPartitions) ;        
     344      } 
     345    } 
     346     
     347  } 
     348 
     349  void CPoolRessource::createService(MPI_Comm serviceComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& serviceId, int partitionId, int type, int nbPartitions) // for clients & attached 
     350  { 
     351    services_[std::make_tuple(serviceId,partitionId)] = new CService(serviceComm, eventScheduler, Id_, serviceId, partitionId, type, nbPartitions) ; 
    312352  } 
    313353 
  • XIOS3/trunk/src/manager/pool_ressource.hpp

    r2458 r2523  
    55#include "window_manager.hpp" 
    66#include "services_manager.hpp" 
     7#include "event_scheduler.hpp" 
    78 
    89 
     
    2728 
    2829    public: 
    29     CPoolRessource(MPI_Comm poolComm, const std::string& Id, bool isServer) ; 
     30    CPoolRessource(MPI_Comm poolComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& Id, bool isServer) ; 
    3031    ~CPoolRessource() ; 
    3132     
    3233    void createService(const std::string& serviceId, int type, int size, int nbPartition) ; 
    33     void createService(MPI_Comm serviceComm, const std::string& serviceId, int partitionId, int type, int nbPartitions) ;  
     34    void createService(MPI_Comm serviceComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& serviceId, int partitionId, int type, int nbPartitions) ;  
    3435    void createServiceOnto(const std::string& serviceId, int type, const std::string& OnServiceId) ; 
    3536    bool eventLoop(bool serviceOnly=false) ; 
     37    bool hasService(const std::string serviceId, int partitionId) {return services_.count(make_tuple(serviceId,partitionId))>0 ;} 
    3638    CService* getService(const std::string serviceId, int partitionId) { return services_[make_tuple(serviceId,partitionId)]; } 
    3739    void finalizeSignal(void) ; 
    3840    string getId(void) { return Id_; } 
     41    const MPI_Comm& getCommunicator(void) { return poolComm_ ;} 
    3942 
    4043  private: 
     
    5356//    void checkCreateServiceNotification(void) ; 
    5457    void createNewService(const std::string& serviceId, int type, int size, int nbPartitions, bool in) ; 
     58  public: 
    5559    void createNewServiceOnto(const std::string& serviceId, int type, const string& onServiceId) ; 
    5660     
     
    7377    const double eventLoopLatency_=0;  
    7478    double lastEventLoop_=0. ; 
     79 
     80    private: 
     81      shared_ptr<CEventScheduler> eventScheduler_ ; 
     82      shared_ptr<CEventScheduler> freeRessourceEventScheduler_ ; 
     83      bool isFirstSplit_=true ; 
     84    public: 
     85      shared_ptr<CEventScheduler> getEventScheduler(void) { return eventScheduler_ ;} 
     86 
    7587  }; 
    7688 
  • XIOS3/trunk/src/manager/ressources_manager.hpp

    r2458 r2523  
    7272    MPI_Comm xiosComm_ ; 
    7373 
    74     int notifyType_ ; 
     74    int notifyType_ = NOTIFY_NOTHING; 
    7575    tuple<std::string, int> notifyCreatePool_ ; 
    7676 
  • XIOS3/trunk/src/manager/servers_ressource.cpp

    r2517 r2523  
    33#include "ressources_manager.hpp" 
    44#include "pool_ressource.hpp" 
     5#include "event_scheduler.hpp" 
    56#include "cxios.hpp" 
    67#include "mpi.hpp" 
     
    89#include <vector> 
    910#include <string> 
     11 
    1012 
    1113 
     
    3941 
    4042    MPI_Comm_dup(serverComm_, &freeRessourcesComm_) ;  
    41  
     43    eventScheduler_ = make_shared<CEventScheduler>(freeRessourcesComm_) ; 
     44    freeRessourceEventScheduler_ = eventScheduler_ ; 
    4245  } 
    4346 
     
    160163    MPI_Comm_split(freeRessourcesComm_, isPartOf, commRank, &poolComm) ; 
    161164     
     165    shared_ptr<CEventScheduler> parentScheduler, childScheduler ; 
     166    freeRessourceEventScheduler_->splitScheduler(poolComm, parentScheduler, childScheduler) ; 
     167     
     168    if (isFirstSplit_) eventScheduler_ = parentScheduler ;  
     169    isFirstSplit_ = false ; 
     170 
    162171    if (isPartOf) 
    163172    {   
    164       poolRessource_ = new CPoolRessource(poolComm, poolId, true) ; 
     173      poolRessource_ = new CPoolRessource(poolComm, childScheduler, poolId, true) ; 
    165174      MPI_Comm_free(&poolComm) ; 
    166175    } 
    167176    else  
    168177    { 
     178      freeRessourceEventScheduler_ = childScheduler ; 
    169179      MPI_Comm_free(&freeRessourcesComm_) ; 
    170180      freeRessourcesComm_=poolComm ; 
  • XIOS3/trunk/src/manager/servers_ressource.hpp

    r2274 r2523  
    33 
    44#include "window_manager.hpp" 
     5#include "event_scheduler.hpp" 
    56#include "mpi.hpp" 
    67#include <vector> 
     
    3334    void checkNotifications(void) ; 
    3435    CPoolRessource* getPoolRessource(void) { return poolRessource_; }  
     36    const MPI_Comm& getCommunicator(void) { return serverComm_ ;} 
    3537    bool isServerLeader(void) ; 
    3638    void finalize(void) ; 
     
    5456    double lastEventLoop_=0. ; 
    5557 
     58    private: 
     59      shared_ptr<CEventScheduler> eventScheduler_ ; 
     60      shared_ptr<CEventScheduler> freeRessourceEventScheduler_ ; 
     61      bool isFirstSplit_=true ; 
     62    public: 
     63      shared_ptr<CEventScheduler> getEventScheduler(void) { return eventScheduler_ ;} 
    5664    friend class CWindowManager ; 
    5765  } ; 
  • XIOS3/trunk/src/manager/services.cpp

    r2517 r2523  
    99namespace xios 
    1010{ 
    11   CService::CService(MPI_Comm serviceComm, const std::string& poolId, const std::string& serviceId, const int& partitionId,  
    12                      int type, int nbPartitions, shared_ptr<CEventScheduler> eventScheduler)  
     11  CService::CService(MPI_Comm serviceComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& poolId, const std::string& serviceId, const int& partitionId,  
     12                     int type, int nbPartitions)  
    1313                         : finalizeSignal_(false), eventScheduler_(nullptr), poolId_(poolId), serviceId_(serviceId), 
    1414                           partitionId_(partitionId), type_(type), nbPartitions_(nbPartitions), hasNotification_(false) 
     
    191191          size_t hashId = hashString(name_) ; 
    192192          size_t currentTimeLine=0 ; 
    193           info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler"<<endl ; 
     193          info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : timeLine : "<<currentTimeLine<<"  hashId : "<<hashId<<endl ; 
    194194          eventScheduler_->registerEvent(currentTimeLine,hashId);  
    195195        } 
     
    203203      size_t hashId = hashString(name_) ; 
    204204      size_t currentTimeLine=0 ; 
    205       info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : eventIsReceived ?"<<endl ; 
     205//      info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : eventIsReceived ?"<<endl ; 
    206206      if (eventScheduler_->queryEvent(currentTimeLine,hashId)) 
    207207      { 
  • XIOS3/trunk/src/manager/services.hpp

    r2404 r2523  
    1919    const int NOTIFY_CREATE_CONTEXT=1 ; 
    2020 
    21     CService(MPI_Comm serviceComm, const std::string& poolId, const std::string& serviceId, const int& partitionId,  
    22              int type, int nbPartitions, shared_ptr<CEventScheduler> = nullptr) ; 
     21    CService(MPI_Comm serviceComm, shared_ptr<CEventScheduler>, const std::string& poolId, const std::string& serviceId, const int& partitionId,  
     22             int type, int nbPartitions) ; 
    2323    ~CService() ; 
    2424 
  • XIOS3/trunk/src/manager/services_manager.cpp

    r2517 r2523  
    304304  } 
    305305 
     306  void CServicesManager::waitServiceRegistration(const std::string& poolId, const std::string& serviceId) 
     307  { 
     308    int nbPartition ; 
     309    getServiceNbPartitions(poolId,serviceId,0,nbPartition, true) ; 
     310    for(int n=1;n<nbPartition;n++) waitServiceRegistration(poolId, serviceId, n) ; 
     311 
     312  } 
    306313} 
  • XIOS3/trunk/src/manager/services_manager.hpp

    r2458 r2523  
    4949    bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ; 
    5050    void waitServiceRegistration(const std::string& poolId, const std::string& serviceId, const int& partitionId); 
     51    void waitServiceRegistration(const std::string& poolId, const std::string& serviceId); 
    5152    void servicesDumpOut(CBufferOut& buffer) ; 
    5253    void servicesDumpIn(CBufferIn& buffer) ; 
     
    7475    MPI_Comm xiosComm_ ; 
    7576 
    76     int notifyType_ ; 
     77    int notifyType_ = NOTIFY_NOTHING ; 
    7778    tuple<std::string, int, int, int> notifyCreateService_ ; 
    7879    tuple<std::string, int, std::string> notifyCreateServiceOnto_ ; 
  • XIOS3/trunk/src/server.cpp

    r2458 r2523  
    202202            ressourcesManager->waitPoolRegistration(CXios::defaultPoolId) ; 
    203203            servicesManager->createServices(CXios::defaultPoolId, CXios::defaultWriterId, CServicesManager::WRITER,nbRessources,1) ; 
     204            servicesManager->waitServiceRegistration(CXios::defaultPoolId, CXios::defaultWriterId) ; 
    204205            servicesManager->createServicesOnto(CXios::defaultPoolId, CXios::defaultReaderId, CServicesManager::READER, CXios::defaultWriterId) ; 
     206            servicesManager->waitServiceRegistration(CXios::defaultPoolId, CXios::defaultReaderId) ; 
    205207          } 
    206208          else 
     
    214216            ressourcesManager->waitPoolRegistration(CXios::defaultPoolId) ; 
    215217            servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultGathererId, CServicesManager::GATHERER, nprocsGatherer, 1) ; 
     218            servicesManager->waitServiceRegistration(CXios::defaultPoolId, CXios::defaultGathererId) ; 
    216219            servicesManager->createServicesOnto(CXios::defaultPoolId, CXios::defaultReaderId, CServicesManager::READER, CXios::defaultGathererId) ; 
     220            servicesManager->waitServiceRegistration(CXios::defaultPoolId, CXios::defaultReaderId) ; 
    217221            servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultWriterId, CServicesManager::WRITER, nprocsServer, nbPoolsServer2) ; 
     222            servicesManager->waitServiceRegistration(CXios::defaultPoolId, CXios::defaultWriterId) ; 
    218223          } 
    219224        } 
    220225//        servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultServicesId, CServicesManager::ALL_SERVICES, nbRessources, 1) ; 
    221226      } 
     227 
     228      MPI_Request req ; 
     229      MPI_Status status ; 
     230      MPI_Ibarrier(getServersRessource()->getCommunicator(),&req) ; // be sure that all services are created now, could be remove later if more asynchronisity 
     231      int ok=false ; 
     232      while (!ok) 
     233      { 
     234        daemonsManager->eventLoop() ; 
     235        MPI_Test(&req,&ok,&status) ; 
     236      } 
     237 
     238 
     239      testingEventScheduler() ; 
    222240/* 
    223241      MPI_Request req ; 
    224242      MPI_Status status ; 
    225       MPI_Ibarrier(xiosGlobalComm,&req) ; // be sure that all services are created now, could be remove later if more asynchronisity 
     243      MPI_Ibarrier(CXios::getXiosComm(),&req) ; // be sure that all services are created now, could be remove later if more asynchronisity 
    226244      int ok=false ; 
    227245      while (!ok) 
     
    252270 
    253271 
    254  
     272    void CServer::testingEventScheduler(void) 
     273    { 
     274      CXios::getPoolRessource()->getEventScheduler()->registerEvent(1,10) ; 
     275      CXios::getPoolRessource()->getEventScheduler()->registerEvent(2,10) ; 
     276      if (CXios::getPoolRessource()->hasService(CXios::defaultGathererId,0)) 
     277      { 
     278        CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)-> getEventScheduler()->registerEvent(1,100) ; 
     279        CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)-> getEventScheduler()->registerEvent(2,100) ; 
     280        CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)-> getEventScheduler()->registerEvent(3,100) ; 
     281      } 
     282      if (CXios::getPoolRessource()->hasService(CXios::defaultWriterId,0)) 
     283      { 
     284        CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)-> getEventScheduler()->registerEvent(1,1000) ; 
     285        CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)-> getEventScheduler()->registerEvent(2,1000) ; 
     286      } 
     287      CXios::getPoolRessource()->getEventScheduler()->registerEvent(3,10) ; 
     288      CXios::getPoolRessource()->getEventScheduler()->registerEvent(4,10) ; 
     289       
     290      if (CXios::getPoolRessource()->hasService(CXios::defaultGathererId,0)) 
     291      { 
     292        CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)-> getEventScheduler()->registerEvent(4,100) ; 
     293        CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)-> getEventScheduler()->registerEvent(5,100) ; 
     294      } 
     295      if (CXios::getPoolRessource()->hasService(CXios::defaultWriterId,0)) 
     296      { 
     297        CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)-> getEventScheduler()->registerEvent(3,1000) ; 
     298        CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)-> getEventScheduler()->registerEvent(4,1000) ; 
     299        CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)-> getEventScheduler()->registerEvent(5,1000) ; 
     300      } 
     301      CXios::getPoolRessource()->getEventScheduler()->registerEvent(5,10) ; 
     302      CXios::getPoolRessource()->getEventScheduler()->registerEvent(6,10) ; 
     303       
     304      int numEvents=0 ; 
     305      int poolEvent=1 ; 
     306      int gatherEvent=1 ; 
     307      int writerEvent=1 ; 
     308      do 
     309      { 
     310        if (CXios::getPoolRessource()->getEventScheduler()->queryEvent(poolEvent,10)) 
     311        { 
     312          CXios::getPoolRessource()->getEventScheduler()->popEvent() ; 
     313          MPI_Barrier(CXios::getPoolRessource()->getCommunicator()); 
     314          poolEvent++ ; 
     315          numEvents++; 
     316        } 
     317         
     318        if (CXios::getPoolRessource()->getEventScheduler()->queryEvent(gatherEvent,100)) 
     319        { 
     320          CXios::getPoolRessource()->getEventScheduler()->popEvent() ; 
     321          MPI_Barrier(CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)->getCommunicator()); 
     322          gatherEvent++ ; 
     323          numEvents++; 
     324        } 
     325 
     326        if (CXios::getPoolRessource()->getEventScheduler()->queryEvent(writerEvent,1000)) 
     327        { 
     328          CXios::getPoolRessource()->getEventScheduler()->popEvent() ; 
     329          MPI_Barrier(CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)->getCommunicator()); 
     330          writerEvent++ ; 
     331          numEvents++; 
     332        } 
     333 
     334         
     335      } while (numEvents!=11) ; 
     336 
     337    } 
    255338 
    256339 
     
    410493         boost::hash<string> hashString; 
    411494         size_t hashId = hashString("oasis_enddef"); 
    412          if (CXios::getPoolRessource()->getService(CXios::defaultServicesId,0)->getEventScheduler()->queryEvent(0,hashId)) 
     495 
     496         if (CXios::getPoolRessource()->getEventScheduler()->queryEvent(0,hashId)) 
    413497         { 
    414            CXios::getPoolRessource()->getService(CXios::defaultServicesId,0)->getEventScheduler()->popEvent() ; 
     498           CXios::getPoolRessource()->getEventScheduler()->popEvent() ; 
    415499           driver_->endSynchronizedDefinition() ; 
    416500           eventSent=false ; 
     
    426510           boost::hash<string> hashString; 
    427511           size_t hashId = hashString("oasis_enddef"); 
    428            CXios::getPoolRessource()->getService(CXios::defaultServicesId,0)->getEventScheduler()->registerEvent(0,hashId); 
     512           CXios::getPoolRessource()->getEventScheduler()->registerEvent(0,hashId); 
    429513           eventSent=true ; 
    430514       } 
  • XIOS3/trunk/src/server.hpp

    r2335 r2523  
    4343        static void listenRootOasisEnddef(void); 
    4444        static void listenOasisEnddef(void); 
    45  
     45        static void testingEventScheduler(void); 
     46         
    4647        static void finalize(void); 
    4748        static void eventLoop(void); 
Note: See TracChangeset for help on using the changeset viewer.