Ignore:
Timestamp:
08/29/23 17:24:04 (10 months ago)
Author:
ymipsl
Message:

Major update :

  • New method to lock and unlock one-sided windows (window_dynamic) to avoid network overhead
  • Introducing multithreading on server sided to manage more efficiently dead-lock occuring (similar to co-routine which will be available and implemented in futur c++ standard), based on c++ threads
  • Suprression of old "attached mode" which is replaced by online writer and reder filters

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk/src/buffer_server.cpp

    r2309 r2547  
    33#include "buffer_server.hpp" 
    44#include "timer.hpp" 
     5#include "window_dynamic.hpp" 
    56 
    67 
     
    89{ 
    910 
    10   CServerBuffer::CServerBuffer(vector<MPI_Win>& windows, vector<MPI_Aint>& winAddress, int windowsRank, StdSize buffSize)  
     11  CServerBuffer::CServerBuffer(vector<CWindowDynamic*>& windows, vector<MPI_Aint>& winAddress, int windowsRank, StdSize buffSize)  
    1112  : hasWindows(true), windows_(windows), windowsRank_(windowsRank), winAddress_(winAddress) 
    1213  { 
     
    1819    MPI_Alloc_mem(size, MPI_INFO_NULL, &buffer) ; 
    1920    currentWindows=1 ; 
    20     if (windows[0]==MPI_WIN_NULL && windows[1]==MPI_WIN_NULL) hasWindows=false ; 
     21    if (windows[0]==nullptr && windows[1]==nullptr) hasWindows=false ; 
    2122  } 
    2223 
     
    239240    bool ok=false ; 
    240241     
    241     MPI_Group group ; 
    242     int groupSize,groupRank ; 
    243     MPI_Win_get_group(windows_[currentWindows], &group) ; 
    244     MPI_Group_size(group, &groupSize) ; 
    245     MPI_Group_rank(group, &groupRank) ; 
    246      
     242    
    247243    lockBuffer();  
    248244    CTimer::get("getBufferFromClient_locked").resume() ;    
    249245// lock is acquired 
    250246 
    251     MPI_Get(&clientTimeline, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],timeLineOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT,windows_[currentWindows]) ; 
    252     MPI_Get(&clientCount, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],countOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT,windows_[currentWindows]) ; 
    253     MPI_Win_flush(windowsRank_, windows_[currentWindows]) ; 
    254  
     247    windows_[currentWindows]->get(&clientTimeline, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],timeLineOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT) ; 
     248    windows_[currentWindows]->get(&clientCount, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],countOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT) ; 
     249    windows_[currentWindows]->flush(windowsRank_) ; 
     250    
    255251    if (timeLine==clientTimeline) 
    256252    { 
    257253      buffer=(char*)getBuffer(clientCount) ; 
    258254      count=clientCount ; 
    259       MPI_Get(buffer, clientCount, MPI_CHAR, windowsRank_, MPI_Aint_add(winAddress_[currentWindows],4*sizeof(size_t)) , clientCount, MPI_CHAR, windows_[currentWindows]) ; 
     255      windows_[currentWindows]->get(buffer, clientCount, MPI_CHAR, windowsRank_, MPI_Aint_add(winAddress_[currentWindows],4*sizeof(size_t)) , clientCount, MPI_CHAR) ; 
     256       
    260257      clientTimeline = 0 ; 
    261258      clientCount = 0 ; 
    262       MPI_Put(&clientTimeline, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],timeLineOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT,windows_[currentWindows]) ; 
    263       MPI_Put(&clientCount, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],countOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT,windows_[currentWindows]) ; 
     259      windows_[currentWindows]->put(&clientTimeline, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],timeLineOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT) ; 
     260      windows_[currentWindows]->put(&clientCount, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows],countOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT) ; 
    264261 
    265262// release lock 
     
    298295  { 
    299296    if (!hasWindows) return ; 
    300     MPI_Win_lock(MPI_LOCK_EXCLUSIVE,windowsRank_,0,windows_[currentWindows]) ; 
     297    //MPI_Win_lock(MPI_LOCK_EXCLUSIVE,windowsRank_,0,windows_[currentWindows]) ; 
     298    windows_[currentWindows]->lockExclusive(windowsRank_) ; 
    301299  } 
    302300 
     
    304302  { 
    305303    if (!hasWindows) return ; 
    306     MPI_Win_unlock(windowsRank_,windows_[currentWindows]) ; 
     304    windows_[currentWindows]->unlockExclusive(windowsRank_) ; 
    307305  } 
    308306   
     
    313311    lockBuffer();  
    314312// lock is acquired 
    315     MPI_Put(&notify, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows], notifyOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT,windows_[currentWindows]) ; 
     313    windows_[currentWindows]->put(&notify, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows], notifyOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT) ; 
    316314    unlockBuffer() ; 
    317315  } 
     
    324322    lockBuffer();  
    325323// lock is acquired 
    326     MPI_Put(&notify, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows], notifyOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT,windows_[currentWindows]) ; 
     324    windows_[currentWindows]->put(&notify, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows], notifyOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT) ; 
    327325    unlockBuffer() ; 
    328326  } 
Note: See TracChangeset for help on using the changeset viewer.