Changeset 2259 for XIOS/dev/dev_ym/XIOS_COUPLING/src/buffer_client.cpp
- Timestamp:
- 11/17/21 16:56:04 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/buffer_client.cpp
r2258 r2259 14 14 size_t CClientBuffer::maxRequestSize = 0; 15 15 16 CClientBuffer::CClientBuffer(MPI_Comm interComm, vector<MPI_Win>& windows, int clientRank,int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize)16 CClientBuffer::CClientBuffer(MPI_Comm interComm, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize) 17 17 : interComm(interComm) 18 18 , clientRank_(0) … … 25 25 , pending(false) 26 26 , hasWindows(false) 27 , windows_(windows) 28 { 29 if (windows[0]==MPI_WIN_NULL && windows[1]==MPI_WIN_NULL) hasWindows=false ; 30 else hasWindows=true ; 27 { 28 /* 29 if (windows[0]==MPI_WIN_NULL && windows[1]==MPI_WIN_NULL) hasWindows=false ; 30 else hasWindows=true ; 31 */ 31 32 32 33 MPI_Alloc_mem(bufferSize+headerSize_, MPI_INFO_NULL, &bufferHeader[0]) ; … … 86 87 MPI_Aint CClientBuffer::getWinAddress(int i) 87 88 { 88 MPI_Aint address ; 89 90 if (hasWindows) MPI_Get_address(bufferHeader[i], &address) ; 91 else address=0 ; 92 93 return address ; 94 } 89 MPI_Aint address ; 90 MPI_Get_address(bufferHeader[i], &address) ; 91 return address ; 92 } 93 94 void CClientBuffer::attachWindows(vector<MPI_Win>& windows) 95 { 96 windows_=windows ; 97 if (windows_[0]==MPI_WIN_NULL && windows_[1]==MPI_WIN_NULL) hasWindows=false ; 98 else hasWindows=true ; 99 100 if (hasWindows) 101 { 102 MPI_Aint buffSize=bufferSize+headerSize_ ; 103 MPI_Win_attach(windows_[0], bufferHeader[0], buffSize) ; 104 MPI_Win_attach(windows_[1], bufferHeader[1], buffSize) ; 105 106 MPI_Group group ; 107 int groupSize,groupRank ; 108 MPI_Win_get_group(windows_[0], &group) ; 109 MPI_Group_size(group, &groupSize) ; 110 MPI_Group_rank(group, &groupRank) ; 111 if (groupRank!=clientRank_) ERROR("CClientBuffer::CClientBuffer",<< " ClientRank != groupRank "<<clientRank_<<" "<<groupRank); 112 113 MPI_Win_get_group(windows_[1], &group) ; 114 MPI_Group_size(group, &groupSize) ; 115 MPI_Group_rank(group, &groupRank) ; 116 if (groupRank!=clientRank_) ERROR("CClientBuffer::CClientBuffer",<< " ClientRank != groupRank "<<clientRank_<<" "<<groupRank); 117 118 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, clientRank_, 0, windows_[0]) ; 119 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, clientRank_, 0, windows_[1]) ; 120 121 MPI_Win_unlock(clientRank_, windows_[1]) ; 122 MPI_Win_unlock(clientRank_, windows_[0]) ; 123 } 124 125 } 126 95 127 96 128 CClientBuffer::~CClientBuffer() … … 217 249 int flag; 218 250 219 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, clientRank_, 0, windows_[0]) ; 220 MPI_Win_unlock(clientRank_, windows_[0]) ; 221 222 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, clientRank_, 0, windows_[1]) ; 223 MPI_Win_unlock(clientRank_, windows_[1]) ; 224 251 if (hasWindows) 252 { 253 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, clientRank_, 0, windows_[0]) ; 254 MPI_Win_unlock(clientRank_, windows_[0]) ; 255 256 MPI_Win_lock(MPI_LOCK_EXCLUSIVE, clientRank_, 0, windows_[1]) ; 257 MPI_Win_unlock(clientRank_, windows_[1]) ; 258 } 259 225 260 if (pending) 226 261 {
Note: See TracChangeset
for help on using the changeset viewer.