Changeset 2547 for XIOS3/trunk/src/buffer_server.cpp
- Timestamp:
- 08/29/23 17:24:04 (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/buffer_server.cpp
r2309 r2547 3 3 #include "buffer_server.hpp" 4 4 #include "timer.hpp" 5 #include "window_dynamic.hpp" 5 6 6 7 … … 8 9 { 9 10 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) 11 12 : hasWindows(true), windows_(windows), windowsRank_(windowsRank), winAddress_(winAddress) 12 13 { … … 18 19 MPI_Alloc_mem(size, MPI_INFO_NULL, &buffer) ; 19 20 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 ; 21 22 } 22 23 … … 239 240 bool ok=false ; 240 241 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 247 243 lockBuffer(); 248 244 CTimer::get("getBufferFromClient_locked").resume() ; 249 245 // lock is acquired 250 246 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 255 251 if (timeLine==clientTimeline) 256 252 { 257 253 buffer=(char*)getBuffer(clientCount) ; 258 254 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 260 257 clientTimeline = 0 ; 261 258 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) ; 264 261 265 262 // release lock … … 298 295 { 299 296 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_) ; 301 299 } 302 300 … … 304 302 { 305 303 if (!hasWindows) return ; 306 MPI_Win_unlock(windowsRank_,windows_[currentWindows]) ;304 windows_[currentWindows]->unlockExclusive(windowsRank_) ; 307 305 } 308 306 … … 313 311 lockBuffer(); 314 312 // lock is acquired 315 MPI_Put(¬ify, 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(¬ify, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows], notifyOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT) ; 316 314 unlockBuffer() ; 317 315 } … … 324 322 lockBuffer(); 325 323 // lock is acquired 326 MPI_Put(¬ify, 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(¬ify, 1, MPI_LONG_LONG_INT, windowsRank_ , MPI_Aint_add(winAddress_[currentWindows], notifyOffset_*sizeof(size_t)), 1, MPI_LONG_LONG_INT) ; 327 325 unlockBuffer() ; 328 326 }
Note: See TracChangeset
for help on using the changeset viewer.