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.cpp

    r2486 r2517  
    2727     
    2828    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) ; 
    3230    MPI_Barrier(serviceComm_) ; 
    3331    if (localRank==localLeader_)  
     
    7472  void CService::createContextNotify(int rank, const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) 
    7573  { 
    76     winNotify_->lockWindow(rank,0) ; 
    77     winNotify_->updateFromWindow(rank, this, &CService::createContextDumpIn) ; 
     74    winNotify_->lockWindowExclusive(rank) ; 
     75    winNotify_->updateFromLockedWindow(rank, this, &CService::createContextDumpIn) ; 
    7876    notifications_.push_back(std::make_tuple(poolId, serviceId, partitionId, contextId)) ; 
    79     winNotify_->updateToWindow(rank, this, &CService::createContextDumpOut) ;   
    80     winNotify_->unlockWindow(rank,0) ;    
     77    winNotify_->updateToLockedWindow(rank, this, &CService::createContextDumpOut) ;   
     78    winNotify_->unlockWindowExclusive(rank) ;    
    8179  } 
    8280 
     
    143141  void CService::sendNotification(int rank) 
    144142  { 
    145     winNotify_->lockWindowExclusive(rank) ; 
    146     winNotify_->pushToLockedWindow(rank, this, &CService::notificationsDumpOut) ; 
    147     winNotify_->unlockWindow(rank) ; 
     143    winNotify_->pushToExclusiveWindow(rank, this, &CService::notificationsDumpOut) ; 
    148144  } 
    149145 
     
    187183        int commRank ; 
    188184        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         
    193187        if (notifyInType_!= NOTIFY_NOTHING) 
    194188        { 
     
    227221    int commRank ; 
    228222    MPI_Comm_rank(serviceComm_, &commRank) ; 
    229     winNotify_->lockWindow(commRank,0) ; 
    230     winNotify_->updateFromWindow(commRank, this, &CService::createContextDumpIn) ; 
     223    winNotify_->lockWindowExclusive(commRank) ; 
     224    winNotify_->updateFromLockedWindow(commRank, this, &CService::createContextDumpIn) ; 
    231225     
    232226    if (!notifications_.empty()) 
     
    235229      createNewContext(get<0>(info), get<1>(info), get<2>(info), get<3>(info)) ; 
    236230      notifications_.pop_front() ; 
    237       winNotify_->updateToWindow(commRank, this, &CService::createContextDumpOut) ;      
    238     } 
    239     winNotify_->unlockWindow(commRank,0) ; 
     231      winNotify_->updateToLockedWindow(commRank, this, &CService::createContextDumpOut) ;      
     232    } 
     233    winNotify_->unlockWindowExclusive(commRank) ; 
    240234  } 
    241235 
Note: See TracChangeset for help on using the changeset viewer.