- Timestamp:
- 12/12/17 14:09:06 (6 years ago)
- Location:
- XIOS/dev/XIOS_DEV_CMIP6/src/node
- Files:
-
- 3 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; -
XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.hpp
r1353 r1371 74 74 CArray<int, 1>& getCompressedIndexToWriteOnServer(MPI_Comm writtenCom); 75 75 76 std::map<int, StdSize> getAttributesBufferSize(CContextClient* client, bool bufferForWriting = false); 76 std::map<int, StdSize> getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid, 77 CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); 77 78 78 79 /// Test /// -
XIOS/dev/XIOS_DEV_CMIP6/src/node/grid.cpp
r1353 r1371 111 111 // The grid indexes require a similar size as the actual data 112 112 std::map<int, StdSize> dataSizes = getDataBufferSize(client, "", bufferForWriting); 113 // for (size_t i = 0; i < dataSizes.size(); ++i) 114 // { 115 std::map<int, StdSize>::iterator it, itE = dataSizes.end(); 116 for (it = dataSizes.begin(); it != itE; ++it) 117 { 118 it->second += 2 * sizeof(bool); 119 if (it->second > attributesSizes[it->first]) 120 attributesSizes[it->first] = it->second; 121 } 122 // } 123 113 std::map<int, StdSize>::iterator it, itE = dataSizes.end(); 114 for (it = dataSizes.begin(); it != itE; ++it) 115 { 116 it->second += 2 * sizeof(bool); 117 if (it->second > attributesSizes[it->first]) 118 attributesSizes[it->first] = it->second; 119 } 124 120 125 121 // Account for the axis attributes … … 127 123 for (size_t i = 0; i < axisList.size(); ++i) 128 124 { 129 std::map<int, StdSize> axisAttBuffSize = axisList[i]->getAttributesBufferSize(client );125 std::map<int, StdSize> axisAttBuffSize = axisList[i]->getAttributesBufferSize(client, getGlobalDimension(),axisPositionInGrid_[i]); 130 126 for (it = axisAttBuffSize.begin(), itE = axisAttBuffSize.end(); it != itE; ++it) 131 127 { 128 it->second += 2 * sizeof(bool); 132 129 if (it->second > attributesSizes[it->first]) 133 130 attributesSizes[it->first] = it->second; … … 142 139 for (it = domAttBuffSize.begin(), itE = domAttBuffSize.end(); it != itE; ++it) 143 140 { 141 it->second += 2 * sizeof(bool); 144 142 if (it->second > attributesSizes[it->first]) 145 143 attributesSizes[it->first] = it->second;
Note: See TracChangeset
for help on using the changeset viewer.