Changeset 1143
- Timestamp:
- 05/22/17 18:11:12 (6 years ago)
- Location:
- XIOS/dev/dev_olga/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/io/nc4_data_output.cpp
r1132 r1143 379 379 if (domain->hasLonLat) 380 380 { 381 // SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0,&start,&count);382 // SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0,&start,&count);383 381 SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count); 384 382 SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count); … … 396 394 start[0]=0 ; 397 395 count[0]=0 ; 398 // SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0,&start,&count);399 // SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0,&start,&count);400 401 396 SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count); 402 397 SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count); … … 405 400 { 406 401 start[0]=domain->zoom_jbegin-domain->global_zoom_jbegin; 407 count[0]=domain->zoom_nj; 408 // CArray<double,1> lat = domain->latvalue(Range(fromStart,toEnd,domain->zoom_ni)); 402 count[0]=domain->zoom_nj; 409 403 CArray<double,1> lat = writtenLat(Range(fromStart,toEnd,domain->zoom_ni)); 410 404 SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0,&start,&count); 411 405 412 406 start[0]=domain->zoom_ibegin-domain->global_zoom_ibegin; 413 count[0]=domain->zoom_ni; 414 // CArray<double,1> lon=domain->lonvalue(Range(0,domain->zoom_ni-1)); 407 count[0]=domain->zoom_ni; 415 408 CArray<double,1> lon = writtenLon(Range(0,domain->zoom_ni-1)); 416 409 SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0,&start,&count); … … 439 432 count[0] = domain->zoom_nj; 440 433 } 441 442 // SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0, &start, &count); 443 // SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0, &start, &count); 434 444 435 SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0, &start, &count); 445 436 SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0, &start, &count); … … 463 454 count[0] = domain->zoom_nj; 464 455 } 465 466 // SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count); 456 467 457 SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0, &start, &count); 468 458 } … … 1390 1380 SuperClassWriter::addAttribute("compress", compress.str(), &varId); 1391 1381 1392 grid->computeCompressedIndex();1382 // grid->computeCompressedIndex(); 1393 1383 1394 1384 CArray<int, 1> indexes(grid->getNumberWrittenIndexes()); 1395 std::map<int, CArray<size_t, 1> >::const_iterator it; 1396 for (it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 1397 { 1398 const CArray<size_t, 1> compressedIndexes = grid->compressedOutIndexFromClient[it->first]; 1399 for (int i = 0; i < it->second.numElements(); i++) 1400 indexes(compressedIndexes(i)) = it->second(i); 1401 } 1385 indexes = grid->localIndexToWriteOnServer; 1386 // std::map<int, CArray<size_t, 1> >::const_iterator it; 1387 // for (it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 1388 // { 1389 // const CArray<size_t, 1> compressedIndexes = grid->compressedOutIndexFromClient[it->first]; 1390 // for (int i = 0; i < it->second.numElements(); i++) 1391 // indexes(compressedIndexes(i)) = it->second(i); 1392 // } 1402 1393 1403 1394 switch (SuperClass::type) … … 1456 1447 } 1457 1448 1458 const std::vector<int>& indexesToWrite = domain->getIndexesToWrite(); 1459 indexes.resize(indexesToWrite.size()); 1460 for (int n = 0; n < indexes.numElements(); ++n) 1461 indexes(n) = indexesToWrite[n]; 1449 // const std::vector<int>& indexesToWrite = domain->getIndexesToWrite(); 1450 // indexes.resize(indexesToWrite.size()); 1451 // for (int n = 0; n < indexes.numElements(); ++n) 1452 // indexes(n) = indexesToWrite[n]; 1453 1454 indexes.resize(domain->compressedIndexToWriteOnServer.numElements()); 1455 indexes = domain->compressedIndexToWriteOnServer; 1462 1456 1463 1457 isDistributed = domain->isDistributed(); … … 1484 1478 compress = axisId; 1485 1479 1486 const std::vector<int>& indexesToWrite = axis->getIndexesToWrite(); 1487 indexes.resize(indexesToWrite.size()); 1488 for (int n = 0; n < indexes.numElements(); ++n) 1489 indexes(n) = indexesToWrite[n]; 1480 // const std::vector<int>& indexesToWrite = axis->getIndexesToWrite(); 1481 // indexes.resize(indexesToWrite.size()); 1482 // for (int n = 0; n < indexes.numElements(); ++n) 1483 // indexes(n) = indexesToWrite[n]; 1484 1485 indexes.resize(axis->compressedIndexToWriteOnServer.numElements()); 1486 indexes = axis->compressedIndexToWriteOnServer; 1490 1487 1491 1488 isDistributed = axis->isDistributed(); … … 1534 1531 } 1535 1532 1536 if (!dims.empty())1537 grid->computeCompressedIndex();1533 // if (!dims.empty()) 1534 // grid->computeCompressedIndex(); 1538 1535 } 1539 1536 … … 2181 2178 case (ONE_FILE) : 2182 2179 { 2183 // const std::vector<int>& nZoomBeginGlobal = grid->getDistributionServer()->getZoomBeginGlobal();2184 // const std::vector<int>& nZoomBeginServer = grid->getDistributionServer()->getZoomBeginServer();2185 // const std::vector<int>& nZoomSizeServer = grid->getDistributionServer()->getZoomSizeServer();2186 2187 // std::vector<StdSize> start, count;2188 2189 // if (field->getUseCompressedOutput())2190 // {2191 // if (grid->isCompressible())2192 // {2193 // start.push_back(grid->getOffsetWrittenIndexes());2194 // count.push_back(grid->getNumberWrittenIndexes());2195 // }2196 // else2197 // {2198 // CArray<int,1> axisDomainOrder = grid->axis_domain_order;2199 // std::vector<StdString> domainList = grid->getDomainList();2200 // std::vector<StdString> axisList = grid->getAxisList();2201 // int numElement = axisDomainOrder.numElements();2202 // int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1;2203 // int idx = nZoomBeginGlobal.size() - 1;2204 2205 // start.reserve(nZoomBeginGlobal.size());2206 // count.reserve(nZoomBeginGlobal.size());2207 2208 2209 // for (int i = numElement - 1; i >= 0; --i)2210 // {2211 // if (2 == axisDomainOrder(i))2212 // {2213 // CDomain* domain = CDomain::get(domainList[idxDomain]);2214 2215 // if (domain->isCompressible())2216 // {2217 // start.push_back(domain->getOffsetWrittenIndexes());2218 // count.push_back(domain->getNumberWrittenIndexes());2219 // idx -= 2;2220 // }2221 // else2222 // {2223 // if ((domain->type) != CDomain::type_attr::unstructured)2224 // {2225 // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);2226 // count.push_back(nZoomSizeServer[idx]);2227 // }2228 // --idx;2229 // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);2230 // count.push_back(nZoomSizeServer[idx]);2231 // --idx;2232 // }2233 // --idxDomain;2234 // }2235 // else if (1 == axisDomainOrder(i))2236 // {2237 // CAxis* axis = CAxis::get(axisList[idxAxis]);2238 2239 // if (axis->isCompressible())2240 // {2241 // start.push_back(axis->getOffsetWrittenIndexes());2242 // count.push_back(axis->getNumberWrittenIndexes());2243 // }2244 // else2245 // {2246 // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);2247 // count.push_back(nZoomSizeServer[idx]);2248 // }2249 2250 // --idxAxis;2251 // --idx;2252 // }2253 // }2254 // }2255 2180 const std::vector<int>& nZoomBeginGlobal = grid->getDistributionServer()->getZoomBeginGlobal(); 2256 2181 const std::vector<int>& nZoomBeginServer = grid->getDistributionServer()->getZoomBeginServer(); … … 2328 2253 else 2329 2254 { 2330 // CArray<int,1> axisDomainOrder = grid->axis_domain_order;2331 // std::vector<StdString> domainList = grid->getDomainList();2332 // std::vector<StdString> axisList = grid->getAxisList();2333 // int numElement = axisDomainOrder.numElements();2334 // int idxDomain = domainList.size() - 1, idxAxis = axisList.size() - 1;2335 // int idx = nZoomBeginGlobal.size() - 1;2336 2337 // start.reserve(nZoomBeginGlobal.size());2338 // count.reserve(nZoomBeginGlobal.size());2339 2340 // for (int i = numElement - 1; i >= 0; --i)2341 // {2342 // if (2 == axisDomainOrder(i))2343 // {2344 // CDomain* domain = CDomain::get(domainList[idxDomain]);2345 // if ((domain->type) != CDomain::type_attr::unstructured)2346 // {2347 // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);2348 // count.push_back(nZoomSizeServer[idx]);2349 // }2350 // --idx ;2351 // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);2352 // count.push_back(nZoomSizeServer[idx]);2353 // --idx ;2354 // --idxDomain;2355 // }2356 // else if (1 == axisDomainOrder(i))2357 // {2358 // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);2359 // count.push_back(nZoomSizeServer[idx]);2360 // --idx;2361 // }2362 // else2363 // {2364 // if (1 == axisDomainOrder.numElements())2365 // {2366 // start.push_back(0);2367 // count.push_back(1);2368 // }2369 // --idx;2370 // }2371 2255 CArray<int,1> axisDomainOrder = grid->axis_domain_order; 2372 2256 std::vector<StdString> domainList = grid->getDomainList(); … … 2386 2270 if ((domain->type) != CDomain::type_attr::unstructured) 2387 2271 { 2388 // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);2389 // count.push_back(nZoomSizeServer[idx]);2390 // start.push_back((domain->getStartWriteIndex())[idx]);2391 // count.push_back((domain->getCountWriteIndex())[idx]);2392 2272 start.push_back(domain->zoom_jbegin - domain->global_zoom_jbegin); 2393 2273 count.push_back(domain->zoom_nj); 2394 2274 } 2395 2275 --idx ; 2396 // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]); 2397 // count.push_back(nZoomSizeServer[idx]); 2398 // start.push_back((domain->getStartWriteIndex())[idx]); 2399 // count.push_back((domain->getCountWriteIndex())[idx]); 2276 2400 2277 start.push_back(domain->zoom_ibegin - domain->global_zoom_ibegin); 2401 2278 count.push_back(domain->zoom_ni); … … 2405 2282 else if (1 == axisDomainOrder(i)) 2406 2283 { 2407 CAxis* axis = CAxis::get(axisList[idxAxis]); 2408 // start.push_back(axis->getStartWriteIndex()); 2409 // count.push_back(axis->getCountWriteIndex()); 2284 CAxis* axis = CAxis::get(axisList[idxAxis]); 2410 2285 start.push_back(axis->zoom_begin - axis->global_zoom_begin); 2411 2286 count.push_back(axis->zoom_n); -
XIOS/dev/dev_olga/src/node/axis.cpp
r1129 r1143 25 25 , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false) 26 26 , isClientAfterTransformationChecked(false) 27 , isDistributed_(false),hasBounds_(false), isCompressible_(false)27 , hasBounds_(false), isCompressible_(false) 28 28 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 29 29 , transformationMap_(), hasValue(false), doZoomByIndex_(false) … … 36 36 , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false) 37 37 , isClientAfterTransformationChecked(false) 38 , isDistributed_(false),hasBounds_(false), isCompressible_(false)38 , hasBounds_(false), isCompressible_(false) 39 39 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 40 40 , transformationMap_(), hasValue(false), doZoomByIndex_(false) … … 76 76 bool CAxis::isDistributed(void) const 77 77 { 78 return isDistributed_; 78 return (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || 79 (!this->n.isEmpty() && (this->n != this->n_glo));; 79 80 } 80 81 … … 266 267 this->checkZoom(); 267 268 this->checkMask(); 268 this->checkBounds(); 269 270 isDistributed_ = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || 271 (!this->n.isEmpty() && (this->n != this->n_glo)); 269 this->checkBounds(); 272 270 } 273 271 … … 613 611 computedWrittenIndex_ = true; 614 612 615 CContext* context=CContext::getCurrent() ;616 CContext Client* client = context->client;613 CContext* context=CContext::getCurrent(); 614 CContextServer* server = context->server; 617 615 618 616 std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1); … … 621 619 nBeginGlobal[0] = 0; 622 620 nGlob[0] = n_glo; 623 CDistributionServer srvDist( client->clientSize, nBegin, nSize, nBeginGlobal, nGlob);621 CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); 624 622 const CArray<size_t,1>& writtenGlobalIndex = srvDist.getGlobalIndex(); 625 623 … … 628 626 ite = globalLocalIndexMap_.end(), it; 629 627 CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(), 630 itSrve = writtenGlobalIndex.end(), itSrv; 631 localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 628 itSrve = writtenGlobalIndex.end(), itSrv; 629 630 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 631 { 632 indGlo = *itSrv; 633 if (ite != globalLocalIndexMap_.find(indGlo)) 634 { 635 ++nbWritten; 636 } 637 } 638 639 localIndexToWriteOnServer.resize(nbWritten); 640 641 nbWritten = 0; 632 642 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 633 643 { … … 638 648 ++nbWritten; 639 649 } 650 } 651 652 if (isCompressible()) 653 { 654 nbWritten = 0; 655 boost::unordered_map<size_t,size_t> localGlobalIndexMap; 656 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 657 { 658 indGlo = *itSrv; 659 if (ite != globalLocalIndexMap_.find(indGlo)) 660 { 661 localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo; 662 ++nbWritten; 663 } 664 } 665 666 nbWritten = 0; 667 for (int idx = 0; idx < data_index.numElements(); ++idx) 668 { 669 if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) 670 { 671 ++nbWritten; 672 } 673 } 674 675 compressedIndexToWriteOnServer.resize(nbWritten); 676 nbWritten = 0; 677 for (int idx = 0; idx < data_index.numElements(); ++idx) 678 { 679 if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) 680 { 681 compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_index(idx)]; 682 ++nbWritten; 683 } 684 } 685 686 numberWrittenIndexes_ = nbWritten; 687 if (isDistributed()) 688 { 689 690 MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 691 MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 692 offsetWrittenIndexes_ -= numberWrittenIndexes_; 693 } 694 else 695 totalNumberWrittenIndexes_ = numberWrittenIndexes_; 640 696 } 641 697 -
XIOS/dev/dev_olga/src/node/axis.hpp
r1129 r1143 131 131 int orderPosInGrid; 132 132 CArray<size_t,1> localIndexToWriteOnServer; 133 CArray<int, 1> compressedIndexToWriteOnServer; 133 134 134 135 private: … … 159 160 bool isClientAfterTransformationChecked; 160 161 std::set<StdString> relFiles, relFilesCompressed; 161 TransMapTypes transformationMap_; 162 bool isDistributed_; 162 TransMapTypes transformationMap_; 163 163 //! True if and only if the data defined on the axis can be outputted in a compressed way 164 164 bool isCompressible_; -
XIOS/dev/dev_olga/src/node/domain.cpp
r1132 r1143 31 31 : CObjectTemplate<CDomain>(), CDomainAttributes() 32 32 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_(), connectedServerZoomRank_() 33 , hasBounds(false), hasArea(false), is Distributed_(false), isCompressible_(false), isUnstructed_(false)33 , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) 34 34 , isClientAfterTransformationChecked(false), hasLonLat(false) 35 35 , isRedistributed_(false), hasPole(false), doZoomByIndex_(false) … … 42 42 : CObjectTemplate<CDomain>(id), CDomainAttributes() 43 43 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_(), connectedServerZoomRank_() 44 , hasBounds(false), hasArea(false), is Distributed_(false), isCompressible_(false), isUnstructed_(false)44 , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) 45 45 , isClientAfterTransformationChecked(false), hasLonLat(false) 46 46 , isRedistributed_(false), hasPole(false), doZoomByIndex_(false) … … 235 235 bool CDomain::isDistributed(void) const 236 236 { 237 return isDistributed_; 237 return !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) || 238 (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo)); 238 239 } 239 240 … … 741 742 } 742 743 checkZoom(); 743 744 isDistributed_ = !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) ||745 (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo));746 744 } 747 745 … … 1835 1833 computedWrittenIndex_ = true; 1836 1834 1837 CContext* context=CContext::getCurrent() ;1838 CContext Client* client = context->client;1835 CContext* context=CContext::getCurrent(); 1836 CContextServer* server = context->server; 1839 1837 1840 1838 std::vector<int> nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2); … … 1843 1841 nBeginGlobal[0] = 0; nBeginGlobal[1] = 0; 1844 1842 nGlob[0] = ni_glo; nGlob[1] = nj_glo; 1845 CDistributionServer srvDist( client->clientSize, nBegin, nSize, nBeginGlobal, nGlob);1843 CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); 1846 1844 const CArray<size_t,1>& writtenGlobalIndex = srvDist.getGlobalIndex(); 1847 1845 … … 1851 1849 CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(), 1852 1850 itSrve = writtenGlobalIndex.end(), itSrv; 1853 localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 1851 1852 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 1853 { 1854 indGlo = *itSrv; 1855 if (ite != globalLocalIndexMap_.find(indGlo)) 1856 { 1857 ++nbWritten; 1858 } 1859 } 1860 1861 localIndexToWriteOnServer.resize(nbWritten); 1862 1863 nbWritten = 0; 1854 1864 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 1855 1865 { … … 1861 1871 } 1862 1872 } 1873 1874 if (isCompressible()) 1875 { 1876 nbWritten = 0; 1877 boost::unordered_map<size_t,size_t> localGlobalIndexMap; 1878 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 1879 { 1880 indGlo = *itSrv; 1881 if (ite != globalLocalIndexMap_.find(indGlo)) 1882 { 1883 localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo; 1884 ++nbWritten; 1885 } 1886 } 1887 1888 nbWritten = 0; 1889 for (int idx = 0; idx < data_i_index.numElements(); ++idx) 1890 { 1891 if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) 1892 { 1893 ++nbWritten; 1894 } 1895 } 1896 1897 compressedIndexToWriteOnServer.resize(nbWritten); 1898 nbWritten = 0; 1899 for (int idx = 0; idx < data_i_index.numElements(); ++idx) 1900 { 1901 if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) 1902 { 1903 compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_i_index(idx)]; 1904 ++nbWritten; 1905 } 1906 } 1907 1908 numberWrittenIndexes_ = nbWritten; 1909 if (isDistributed()) 1910 { 1911 MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 1912 MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 1913 offsetWrittenIndexes_ -= numberWrittenIndexes_; 1914 } 1915 else 1916 totalNumberWrittenIndexes_ = numberWrittenIndexes_; 1917 } 1863 1918 } 1864 1919 … … 2988 3043 CArray<int,1> dataIIndex(nbIndex), dataJIndex(nbIndex); 2989 3044 dataIIndex = -1; dataJIndex = -1; 2990 3045 2991 3046 nbIndex = 0; 2992 3047 for (i = 0; i < nbReceived; ++i) -
XIOS/dev/dev_olga/src/node/domain.hpp
r1129 r1143 108 108 std::map<int, StdSize> getAttributesBufferSize(); 109 109 CArray<size_t,1> localIndexToWriteOnServer; 110 CArray<int, 1> compressedIndexToWriteOnServer; 110 111 111 112 bool isEmpty(void) const; … … 221 222 std::vector<int> recvClientRanks_, recvClientZoomRanks_; 222 223 int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_; 223 std::vector<int> connectedServerRank_, connectedServerZoomRank_; 224 bool isDistributed_; 224 std::vector<int> connectedServerRank_, connectedServerZoomRank_; 225 225 //! True if and only if the data defined on the domain can be outputted in a compressed way 226 226 bool isCompressible_; -
XIOS/dev/dev_olga/src/node/field.cpp
r1136 r1143 1391 1391 void CField::inputField(CArray<double,1>& fieldIn) 1392 1392 { 1393 // map<int, CArray<double,1> >::iterator it;1394 // for (it = data_srv.begin(); it != data_srv.end(); it++)1395 // {1396 // grid->inputField(it->first, fieldOut.dataFirst(), it->second);1397 // }1398 1393 CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; 1399 1394 CArray<size_t,1>& outIndexServer = grid->localIndexToWriteOnServer; … … 1407 1402 void CField::outputCompressedField(CArray<double,1>& fieldOut) 1408 1403 { 1409 map<int, CArray<double,1> >::iterator it; 1410 1411 for (it = data_srv.begin(); it != data_srv.end(); it++) 1404 // map<int, CArray<double,1> >::iterator it; 1405 1406 // for (it = data_srv.begin(); it != data_srv.end(); it++) 1407 // { 1408 // grid->outputCompressedField(it->first, it->second, fieldOut.dataFirst()); 1409 // } 1410 1411 CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; 1412 CArray<size_t,1>& outIndexServer = grid->localIndexToWriteOnServer; 1413 for (size_t idx = 0; idx < outIndexServer.numElements(); ++idx) 1412 1414 { 1413 grid->outputCompressedField(it->first, it->second, fieldOut.dataFirst());1415 fieldOut((idx)) = recvDataSrv(outIndexClient(idx)); 1414 1416 } 1415 1417 } -
XIOS/dev/dev_olga/src/node/grid.cpp
r1136 r1143 561 561 localIndexToWriteOnClient.resize(nbWritten); 562 562 localIndexToWriteOnServer.resize(nbWritten); 563 564 // if (isCompressible()) 565 { 566 numberWrittenIndexes_ = nbWritten; 567 if (isDataDistributed_) 568 { 569 CContextServer* server = CContext::getCurrent()->server; 570 MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 571 MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 572 offsetWrittenIndexes_ -= numberWrittenIndexes_; 573 } 574 else 575 totalNumberWrittenIndexes_ = numberWrittenIndexes_; 576 } 563 577 564 578 nbWritten = 0; … … 1175 1189 1176 1190 for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i); 1177 1178 // This is a solution for multilevel server1179 // const StdSize size = indexFromClients.numElements();1180 1181 // for(StdSize i = 0; i < size; i++) data[indexFromClients(i)] = stored(i);1182 1183 1191 } 1184 1192 … … 1504 1512 // CContextServer* server = (context->hasServer) ? context->server : context->serverPrimServer[p]; 1505 1513 // CContextClient* client = (context->hasServer) ? context->client : context->clientPrimServer[p]; 1506 numberWrittenIndexes_ = totalNumberWrittenIndexes_ = offsetWrittenIndexes_ = 0;1514 // numberWrittenIndexes_ = totalNumberWrittenIndexes_ = offsetWrittenIndexes_ = 0; 1507 1515 //connectedServerRank_[p] = ranks; 1508 1516 … … 1602 1610 // outIndexFromClient.insert(std::make_pair(rank, outIndex)); 1603 1611 // connectedDataSize_[p][rank] = outIndex.numElements(); 1604 numberWrittenIndexes_ += outIndex.numElements();1612 // numberWrittenIndexes_ += outIndex.numElements(); 1605 1613 } 1606 1614 … … 1680 1688 // if (isScalarGrid()) return; 1681 1689 1682 if (isDataDistributed_)1683 {1684 MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);1685 MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);1686 offsetWrittenIndexes_ -= numberWrittenIndexes_;1687 }1688 else1689 totalNumberWrittenIndexes_ = numberWrittenIndexes_;1690 // if (isDataDistributed_) 1691 // { 1692 // MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 1693 // MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 1694 // offsetWrittenIndexes_ -= numberWrittenIndexes_; 1695 // } 1696 // else 1697 // totalNumberWrittenIndexes_ = numberWrittenIndexes_; 1690 1698 1691 1699 nbReadSenders[p] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks);
Note: See TracChangeset
for help on using the changeset viewer.