Changeset 1371 for XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.cpp
- Timestamp:
- 12/12/17 14:09:06 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.cpp
r1353 r1371 155 155 * \return A map associating the server rank with its minimum buffer size. 156 156 */ 157 std::map<int, StdSize> CAxis::getAttributesBufferSize(CContextClient* client, bool bufferForWriting /*= false*/) 157 std::map<int, StdSize> CAxis::getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid, 158 CServerDistributionDescription::ServerDistributionType distType) 158 159 { 159 160 160 161 std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(client); 161 162 162 bool isNonDistributed = (n = n_glo); 163 // bool isNonDistributed = (n_glo == n); 164 bool isDistributed = (orderPositionInGrid == CServerDistributionDescription::defaultDistributedDimension(globalDim.size(), distType)) 165 || (index.numElements() != n_glo); 163 166 164 167 if (client->isServerLeader()) … … 167 170 size_t size = 6 * sizeof(size_t); 168 171 // size estimation for sendNonDistributedValue 169 if (isNonDistributed) 170 size = std::max(size, CArray<double,1>::size(n_glo) + (isCompressible_ ? CArray<int,1>::size(n_glo) : 0)); 172 if (!isDistributed) 173 { 174 // size = std::max(size, CArray<double,1>::size(n_glo) + (isCompressible_ ? CArray<int,1>::size(n_glo) : 0)); 175 size += CArray<int,1>::size(n_glo); 176 size += CArray<int,1>::size(n_glo); 177 size += CArray<bool,1>::size(n_glo); 178 size += CArray<double,1>::size(n_glo); 179 if (hasBounds) 180 size += CArray<double,2>::size(2*n_glo); 181 if (hasLabel) 182 size += CArray<StdString,1>::size(n_glo); 183 } 171 184 size += CEventClient::headerSize + getId().size() + sizeof(size_t); 172 185 … … 177 190 attributesSizes[*itRank] = size; 178 191 } 192 const std::list<int>& ranksNonLeaders = client->getRanksServerNotLeader(); 193 for (std::list<int>::const_iterator itRank = ranksNonLeaders.begin(), itRankEnd = ranksNonLeaders.end(); itRank != itRankEnd; ++itRank) 194 { 195 if (size > attributesSizes[*itRank]) 196 attributesSizes[*itRank] = size; 197 } 198 179 199 } 180 200 181 if ( !isNonDistributed)201 if (isDistributed) 182 202 { 183 203 // size estimation for sendDistributedValue … … 185 205 for (it = indSrv_[client->serverSize].begin(); it != ite; ++it) 186 206 { 187 size_t size IndexEvent = CArray<int,1>::size(it->second.size());188 // if (isCompressible_)189 // sizeIndexEvent += CArray<int,1>::size(indWrittenSrv_[it->first].size());190 191 size _t sizeValEvent= CArray<double,1>::size(it->second.size());207 size_t size = 6 * sizeof(size_t); 208 size += CArray<int,1>::size(it->second.size()); 209 size += CArray<int,1>::size(it->second.size()); 210 size += CArray<bool,1>::size(it->second.size()); 211 size += CArray<double,1>::size(it->second.size()); 192 212 if (hasBounds) 193 sizeValEvent += CArray<double,2>::size(2 * it->second.size()); 194 213 size += CArray<double,2>::size(2 * it->second.size()); 195 214 if (hasLabel) 196 size ValEvent+= CArray<StdString,1>::size(it->second.size());197 198 size _t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeValEvent);215 size += CArray<StdString,1>::size(it->second.size()); 216 217 size += CEventClient::headerSize + getId().size() + sizeof(size_t); 199 218 if (size > attributesSizes[it->first]) 200 219 attributesSizes[it->first] = size;
Note: See TracChangeset
for help on using the changeset viewer.