Ignore:
Timestamp:
06/12/23 11:52:10 (13 months ago)
Author:
ymipsl
Message:

New way to manage locks in window manager. Windows is locked with MPI_Win_lock_all at creation (shared mode), and lock is manage by software way in the class (using MPI_swap_and_compare and MPI_Fetch_op). We get in this case a better control of lock, with controled latency between each attemp of lock.

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk/src/manager/services_manager.cpp

    r2507 r2517  
    3131    MPI_Comm_rank(xiosComm_, &commRank) ; 
    3232    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) ; 
    3634 
    3735    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    
    4238    MPI_Barrier(xiosComm_)  ;     
    4339  } 
     
    121117  void CServicesManager::sendNotification(int rank) 
    122118  { 
    123     winNotify_->lockWindowExclusive(rank) ; 
    124     winNotify_->pushToLockedWindow(rank, this, &CServicesManager::notificationsDumpOut) ; 
    125     winNotify_->unlockWindow(rank) ; 
     119    winNotify_->pushToExclusiveWindow(rank, this, &CServicesManager::notificationsDumpOut) ; 
    126120  } 
    127121 
     
    147141    int commRank ; 
    148142    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) ; 
    152144    if (notifyType_==NOTIFY_CREATE_SERVICE) createService() ; 
    153145    else if (notifyType_==NOTIFY_CREATE_SERVICE_ONTO) createServiceOnto() ; 
     
    253245    services_[std::tuple<std::string, std::string,int>(poolId,serviceId,partitionId)]=std::make_tuple(type,size,nbPartitions,leader) ; 
    254246    winServices_->updateToLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpOut) ; 
    255     winServices_->unlockWindow(managerGlobalLeader_) ; 
     247    winServices_->unlockWindowExclusive(managerGlobalLeader_) ; 
    256248 
    257249  } 
     
    260252                                        int& size, int& nbPartitions, int& leader, bool wait) 
    261253  { 
    262     winServices_->lockWindowShared(managerGlobalLeader_) ; 
    263     winServices_->updateFromLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; 
    264     winServices_->unlockWindow(managerGlobalLeader_) ; 
     254    winServices_->updateFromSharedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; 
    265255     
    266256    if (wait) waitServiceRegistration(poolId, serviceId, partitionId) ; 
     
    303293  bool CServicesManager::hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) 
    304294  { 
    305     winServices_->lockWindowShared(managerGlobalLeader_) ; 
    306     winServices_->updateFromLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; 
    307     winServices_->unlockWindow(managerGlobalLeader_) ; 
     295    winServices_->updateFromSharedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; 
    308296    auto it=services_.find(std::tuple<std::string, std::string, int>(poolId, serviceId, partitionId)) ; 
    309297    if ( it == services_.end()) return false ; 
Note: See TracChangeset for help on using the changeset viewer.