Changeset 2246 for XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/services.cpp
- Timestamp:
- 10/11/21 14:41:56 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/services.cpp
r2230 r2246 5 5 #include "server_context.hpp" 6 6 #include "event_scheduler.hpp" 7 #include "timer.hpp" 7 8 8 9 namespace xios … … 14 15 15 16 { 17 info(40)<<"CService::CService : new service created ; serviceId : "<<serviceId<<endl ; 18 16 19 int localRank, globalRank, commSize ; 17 20 … … 44 47 int commSize ; 45 48 MPI_Comm_size(serviceComm_, &commSize) ; 46 49 info(40)<<"CService::createContext : notify CreateContext to all services members ; serviceId : "<<serviceId<<" ; contextId : "<<contextId<<endl ; 50 47 51 for(int rank=0; rank<commSize; rank++) 48 52 { … … 51 55 sendNotification(rank) ; 52 56 } 57 info(40)<<"CService::createContext : notify CreateContext to all services members : DONE "<<endl ; 53 58 } 54 59 /* … … 99 104 { 100 105 //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 102 115 103 116 eventScheduler_->checkEvent() ; … … 111 124 } ; 112 125 } 113 126 CTimer::get("CService::eventLoop").suspend(); 114 127 if (contexts_.empty() && finalizeSignal_) return true ; 115 128 else return false ; … … 144 157 if (notifyInType_==NOTIFY_CREATE_CONTEXT) 145 158 { 146 info(10)<<"NotifyDumpOut"<<endl ;147 159 auto& arg=notifyInCreateContext_ ; 148 160 buffer >> std::get<0>(arg)>> std::get<1>(arg) >> std::get<2>(arg)>> std::get<3>(arg); … … 158 170 if (!hasNotification_) 159 171 { 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) ; 165 180 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 ; 173 191 } 174 192 } … … 179 197 size_t hashId = hashString(name_) ; 180 198 size_t currentTimeLine=0 ; 199 info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : eventIsReceived ?"<<endl ; 181 200 if (eventScheduler_->queryEvent(currentTimeLine,hashId)) 182 201 { 183 202 eventScheduler_->popEvent() ; 203 info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : RECEIVED"<<endl ; 184 204 if (notifyInType_==NOTIFY_CREATE_CONTEXT) createContext() ; 185 205 hasNotification_=false ; … … 190 210 191 211 192 212 //ym not use any more 193 213 void CService::checkCreateContextNotification(void) 194 214 { … … 210 230 void CService::createContext(void) 211 231 { 232 info(40)<<"CService::createContext(void) : receive createContext notification"<<endl ; 212 233 auto& arg=notifyInCreateContext_ ; 213 234 string poolId = get<0>(arg) ; … … 218 239 } 219 240 220 //to remove 241 //to remove, not used anymore 221 242 void CService::createNewContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) 222 243 {
Note: See TracChangeset
for help on using the changeset viewer.