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

    r1878 r2517  
    2323    if (commRank==managerGlobalLeader_) 
    2424    { 
    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) ; 
    3227    } 
    3328 
     
    4742    size_t key = strHash(getStrCoupling(srcCoupling,dstCoupling)) ; 
    4843     
    49     winRegistredCoupling_->lockWindow(managerGlobalLeader_,0) ; 
    50     winRegistredCoupling_->updateFromWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpIn) ; 
     44    winRegistredCoupling_->lockWindowExclusive(managerGlobalLeader_) ; 
     45    winRegistredCoupling_->updateFromLockedWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpIn) ; 
    5146    if (registredCoupling_.count(key)==1) 
    5247    { 
    5348      registredCoupling_.erase(key) ; 
    54       winRegistredCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; 
    55       winNextCoupling_->lockWindow(managerGlobalLeader_,0) ; 
    56       winNextCoupling_->updateFromWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ; 
     49      winRegistredCoupling_->updateToLockedWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; 
     50      winNextCoupling_->lockWindowExclusive(managerGlobalLeader_) ; 
     51      winNextCoupling_->updateFromLockedWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ; 
    5752      nextCoupling_.push_back(pair<size_t,int>(key,2)) ; 
    58       winNextCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; 
    59       winNextCoupling_->unlockWindow(managerGlobalLeader_,0) ; 
     53      winNextCoupling_->updateToLockedWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; 
     54      winNextCoupling_->unlockWindowExclusive(managerGlobalLeader_) ; 
    6055    } 
    6156    else  
    6257    { 
    6358      registredCoupling_.insert(key) ; 
    64       winRegistredCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; 
     59      winRegistredCoupling_->updateToLockedWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ; 
    6560    } 
    66     winRegistredCoupling_->unlockWindow(managerGlobalLeader_,0) ; 
     61    winRegistredCoupling_->unlockWindowExclusive(managerGlobalLeader_) ; 
    6762  } 
    6863 
     
    7368    size_t key = strHash(getStrCoupling(srcCoupling,dstCoupling)) ; 
    7469 
    75     winNextCoupling_->lockWindow(managerGlobalLeader_,0) ; 
    76     winNextCoupling_->updateFromWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ; 
     70    winNextCoupling_->lockWindowExclusive(managerGlobalLeader_) ; 
     71    winNextCoupling_->updateFromLockedWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ; 
    7772    if (nextCoupling_.front().first==key) 
    7873    { 
     
    8075      if (nextCoupling_.front().second==1) nextCoupling_.pop_front() ; 
    8176      else nextCoupling_.front().second=1 ; 
    82       winNextCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; 
     77      winNextCoupling_->updateToLockedWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ; 
    8378    } 
    8479    else ret=false ; 
    85     winNextCoupling_->unlockWindow(managerGlobalLeader_,0) ; 
     80    winNextCoupling_->unlockWindowExclusive(managerGlobalLeader_) ; 
    8681    return ret ; 
    8782  } 
Note: See TracChangeset for help on using the changeset viewer.