Changeset 2517
- Timestamp:
- 06/12/23 11:52:10 (16 months ago)
- Location:
- XIOS3/trunk/src/manager
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/manager/contexts_manager.cpp
r2287 r2517 27 27 MPI_Comm_rank(xiosComm_, &commRank) ; 28 28 winNotify_ = new CWindowManager(xiosComm_, maxBufferSize_) ; 29 winNotify_->updateToExclusiveWindow(commRank, this, &CContextsManager::notificationsDumpOut) ; 29 30 30 31 31 32 winContexts_ = new CWindowManager(xiosComm_, maxBufferSize_) ; 32 winContexts_->lockWindow(commRank,0) ; 33 winContexts_->updateToWindow(commRank, this, &CContextsManager::contextsDumpOut) ; 34 winContexts_->unlockWindow(commRank,0) ; 35 33 winContexts_->updateToExclusiveWindow(commRank, this, &CContextsManager::contextsDumpOut) ; 34 36 35 MPI_Barrier(xiosComm_) ; 37 36 } … … 111 110 winNotify_->lockWindowExclusive(rank) ; 112 111 winNotify_->pushToLockedWindow(rank, this, &CContextsManager::notificationsDumpOut) ; 113 winNotify_->unlockWindow (rank) ;112 winNotify_->unlockWindowExclusive(rank) ; 114 113 } 115 114 … … 170 169 int commRank ; 171 170 MPI_Comm_rank(xiosComm_, &commRank) ; 172 winNotify_->lockWindowExclusive(commRank) ; 173 winNotify_->popFromLockedWindow(commRank, this, &CContextsManager::notificationsDumpIn) ; 174 winNotify_->unlockWindow(commRank) ; 171 winNotify_->popFromExclusiveWindow(commRank, this, &CContextsManager::notificationsDumpIn) ; 175 172 if (notifyType_==NOTIFY_CREATE_CONTEXT) createServerContext() ; 176 173 else if (notifyType_==NOTIFY_CREATE_INTERCOMM) createServerContextIntercomm() ; … … 215 212 contexts_[fullContextId] = contextInfo ; 216 213 winContexts_->updateToLockedWindow(managerGlobalLeader_, this, &CContextsManager::contextsDumpOut) ; 217 winContexts_->unlockWindow (managerGlobalLeader_) ;214 winContexts_->unlockWindowExclusive(managerGlobalLeader_) ; 218 215 } 219 216 … … 227 224 { 228 225 229 winContexts_->lockWindowShared(managerGlobalLeader_) ; 230 winContexts_->updateFromLockedWindow(managerGlobalLeader_, this, &CContextsManager::contextsDumpIn) ; 231 winContexts_->unlockWindow(managerGlobalLeader_) ; 226 winContexts_->updateFromSharedWindow(managerGlobalLeader_, this, &CContextsManager::contextsDumpIn) ; 232 227 233 228 auto it=contexts_.find(fullContextId) ; -
XIOS3/trunk/src/manager/coupler_manager.cpp
r1878 r2517 23 23 if (commRank==managerGlobalLeader_) 24 24 { 25 winRegistredCoupling_->lockWindow(managerGlobalLeader_,0) ; 26 winRegistredCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; 27 winRegistredCoupling_->unlockWindow(managerGlobalLeader_,0) ; 28 29 winNextCoupling_->lockWindow(managerGlobalLeader_,0) ; 30 winNextCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; 31 winNextCoupling_->unlockWindow(managerGlobalLeader_,0) ; 25 winRegistredCoupling_->updateToExclusiveWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; 26 winNextCoupling_->updateToExclusiveWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; 32 27 } 33 28 … … 47 42 size_t key = strHash(getStrCoupling(srcCoupling,dstCoupling)) ; 48 43 49 winRegistredCoupling_->lockWindow (managerGlobalLeader_,0) ;50 winRegistredCoupling_->updateFrom Window(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpIn) ;44 winRegistredCoupling_->lockWindowExclusive(managerGlobalLeader_) ; 45 winRegistredCoupling_->updateFromLockedWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpIn) ; 51 46 if (registredCoupling_.count(key)==1) 52 47 { 53 48 registredCoupling_.erase(key) ; 54 winRegistredCoupling_->updateTo Window(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ;55 winNextCoupling_->lockWindow (managerGlobalLeader_,0) ;56 winNextCoupling_->updateFrom Window(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ;49 winRegistredCoupling_->updateToLockedWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; 50 winNextCoupling_->lockWindowExclusive(managerGlobalLeader_) ; 51 winNextCoupling_->updateFromLockedWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ; 57 52 nextCoupling_.push_back(pair<size_t,int>(key,2)) ; 58 winNextCoupling_->updateTo Window(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ;59 winNextCoupling_->unlockWindow (managerGlobalLeader_,0) ;53 winNextCoupling_->updateToLockedWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; 54 winNextCoupling_->unlockWindowExclusive(managerGlobalLeader_) ; 60 55 } 61 56 else 62 57 { 63 58 registredCoupling_.insert(key) ; 64 winRegistredCoupling_->updateTo Window(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ;59 winRegistredCoupling_->updateToLockedWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; 65 60 } 66 winRegistredCoupling_->unlockWindow (managerGlobalLeader_,0) ;61 winRegistredCoupling_->unlockWindowExclusive(managerGlobalLeader_) ; 67 62 } 68 63 … … 73 68 size_t key = strHash(getStrCoupling(srcCoupling,dstCoupling)) ; 74 69 75 winNextCoupling_->lockWindow (managerGlobalLeader_,0) ;76 winNextCoupling_->updateFrom Window(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ;70 winNextCoupling_->lockWindowExclusive(managerGlobalLeader_) ; 71 winNextCoupling_->updateFromLockedWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ; 77 72 if (nextCoupling_.front().first==key) 78 73 { … … 80 75 if (nextCoupling_.front().second==1) nextCoupling_.pop_front() ; 81 76 else nextCoupling_.front().second=1 ; 82 winNextCoupling_->updateTo Window(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ;77 winNextCoupling_->updateToLockedWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; 83 78 } 84 79 else ret=false ; 85 winNextCoupling_->unlockWindow (managerGlobalLeader_,0) ;80 winNextCoupling_->unlockWindowExclusive(managerGlobalLeader_) ; 86 81 return ret ; 87 82 } -
XIOS3/trunk/src/manager/pool_ressource.cpp
r2494 r2517 27 27 28 28 notifyType_=NOTIFY_NOTHING; 29 winNotify_->lockWindow(commRank,0) ; 30 winNotify_->updateToWindow(commRank, this, &CPoolRessource::notificationsDumpOut) ; 31 winNotify_->unlockWindow(commRank,0) ; 29 winNotify_->updateToExclusiveWindow(commRank, this, &CPoolRessource::notificationsDumpOut) ; 32 30 MPI_Barrier(poolComm_) ; 33 31 } … … 104 102 void CPoolRessource::sendNotification(int rank) 105 103 { 106 winNotify_->lockWindowExclusive(rank) ; 107 winNotify_->pushToLockedWindow(rank, this, &CPoolRessource::notificationsDumpOut) ; 108 winNotify_->unlockWindow(rank) ; 104 winNotify_->pushToExclusiveWindow(rank, this, &CPoolRessource::notificationsDumpOut) ; 109 105 } 110 106 … … 113 109 int commRank ; 114 110 MPI_Comm_rank(poolComm_, &commRank) ; 115 winNotify_->lockWindowExclusive(commRank) ; 116 winNotify_->popFromLockedWindow(commRank, this, &CPoolRessource::notificationsDumpIn) ; 117 winNotify_->unlockWindow(commRank) ; 111 winNotify_->popFromExclusiveWindow(commRank, this, &CPoolRessource::notificationsDumpIn) ; 118 112 if (notifyType_==NOTIFY_CREATE_SERVICE) createService() ; 119 113 else if (notifyType_==NOTIFY_CREATE_SERVICE_ONTO) createServiceOnto() ; -
XIOS3/trunk/src/manager/ressources_manager.cpp
r2458 r2517 49 49 info(40)<<"CRessourcesManager::createPool : calling createPool : "<<poolId<<" of size"<<size<<endl ; 50 50 info(40)<<"send notification to leader : "<<serverLeader_<<endl ; 51 winRessources_->lockWindow(managerGlobalLeader_,0) ; 52 winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 53 winRessources_->unlockWindow(managerGlobalLeader_,0) ; 54 51 winRessources_->updateFromExclusiveWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 52 55 53 notifyType_=NOTIFY_CREATE_POOL ; 56 54 notifyCreatePool_=make_tuple(poolId, size) ; … … 61 59 void CRessourcesManager::finalize(void) 62 60 { 63 winRessources_->lockWindow(managerGlobalLeader_,0) ; 64 winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 65 winRessources_->unlockWindow(managerGlobalLeader_,0) ; 61 winRessources_->updateFromExclusiveWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 66 62 67 63 if (serverLeader_!=-1) … … 77 73 winNotify_->lockWindowExclusive(rank) ; 78 74 winNotify_->pushToLockedWindow(rank, this, &CRessourcesManager::notificationsDumpOut) ; 79 winNotify_->unlockWindow (rank) ;75 winNotify_->unlockWindowExclusive(rank) ; 80 76 } 81 77 … … 139 135 CTimer::get("CRessourcesManager::checkNotifications pop").suspend(); 140 136 CTimer::get("CRessourcesManager::checkNotifications unlock").resume(); 141 winNotify_->unlockWindow (commRank) ;137 winNotify_->unlockWindowExclusive(commRank) ; 142 138 CTimer::get("CRessourcesManager::checkNotifications unlock").suspend(); 143 139 if (notifyType_==NOTIFY_CREATE_POOL) createPool() ; … … 196 192 void CRessourcesManager::registerServerLeader(int serverLeaderRank) 197 193 { 198 winRessources_->lockWindow (managerGlobalLeader_,0) ;199 winRessources_->updateFrom Window(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;194 winRessources_->lockWindowExclusive(managerGlobalLeader_) ; 195 winRessources_->updateFromLockedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 200 196 serverLeader_ = serverLeaderRank ; 201 winRessources_->updateTo Window(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;202 winRessources_->unlockWindow (managerGlobalLeader_,0) ;197 winRessources_->updateToLockedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; 198 winRessources_->unlockWindowExclusive(managerGlobalLeader_) ; 203 199 } 204 200 205 201 void CRessourcesManager::registerRessourcesSize(int size) 206 202 { 207 winRessources_->lockWindow (managerGlobalLeader_,0) ;208 winRessources_->updateFrom Window(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;203 winRessources_->lockWindowExclusive(managerGlobalLeader_) ; 204 winRessources_->updateFromLockedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 209 205 ressourcesSize_ = size ; 210 206 freeRessourcesSize_ = size ; 211 winRessources_->updateTo Window(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;212 winRessources_->unlockWindow (managerGlobalLeader_,0) ;207 winRessources_->updateToLockedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; 208 winRessources_->unlockWindowExclusive(managerGlobalLeader_) ; 213 209 } 214 210 … … 216 212 void CRessourcesManager::registerPoolClient(const string& poolId, int size, int leader) 217 213 { 218 winRessources_->lockWindow (managerGlobalLeader_,0) ;219 winRessources_->updateFrom Window(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;214 winRessources_->lockWindowExclusive(managerGlobalLeader_) ; 215 winRessources_->updateFromLockedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 220 216 pools_[poolId] = make_tuple(size, size, leader) ; 221 winRessources_->updateTo Window(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;222 winRessources_->unlockWindow (managerGlobalLeader_,0) ;217 winRessources_->updateToLockedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; 218 winRessources_->unlockWindowExclusive(managerGlobalLeader_) ; 223 219 } 224 220 225 221 void CRessourcesManager::registerPoolServer(const string& poolId, int size, int leader) 226 222 { 227 winRessources_->lockWindow (managerGlobalLeader_,0) ;228 winRessources_->updateFrom Window(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;223 winRessources_->lockWindowExclusive(managerGlobalLeader_) ; 224 winRessources_->updateFromLockedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 229 225 pools_[poolId] = make_tuple(size, size, leader) ; 230 226 freeRessourcesSize_-=size ; 231 winRessources_->updateTo Window(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;232 winRessources_->unlockWindow (managerGlobalLeader_,0) ;227 winRessources_->updateToLockedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; 228 winRessources_->unlockWindowExclusive(managerGlobalLeader_) ; 233 229 } 234 230 235 231 bool CRessourcesManager::getPoolInfo(const string& poolId, int& size, int& freeSize, int& leader) 236 232 { 237 winRessources_->lockWindow(managerGlobalLeader_,0) ; 238 winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 239 winRessources_->unlockWindow(managerGlobalLeader_,0) ; 233 winRessources_->updateFromSharedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 240 234 241 235 auto it=pools_.find(poolId) ; … … 254 248 bool ret ; 255 249 256 winRessources_->lockWindow (managerGlobalLeader_,0) ;257 winRessources_->updateFrom Window(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ;250 winRessources_->lockWindowExclusive(managerGlobalLeader_) ; 251 winRessources_->updateFromLockedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 258 252 259 253 … … 266 260 ret=true ; 267 261 } 268 winRessources_->updateTo Window(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ;269 winRessources_->unlockWindow (managerGlobalLeader_,0) ;262 winRessources_->updateToLockedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpOut) ; 263 winRessources_->unlockWindowExclusive(managerGlobalLeader_) ; 270 264 271 265 return ret ; … … 274 268 int CRessourcesManager::getRessourcesSize(void) 275 269 { 276 winRessources_->lockWindow(managerGlobalLeader_,0) ; 277 winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 278 winRessources_->unlockWindow(managerGlobalLeader_,0) ; 279 270 winRessources_->updateFromSharedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 271 280 272 return ressourcesSize_ ; 281 273 } … … 283 275 int CRessourcesManager::getFreeRessourcesSize(void) 284 276 { 285 winRessources_->lockWindow(managerGlobalLeader_,0) ; 286 winRessources_->updateFromWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 287 winRessources_->unlockWindow(managerGlobalLeader_,0) ; 277 winRessources_->updateFromSharedWindow(managerGlobalLeader_, this, &CRessourcesManager::ressourcesDumpIn) ; 288 278 289 279 return freeRessourcesSize_ ; -
XIOS3/trunk/src/manager/server_context.cpp
r2274 r2517 160 160 void CServerContext::sendNotification(int rank) 161 161 { 162 winNotify_->lockWindowExclusive(rank) ; 163 winNotify_->pushToLockedWindow(rank, this, &CServerContext::notificationsDumpOut) ; 164 winNotify_->unlockWindow(rank) ; 162 winNotify_->pushToExclusiveWindow(rank, this, &CServerContext::notificationsDumpOut) ; 165 163 } 166 164 … … 201 199 int commRank ; 202 200 MPI_Comm_rank(contextComm_, &commRank) ; 203 winNotify_->lockWindowExclusive(commRank) ; 204 winNotify_->popFromLockedWindow(commRank, this, &CServerContext::notificationsDumpIn) ; 205 winNotify_->unlockWindow(commRank) ; 206 201 winNotify_->popFromExclusiveWindow(commRank, this, &CServerContext::notificationsDumpIn) ; 202 207 203 if (notifyInType_!= NOTIFY_NOTHING) 208 204 { -
XIOS3/trunk/src/manager/servers_ressource.cpp
r2458 r2517 81 81 void CServersRessource::sendNotification(int rank) 82 82 { 83 winNotify_->lockWindow(rank,0) ; 84 winNotify_->pushToWindow(rank, this, &CServersRessource::notificationsDumpOut) ; 85 winNotify_->unlockWindow(rank,0) ; 83 winNotify_->pushToExclusiveWindow(rank, this, &CServersRessource::notificationsDumpOut) ; 86 84 } 87 85 … … 146 144 int commRank ; 147 145 MPI_Comm_rank(serverComm_, &commRank) ; 148 winNotify_->lockWindow(commRank,0) ; 149 winNotify_->popFromWindow(commRank, this, &CServersRessource::notificationsDumpIn) ; 150 winNotify_->unlockWindow(commRank,0) ; 146 winNotify_->popFromExclusiveWindow(commRank, this, &CServersRessource::notificationsDumpIn) ; 151 147 if (notifyInType_==NOTIFY_CREATE_POOL) createPool() ; 152 148 else if (notifyInType_==NOTIFY_FINALIZE) finalizeSignal() ; -
XIOS3/trunk/src/manager/services.cpp
r2486 r2517 27 27 28 28 winNotify_ = new CWindowManager(serviceComm_, maxBufferSize_) ; 29 winNotify_->lockWindow(localRank,0) ; 30 winNotify_->updateToWindow(localRank, this, &CService::createContextDumpOut) ; 31 winNotify_->unlockWindow(localRank,0) ; 29 winNotify_->updateToExclusiveWindow(localRank, this, &CService::createContextDumpOut) ; 32 30 MPI_Barrier(serviceComm_) ; 33 31 if (localRank==localLeader_) … … 74 72 void CService::createContextNotify(int rank, const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) 75 73 { 76 winNotify_->lockWindow (rank,0) ;77 winNotify_->updateFrom Window(rank, this, &CService::createContextDumpIn) ;74 winNotify_->lockWindowExclusive(rank) ; 75 winNotify_->updateFromLockedWindow(rank, this, &CService::createContextDumpIn) ; 78 76 notifications_.push_back(std::make_tuple(poolId, serviceId, partitionId, contextId)) ; 79 winNotify_->updateTo Window(rank, this, &CService::createContextDumpOut) ;80 winNotify_->unlockWindow (rank,0) ;77 winNotify_->updateToLockedWindow(rank, this, &CService::createContextDumpOut) ; 78 winNotify_->unlockWindowExclusive(rank) ; 81 79 } 82 80 … … 143 141 void CService::sendNotification(int rank) 144 142 { 145 winNotify_->lockWindowExclusive(rank) ; 146 winNotify_->pushToLockedWindow(rank, this, &CService::notificationsDumpOut) ; 147 winNotify_->unlockWindow(rank) ; 143 winNotify_->pushToExclusiveWindow(rank, this, &CService::notificationsDumpOut) ; 148 144 } 149 145 … … 187 183 int commRank ; 188 184 MPI_Comm_rank(serviceComm_, &commRank) ; 189 winNotify_->lockWindowExclusive(commRank) ; 190 winNotify_->popFromLockedWindow(commRank, this, &CService::notificationsDumpIn) ; 191 winNotify_->unlockWindow(commRank) ; 192 185 winNotify_->popFromExclusiveWindow(commRank, this, &CService::notificationsDumpIn) ; 186 193 187 if (notifyInType_!= NOTIFY_NOTHING) 194 188 { … … 227 221 int commRank ; 228 222 MPI_Comm_rank(serviceComm_, &commRank) ; 229 winNotify_->lockWindow (commRank,0) ;230 winNotify_->updateFrom Window(commRank, this, &CService::createContextDumpIn) ;223 winNotify_->lockWindowExclusive(commRank) ; 224 winNotify_->updateFromLockedWindow(commRank, this, &CService::createContextDumpIn) ; 231 225 232 226 if (!notifications_.empty()) … … 235 229 createNewContext(get<0>(info), get<1>(info), get<2>(info), get<3>(info)) ; 236 230 notifications_.pop_front() ; 237 winNotify_->updateTo Window(commRank, this, &CService::createContextDumpOut) ;238 } 239 winNotify_->unlockWindow (commRank,0) ;231 winNotify_->updateToLockedWindow(commRank, this, &CService::createContextDumpOut) ; 232 } 233 winNotify_->unlockWindowExclusive(commRank) ; 240 234 } 241 235 -
XIOS3/trunk/src/manager/services_manager.cpp
r2507 r2517 31 31 MPI_Comm_rank(xiosComm_, &commRank) ; 32 32 winNotify_ = new CWindowManager(xiosComm_, maxBufferSize_) ; 33 winNotify_->lockWindow(commRank,0) ; 34 winNotify_->updateToWindow(commRank, this, &CServicesManager::notificationsDumpOut) ; 35 winNotify_->unlockWindow(commRank,0) ; 33 winNotify_->updateToExclusiveWindow(commRank, this, &CServicesManager::notificationsDumpOut) ; 36 34 37 35 winServices_ = new CWindowManager(xiosComm_, maxBufferSize_) ; 38 winServices_->lockWindow(commRank,0) ; 39 winServices_->updateToWindow(commRank, this, &CServicesManager::servicesDumpOut) ; 40 winServices_->unlockWindow(commRank,0) ; 41 36 winServices_->updateToExclusiveWindow(commRank, this, &CServicesManager::servicesDumpOut) ; 37 42 38 MPI_Barrier(xiosComm_) ; 43 39 } … … 121 117 void CServicesManager::sendNotification(int rank) 122 118 { 123 winNotify_->lockWindowExclusive(rank) ; 124 winNotify_->pushToLockedWindow(rank, this, &CServicesManager::notificationsDumpOut) ; 125 winNotify_->unlockWindow(rank) ; 119 winNotify_->pushToExclusiveWindow(rank, this, &CServicesManager::notificationsDumpOut) ; 126 120 } 127 121 … … 147 141 int commRank ; 148 142 MPI_Comm_rank(xiosComm_, &commRank) ; 149 winNotify_->lockWindowExclusive(commRank) ; 150 winNotify_->popFromLockedWindow(commRank, this, &CServicesManager::notificationsDumpIn) ; 151 winNotify_->unlockWindow(commRank) ; 143 winNotify_->popFromExclusiveWindow(commRank, this, &CServicesManager::notificationsDumpIn) ; 152 144 if (notifyType_==NOTIFY_CREATE_SERVICE) createService() ; 153 145 else if (notifyType_==NOTIFY_CREATE_SERVICE_ONTO) createServiceOnto() ; … … 253 245 services_[std::tuple<std::string, std::string,int>(poolId,serviceId,partitionId)]=std::make_tuple(type,size,nbPartitions,leader) ; 254 246 winServices_->updateToLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpOut) ; 255 winServices_->unlockWindow (managerGlobalLeader_) ;247 winServices_->unlockWindowExclusive(managerGlobalLeader_) ; 256 248 257 249 } … … 260 252 int& size, int& nbPartitions, int& leader, bool wait) 261 253 { 262 winServices_->lockWindowShared(managerGlobalLeader_) ; 263 winServices_->updateFromLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; 264 winServices_->unlockWindow(managerGlobalLeader_) ; 254 winServices_->updateFromSharedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; 265 255 266 256 if (wait) waitServiceRegistration(poolId, serviceId, partitionId) ; … … 303 293 bool CServicesManager::hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) 304 294 { 305 winServices_->lockWindowShared(managerGlobalLeader_) ; 306 winServices_->updateFromLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; 307 winServices_->unlockWindow(managerGlobalLeader_) ; 295 winServices_->updateFromSharedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; 308 296 auto it=services_.find(std::tuple<std::string, std::string, int>(poolId, serviceId, partitionId)) ; 309 297 if ( it == services_.end()) return false ; -
XIOS3/trunk/src/manager/window_manager.cpp
r1761 r2517 7 7 { 8 8 9 9 const MPI_Aint CWindowManager::OFFSET_LOCK ; 10 const int CWindowManager::SIZE_LOCK ; 11 const MPI_Aint CWindowManager::OFFSET_BUFFER_SIZE ; 12 const int CWindowManager::SIZE_BUFFER_SIZE ; 13 const MPI_Aint CWindowManager::OFFSET_BUFFER; 14 const int CWindowManager::WINDOWS_LOCKED ; 10 15 } 11 16 -
XIOS3/trunk/src/manager/window_manager.hpp
r2263 r2517 7 7 #include "buffer_out.hpp" 8 8 #include "message.hpp" 9 #include "window_base.hpp" 9 10 10 11 namespace xios … … 12 13 13 14 14 class CWindowManager 15 class CWindowManager : public CWindowBase 15 16 { 16 17 17 18 private : 18 const MPI_Aint OFFSET_LOCK=0 ;19 const int SIZE_LOCK=sizeof(int) ;20 const MPI_Aint OFFSET_BUFFER_SIZE=OFFSET_LOCK+SIZE_LOCK ;21 const int SIZE_BUFFER_SIZE=sizeof(size_t) ;22 const MPI_Aint OFFSET_BUFFER=OFFSET_BUFFER_SIZE+SIZE_BUFFER_SIZE ;23 const int WINDOWS_LOCKED=-1 ;19 static const MPI_Aint OFFSET_LOCK=0 ; 20 static const int SIZE_LOCK=sizeof(int) ; 21 static const MPI_Aint OFFSET_BUFFER_SIZE=OFFSET_LOCK+SIZE_LOCK ; 22 static const int SIZE_BUFFER_SIZE=sizeof(size_t) ; 23 static const MPI_Aint OFFSET_BUFFER=OFFSET_BUFFER_SIZE+SIZE_BUFFER_SIZE ; 24 static const int WINDOWS_LOCKED=-1 ; 24 25 25 26 MPI_Win window_ ; … … 30 31 public : 31 32 32 CWindowManager(MPI_Comm winComm, size_t bufferSize) 33 { 34 const MPI_Aint windowSize=bufferSize+OFFSET_BUFFER ; 35 MPI_Win_allocate(windowSize, 1, MPI_INFO_NULL, winComm, &winBuffer_, &window_) ; 33 CWindowManager(MPI_Comm winComm, size_t bufferSize) : CWindowBase(winComm, bufferSize + OFFSET_BUFFER_SIZE) 34 { 36 35 int lock=0 ; 37 36 size_t size=0 ; 38 37 int commRank ; 39 38 MPI_Comm_rank(winComm, &commRank) ; 40 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, commRank, 0, window_) ;41 MPI_Put(&lock, SIZE_LOCK, MPI_CHAR, commRank, OFFSET_LOCK, SIZE_LOCK, MPI_CHAR, window_) ;42 MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, commRank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ;43 MPI_Win_unlock(commRank, window_) ;39 lockExclusive(commRank) ; 40 put(&lock, SIZE_LOCK, MPI_CHAR, commRank, OFFSET_LOCK, SIZE_LOCK, MPI_CHAR) ; 41 put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, commRank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR) ; 42 unlockExclusive(commRank) ; 44 43 MPI_Barrier(winComm) ; 45 44 } … … 63 62 int flag ; 64 63 MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); 65 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; 66 MPI_Compare_and_swap(&WINDOWS_LOCKED, &state, &lock, MPI_INT, rank, OFFSET_LOCK, window_) ; 67 MPI_Win_unlock(rank, window_) ; 64 compareAndSwap(&WINDOWS_LOCKED, &state, &lock, MPI_INT, rank, OFFSET_LOCK) ; 65 flush(rank) ; 68 66 lastTime=MPI_Wtime() ; 69 67 } while (lock!=state) ; … … 90 88 int flag ; 91 89 MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); 92 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ;93 MPI_Compare_and_swap(&WINDOWS_LOCKED, &state, &lock, MPI_INT, rank, OFFSET_LOCK, window_) ;94 MPI_Win_unlock(rank, window_) ;90 lockExclusive(rank) ; 91 compareAndSwap(&WINDOWS_LOCKED, &state, &lock, MPI_INT, rank, OFFSET_LOCK) ; 92 unlockExclusive(rank) ; 95 93 lastTime=MPI_Wtime() ; 96 94 } while (lock!=state) ; … … 99 97 void lockWindowExclusive(int rank) 100 98 { 101 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ;99 lockExclusive(rank) ; 102 100 } 103 101 104 102 void lockWindowShared(int rank) 105 103 { 106 MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ; 107 } 108 104 lockShared(rank) ; 105 } 106 107 void unlockWindowExclusive(int rank) 108 { 109 unlockExclusive(rank) ; 110 } 111 112 void unlockWindowShared(int rank) 113 { 114 unlockShared(rank) ; 115 } 116 117 void lockWindow(int rank) 118 { 119 lockWindowExclusive(rank) ; 120 } 121 109 122 void unlockWindow(int rank) 110 123 { 111 MPI_Win_unlock(rank, window_) ;124 unlockWindowExclusive(rank) ; 112 125 } 113 126 114 127 void flushWindow(int rank) 115 128 { 116 MPI_Win_flush(rank, window_) ;129 flush(rank) ; 117 130 } 118 131 … … 120 133 { 121 134 int lock ; 122 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; 123 MPI_Compare_and_swap(&state, &WINDOWS_LOCKED, &lock, MPI_INT, rank, OFFSET_LOCK, window_) ; 124 MPI_Win_unlock(rank, window_) ; 135 compareAndSwap(&state, &WINDOWS_LOCKED, &lock, MPI_INT, rank, OFFSET_LOCK) ; 136 flush(rank) ; 125 137 } 126 138 127 139 template< class T > 128 140 void updateToWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 141 { 142 updateToExclusiveWindow(rank, object, dumpOut) ; 143 } 144 145 template< class T > 146 void updateToExclusiveWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 147 { 148 lockExclusive(rank) ; 149 updateToLockedWindow(rank, object, dumpOut) ; 150 unlockExclusive(rank) ; 151 } 152 153 template< class T > 154 void updateTosharedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 155 { 156 lockShared(rank) ; 157 updateToLockedWindow(rank, object, dumpOut) ; 158 unlockShared(rank) ; 159 } 160 161 template< class T > 162 void updateToLockedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 129 163 { 130 164 CBufferOut buffer ; 131 165 (object->*dumpOut)(buffer) ; 132 166 size_t size=buffer.count() ; 133 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; 134 MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 135 MPI_Put(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; 136 MPI_Win_unlock(rank, window_) ; 137 } 138 139 template< class T > 140 void updateToExclusiveWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 141 { 142 CBufferOut buffer ; 143 (object->*dumpOut)(buffer) ; 144 size_t size=buffer.count() ; 145 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; 146 MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 147 MPI_Put(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; 148 MPI_Win_unlock(rank, window_) ; 149 } 150 151 template< class T > 152 void updateTosharedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 153 { 154 CBufferOut buffer ; 155 (object->*dumpOut)(buffer) ; 156 size_t size=buffer.count() ; 157 MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ; 158 MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 159 MPI_Put(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; 160 MPI_Win_unlock(rank, window_) ; 161 } 162 163 template< class T > 164 void updateToLockedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 165 { 166 CBufferOut buffer ; 167 (object->*dumpOut)(buffer) ; 168 size_t size=buffer.count() ; 169 // MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; 170 MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 171 MPI_Put(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; 172 MPI_Win_flush(rank, window_) ; 173 // MPI_Win_unlock(rank, window_) ; 167 168 put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR) ; 169 put(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR) ; 170 flush(rank) ; 174 171 } 175 172 … … 177 174 void updateFromWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 178 175 { 179 size_t size ; 180 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; 181 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 182 MPI_Win_flush(rank,window_) ; 176 updateFromExclusiveWindow(rank,object, dumpIn) ; 177 } 178 179 template< typename T > 180 void updateFromExclusiveWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 181 { 182 size_t size ; 183 lockExclusive(rank) ; 184 updateFromLockedWindow(rank,object, dumpIn) ; 185 unlockExclusive(rank) ; 186 } 187 188 template< typename T > 189 void updateFromSharedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 190 { 191 size_t size ; 192 lockShared(rank) ; 193 updateFromLockedWindow(rank,object, dumpIn) ; 194 unlockShared(rank) ; 195 } 196 197 template< typename T > 198 void updateFromLockedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 199 { 200 size_t size ; 201 202 get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR) ; 203 flush(rank) ; 183 204 CBufferIn buffer(size) ; 184 MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; 185 MPI_Win_unlock(rank, window_) ; 205 get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR) ; 206 flush(rank) ; 207 186 208 (object->*dumpIn)(buffer) ; 187 209 } 188 210 189 template< typename T >190 void updateFromExclusiveWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) )191 {192 size_t size ;193 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ;194 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ;195 MPI_Win_flush(rank,window_) ;196 CBufferIn buffer(size) ;197 MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ;198 MPI_Win_unlock(rank, window_) ;199 (object->*dumpIn)(buffer) ;200 }201 202 template< typename T >203 void updateFromSharedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) )204 {205 size_t size ;206 MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ;207 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ;208 MPI_Win_flush(rank,window_) ;209 CBufferIn buffer(size) ;210 MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ;211 MPI_Win_unlock(rank, window_) ;212 (object->*dumpIn)(buffer) ;213 }214 215 template< typename T >216 void updateFromLockedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) )217 {218 size_t size ;219 // MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ;220 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ;221 MPI_Win_flush(rank,window_) ;222 CBufferIn buffer(size) ;223 MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ;224 // MPI_Win_unlock(rank, window_) ;225 MPI_Win_flush(rank, window_) ;226 (object->*dumpIn)(buffer) ;227 }228 211 229 212 … … 231 214 void pushToWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 232 215 { 233 size_t size ; 234 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; 235 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 236 MPI_Win_flush(rank,window_) ; 216 pushToExclusiveWindow(rank, object, dumpOut) ; 217 } 218 219 template< class T > 220 void pushToExclusiveWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 221 { 222 lockExclusive(rank) ; 223 pushToLockedWindow(rank, object, dumpOut) ; 224 unlockExclusive(rank) ; 225 } 226 227 template< class T > 228 void pushToSharedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 229 { 230 lockShared(rank) ; 231 pushToLockedWindow(rank, object, dumpOut) ; 232 unlockShared(rank) ; 233 } 234 235 template< class T > 236 void pushToLockedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 237 { 238 size_t size ; 239 get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR) ; 240 flush(rank) ; 237 241 CBufferOut buffer ; 238 242 (object->*dumpOut)(buffer) ; 239 243 size_t bufferSize=buffer.count() ; 240 244 size_t newSize = size + bufferSize; 241 MPI_Put(&newSize, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 242 MPI_Put(buffer.start(), bufferSize, MPI_CHAR, rank, OFFSET_BUFFER+size, bufferSize, MPI_CHAR, window_) ; 243 MPI_Win_unlock(rank, window_) ; 244 } 245 246 template< class T > 247 void pushToExclusiveWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 248 { 249 size_t size ; 250 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; 251 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 252 MPI_Win_flush(rank,window_) ; 253 CBufferOut buffer ; 254 (object->*dumpOut)(buffer) ; 255 size_t bufferSize=buffer.count() ; 256 size_t newSize = size + bufferSize; 257 MPI_Put(&newSize, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 258 MPI_Put(buffer.start(), bufferSize, MPI_CHAR, rank, OFFSET_BUFFER+size, bufferSize, MPI_CHAR, window_) ; 259 MPI_Win_unlock(rank, window_) ; 260 } 261 262 template< class T > 263 void pushToSharedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 264 { 265 size_t size ; 266 MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ; 267 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 268 MPI_Win_flush(rank,window_) ; 269 CBufferOut buffer ; 270 (object->*dumpOut)(buffer) ; 271 size_t bufferSize=buffer.count() ; 272 size_t newSize = size + bufferSize; 273 MPI_Put(&newSize, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 274 MPI_Put(buffer.start(), bufferSize, MPI_CHAR, rank, OFFSET_BUFFER+size, bufferSize, MPI_CHAR, window_) ; 275 MPI_Win_unlock(rank, window_) ; 276 } 277 278 template< class T > 279 void pushToLockedWindow(int rank, T* object, void (T::*dumpOut)(CBufferOut&) ) 280 { 281 size_t size ; 282 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 283 MPI_Win_flush(rank,window_) ; 284 CBufferOut buffer ; 285 (object->*dumpOut)(buffer) ; 286 size_t bufferSize=buffer.count() ; 287 size_t newSize = size + bufferSize; 288 MPI_Put(&newSize, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 289 MPI_Put(buffer.start(), bufferSize, MPI_CHAR, rank, OFFSET_BUFFER+size, bufferSize, MPI_CHAR, window_) ; 290 MPI_Win_flush(rank, window_) ; 291 } 245 put(&newSize, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR) ; 246 put(buffer.start(), bufferSize, MPI_CHAR, rank, OFFSET_BUFFER+size, bufferSize, MPI_CHAR) ; 247 flush(rank) ; 248 } 249 250 292 251 293 252 template< typename T > 294 253 void popFromWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 295 254 { 296 size_t size ; 297 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; 298 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 299 MPI_Win_flush(rank,window_) ; 255 popFromExclusiveWindow(rank,object, dumpIn) ; 256 } 257 258 template< typename T > 259 void popFromExclusiveWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 260 { 261 lockExclusive(rank) ; 262 popFromLockedWindow(rank,object, dumpIn) ; 263 unlockExclusive(rank) ; 264 265 } 266 267 template< typename T > 268 void popFromSharedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 269 { 270 lockShared(rank) ; 271 popFromLockedWindow(rank,object, dumpIn) ; 272 unlockShared(rank) ; 273 } 274 275 template< typename T > 276 void popFromLockedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 277 { 278 size_t size ; 279 get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR) ; 280 flush(rank) ; 300 281 CBufferIn buffer(size) ; 301 MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ;302 MPI_Win_flush(rank,window_) ;282 get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR) ; 283 flush(rank) ; 303 284 (object->*dumpIn)(buffer) ; 304 285 305 286 size=buffer.remain() ; 306 MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 307 MPI_Put(buffer.ptr(),buffer.remain(), MPI_CHAR, rank, OFFSET_BUFFER, buffer.remain(), MPI_CHAR, window_) ; 308 MPI_Win_unlock(rank, window_) ; 309 310 } 311 312 template< typename T > 313 void popFromExclusiveWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 314 { 315 size_t size ; 316 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, window_) ; 317 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 318 MPI_Win_flush(rank,window_) ; 319 CBufferIn buffer(size) ; 320 MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; 321 MPI_Win_flush(rank,window_) ; 322 (object->*dumpIn)(buffer) ; 323 324 size=buffer.remain() ; 325 MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 326 MPI_Put(buffer.ptr(),buffer.remain(), MPI_CHAR, rank, OFFSET_BUFFER, buffer.remain(), MPI_CHAR, window_) ; 327 MPI_Win_unlock(rank, window_) ; 328 329 } 330 331 template< typename T > 332 void popFromSharedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 333 { 334 size_t size ; 335 MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, window_) ; 336 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 337 MPI_Win_flush(rank,window_) ; 338 CBufferIn buffer(size) ; 339 MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; 340 MPI_Win_flush(rank,window_) ; 341 (object->*dumpIn)(buffer) ; 342 343 size=buffer.remain() ; 344 MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 345 MPI_Put(buffer.ptr(),buffer.remain(), MPI_CHAR, rank, OFFSET_BUFFER, buffer.remain(), MPI_CHAR, window_) ; 346 MPI_Win_unlock(rank, window_) ; 347 348 } 349 350 template< typename T > 351 void popFromLockedWindow(int rank, T* object, void (T::*dumpIn)(CBufferIn&) ) 352 { 353 size_t size ; 354 MPI_Get(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 355 MPI_Win_flush(rank,window_) ; 356 CBufferIn buffer(size) ; 357 MPI_Get(buffer.start(), size, MPI_CHAR, rank,OFFSET_BUFFER, size, MPI_CHAR, window_) ; 358 MPI_Win_flush(rank,window_) ; 359 (object->*dumpIn)(buffer) ; 360 361 size=buffer.remain() ; 362 MPI_Put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR, window_) ; 363 MPI_Put(buffer.ptr(),buffer.remain(), MPI_CHAR, rank, OFFSET_BUFFER, buffer.remain(), MPI_CHAR, window_) ; 364 MPI_Win_flush(rank, window_) ; 287 put(&size, SIZE_BUFFER_SIZE, MPI_CHAR, rank, OFFSET_BUFFER_SIZE, SIZE_BUFFER_SIZE, MPI_CHAR) ; 288 put(buffer.ptr(),buffer.remain(), MPI_CHAR, rank, OFFSET_BUFFER, buffer.remain(), MPI_CHAR) ; 289 flush(rank) ; 365 290 } 366 291 367 292 ~CWindowManager() 368 293 { 369 MPI_Win_free(&window_) ;370 294 } 371 295 } ;
Note: See TracChangeset
for help on using the changeset viewer.