Changeset 2523 for XIOS3/trunk/src/manager
- Timestamp:
- 06/23/23 14:46:51 (13 months ago)
- Location:
- XIOS3/trunk/src/manager
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/manager/contexts_manager.hpp
r2260 r2523 75 75 MPI_Comm xiosComm_ ; 76 76 77 int notifyType_ ;77 int notifyType_ = NOTIFY_NOTHING ; 78 78 tuple<std::string, std::string, int, std::string> notifyCreateContext_ ; 79 79 tuple<std::string, std::string, int, std::string, int, std::string> notifyCreateIntercomm_ ; -
XIOS3/trunk/src/manager/pool_ressource.cpp
r2517 r2523 7 7 #include "cxios.hpp" 8 8 #include "timer.hpp" 9 #include "event_scheduler.hpp" 9 10 10 11 namespace xios 11 12 { 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) 13 14 { 14 15 int commRank, commSize ; … … 29 30 winNotify_->updateToExclusiveWindow(commRank, this, &CPoolRessource::notificationsDumpOut) ; 30 31 MPI_Barrier(poolComm_) ; 32 if (eventScheduler) eventScheduler_=eventScheduler ; 33 else eventScheduler_= make_shared<CEventScheduler>(poolComm) ; 34 freeRessourceEventScheduler_ = eventScheduler_ ; 31 35 } 32 36 … … 36 40 37 41 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 38 47 int commSize ; 39 48 MPI_Comm_size(poolComm_, &commSize) ; … … 43 52 for(int i=0; i<size; i++) 44 53 { 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); 45 56 procs_in[it->second]=true ; 46 57 procs_update.push_back(std::pair<int,int>(it->first+1,it->second)) ; 47 58 ++it ; 48 59 } 49 60 61 50 62 occupancy_.erase(occupancy_.begin(),it) ; 51 63 occupancy_.insert(procs_update.begin(),procs_update.end()) ; … … 247 259 { 248 260 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 ; 263 288 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) ; 273 310 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) ; 284 324 } 285 325 … … 300 340 shared_ptr<CEventScheduler> eventScheduler = service.second->getEventScheduler() ; 301 341 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 & attached310 { 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) ; 312 352 } 313 353 -
XIOS3/trunk/src/manager/pool_ressource.hpp
r2458 r2523 5 5 #include "window_manager.hpp" 6 6 #include "services_manager.hpp" 7 #include "event_scheduler.hpp" 7 8 8 9 … … 27 28 28 29 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) ; 30 31 ~CPoolRessource() ; 31 32 32 33 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) ; 34 35 void createServiceOnto(const std::string& serviceId, int type, const std::string& OnServiceId) ; 35 36 bool eventLoop(bool serviceOnly=false) ; 37 bool hasService(const std::string serviceId, int partitionId) {return services_.count(make_tuple(serviceId,partitionId))>0 ;} 36 38 CService* getService(const std::string serviceId, int partitionId) { return services_[make_tuple(serviceId,partitionId)]; } 37 39 void finalizeSignal(void) ; 38 40 string getId(void) { return Id_; } 41 const MPI_Comm& getCommunicator(void) { return poolComm_ ;} 39 42 40 43 private: … … 53 56 // void checkCreateServiceNotification(void) ; 54 57 void createNewService(const std::string& serviceId, int type, int size, int nbPartitions, bool in) ; 58 public: 55 59 void createNewServiceOnto(const std::string& serviceId, int type, const string& onServiceId) ; 56 60 … … 73 77 const double eventLoopLatency_=0; 74 78 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 75 87 }; 76 88 -
XIOS3/trunk/src/manager/ressources_manager.hpp
r2458 r2523 72 72 MPI_Comm xiosComm_ ; 73 73 74 int notifyType_ ;74 int notifyType_ = NOTIFY_NOTHING; 75 75 tuple<std::string, int> notifyCreatePool_ ; 76 76 -
XIOS3/trunk/src/manager/servers_ressource.cpp
r2517 r2523 3 3 #include "ressources_manager.hpp" 4 4 #include "pool_ressource.hpp" 5 #include "event_scheduler.hpp" 5 6 #include "cxios.hpp" 6 7 #include "mpi.hpp" … … 8 9 #include <vector> 9 10 #include <string> 11 10 12 11 13 … … 39 41 40 42 MPI_Comm_dup(serverComm_, &freeRessourcesComm_) ; 41 43 eventScheduler_ = make_shared<CEventScheduler>(freeRessourcesComm_) ; 44 freeRessourceEventScheduler_ = eventScheduler_ ; 42 45 } 43 46 … … 160 163 MPI_Comm_split(freeRessourcesComm_, isPartOf, commRank, &poolComm) ; 161 164 165 shared_ptr<CEventScheduler> parentScheduler, childScheduler ; 166 freeRessourceEventScheduler_->splitScheduler(poolComm, parentScheduler, childScheduler) ; 167 168 if (isFirstSplit_) eventScheduler_ = parentScheduler ; 169 isFirstSplit_ = false ; 170 162 171 if (isPartOf) 163 172 { 164 poolRessource_ = new CPoolRessource(poolComm, poolId, true) ;173 poolRessource_ = new CPoolRessource(poolComm, childScheduler, poolId, true) ; 165 174 MPI_Comm_free(&poolComm) ; 166 175 } 167 176 else 168 177 { 178 freeRessourceEventScheduler_ = childScheduler ; 169 179 MPI_Comm_free(&freeRessourcesComm_) ; 170 180 freeRessourcesComm_=poolComm ; -
XIOS3/trunk/src/manager/servers_ressource.hpp
r2274 r2523 3 3 4 4 #include "window_manager.hpp" 5 #include "event_scheduler.hpp" 5 6 #include "mpi.hpp" 6 7 #include <vector> … … 33 34 void checkNotifications(void) ; 34 35 CPoolRessource* getPoolRessource(void) { return poolRessource_; } 36 const MPI_Comm& getCommunicator(void) { return serverComm_ ;} 35 37 bool isServerLeader(void) ; 36 38 void finalize(void) ; … … 54 56 double lastEventLoop_=0. ; 55 57 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_ ;} 56 64 friend class CWindowManager ; 57 65 } ; -
XIOS3/trunk/src/manager/services.cpp
r2517 r2523 9 9 namespace xios 10 10 { 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) 13 13 : finalizeSignal_(false), eventScheduler_(nullptr), poolId_(poolId), serviceId_(serviceId), 14 14 partitionId_(partitionId), type_(type), nbPartitions_(nbPartitions), hasNotification_(false) … … 191 191 size_t hashId = hashString(name_) ; 192 192 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 ; 194 194 eventScheduler_->registerEvent(currentTimeLine,hashId); 195 195 } … … 203 203 size_t hashId = hashString(name_) ; 204 204 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 ; 206 206 if (eventScheduler_->queryEvent(currentTimeLine,hashId)) 207 207 { -
XIOS3/trunk/src/manager/services.hpp
r2404 r2523 19 19 const int NOTIFY_CREATE_CONTEXT=1 ; 20 20 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) ; 23 23 ~CService() ; 24 24 -
XIOS3/trunk/src/manager/services_manager.cpp
r2517 r2523 304 304 } 305 305 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 } 306 313 } -
XIOS3/trunk/src/manager/services_manager.hpp
r2458 r2523 49 49 bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ; 50 50 void waitServiceRegistration(const std::string& poolId, const std::string& serviceId, const int& partitionId); 51 void waitServiceRegistration(const std::string& poolId, const std::string& serviceId); 51 52 void servicesDumpOut(CBufferOut& buffer) ; 52 53 void servicesDumpIn(CBufferIn& buffer) ; … … 74 75 MPI_Comm xiosComm_ ; 75 76 76 int notifyType_ ;77 int notifyType_ = NOTIFY_NOTHING ; 77 78 tuple<std::string, int, int, int> notifyCreateService_ ; 78 79 tuple<std::string, int, std::string> notifyCreateServiceOnto_ ;
Note: See TracChangeset
for help on using the changeset viewer.