Changeset 1144 for XIOS/dev/dev_olga/src/node/domain.cpp
- Timestamp:
- 05/23/17 16:32:26 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/domain.cpp
r1143 r1144 79 79 } 80 80 81 const std::set<StdString> & CDomain::getRelFiles(void) const82 {83 return (this->relFiles);84 }85 86 87 const std::vector<int>& CDomain::getIndexesToWrite(void) const88 {89 return indexesToWrite;90 }91 92 81 /*! 93 82 Returns the number of indexes written by each server. … … 115 104 { 116 105 return offsetWrittenIndexes_; 117 }118 119 /*!120 Returns the start of indexes written by each server.121 \return the start of indexes written by each server122 */123 const std::vector<int>& CDomain::getStartWriteIndex() const124 {125 return start_write_index_;126 }127 128 /*!129 Returns the count of indexes written by each server.130 \return the count of indexes written by each server131 */132 const std::vector<int>& CDomain::getCountWriteIndex() const133 {134 return count_write_index_;135 }136 137 /*!138 Returns the local data written by each server.139 */140 const std::vector<int>& CDomain::getLocalWriteSize() const141 {142 return local_write_size_;143 }144 145 /*!146 Returns the global data written by all server.147 */148 const std::vector<int>& CDomain::getGlobalWriteSize() const149 {150 return global_write_size_;151 106 } 152 107 … … 1564 1519 } 1565 1520 1566 1567 // void CDomain::computeConnectedClients(const std::vector<int>& globalDim, int orderPositionInGrid,1568 // CServerDistributionDescription::ServerDistributionType distType)1569 1521 /*! 1570 Compute the connection of a client to other clients to determine which clients to send attributes to 1522 Compute the connection of a client to other clients to determine which clients to send attributes to. 1523 The sending clients are supposed to already know the distribution of receiving clients (In simple cases, it's band) 1524 The connection among clients is calculated by using global index. 1525 A client connects to other clients which holds the same global index as it. 1571 1526 */ 1572 1527 void CDomain::computeConnectedClients() … … 1609 1564 } 1610 1565 1611 // for (i = 0; i < nbIndex; ++i)1612 // {1613 // i_ind=i_index(i);1614 // j_ind=j_index(i);1615 1616 // if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend)1617 // {1618 // ++globalIndexCountZoom;1619 // }1620 // }1621 1622 // int globalIndexWrittenCount = 0;1623 // if (isCompressible_)1624 // {1625 // for (i = 0; i < data_i_index.numElements(); ++i)1626 // {1627 // i_ind = CDistributionClient::getDomainIndex(data_i_index(i), data_j_index(i),1628 // data_ibegin, data_jbegin, data_dim, ni,1629 // j_ind);1630 // if (i_ind >= 0 && i_ind < ni && j_ind >= 0 && j_ind < nj && mask_1d(i_ind + j_ind * ni))1631 // {1632 // i_ind += ibegin;1633 // j_ind += jbegin;1634 // if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend)1635 // ++globalIndexWrittenCount;1636 // }1637 // }1638 // }1639 1566 1640 1567 // Fill in index 1641 1642 1568 CArray<size_t,1> globalIndexDomainZoom(globalIndexCountZoom); 1643 1569 CArray<size_t,1> localIndexDomainZoom(globalIndexCountZoom); … … 1672 1598 globalIndexDomainZoom(globalIndexCountZoom) = globalIndex; 1673 1599 ++globalIndexCountZoom; 1674 // if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend)1675 // {1676 // globalIndexDomainZoom(globalIndexCountZoom) = globalIndex;1677 // localIndexDomainZoom(globalIndexCountZoom) = i;1678 // ++globalIndexCountZoom;1679 // }1680 1600 } 1681 1601 } … … 1699 1619 int jend = jbegin + nj -1; 1700 1620 zoom_ibegin = global_zoom_ibegin > ibegin ? global_zoom_ibegin : ibegin; 1701 int zoom_iend 1621 int zoom_iend = global_zoom_iend < iend ? zoom_iend : iend ; 1702 1622 zoom_ni = zoom_iend-zoom_ibegin+1 ; 1703 1623 … … 1707 1627 } 1708 1628 1709 // if (globalLocalIndexZoomMap_.empty())1710 // {1711 // int nbIndexZoom = globalIndexDomainZoom.numElements();1712 // for (i = 0; i < nbIndex; ++i)1713 // globalLocalIndexZoomMap_[globalIndexDomainZoom(i)] = i;1714 // }1715 1716 1717 // CArray<int,1> globalIndexWrittenDomain(globalIndexWrittenCount);1718 // if (isCompressible_)1719 // {1720 // globalIndexWrittenCount = 0;1721 // for (i = 0; i < data_i_index.numElements(); ++i)1722 // {1723 // i_ind = CDistributionClient::getDomainIndex(data_i_index(i), data_j_index(i),1724 // data_ibegin, data_jbegin, data_dim, ni,1725 // j_ind);1726 // if (i_ind >= 0 && i_ind < ni && j_ind >= 0 && j_ind < nj && mask_1d(i_ind + j_ind * ni))1727 // {1728 // i_ind += ibegin;1729 // j_ind += jbegin;1730 // if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend)1731 // {1732 // globalIndexWrittenDomain(globalIndexWrittenCount) = i_ind + j_ind * ni_glo;1733 // ++globalIndexWrittenCount;1734 // }1735 // }1736 // }1737 // }1738 1629 1739 1630 size_t globalSizeIndex = 1, indexBegin, indexEnd; … … 1772 1663 CClientServerMapping::GlobalIndexMap::const_iterator it = globalIndexDomainOnServer.begin(), 1773 1664 ite = globalIndexDomainOnServer.end(); 1774 // typedef XIOSBinarySearchWithIndex<size_t> BinarySearch;1775 // std::vector<int>::iterator itVec;1776 1777 // indSrv_.clear();1778 // indWrittenSrv_.clear();1779 // for (; it != ite; ++it)1780 // {1781 // int rank = it->first;1782 // int indexSize = it->second.size();1783 // std::vector<int> permutIndex(indexSize);1784 // XIOSAlgorithms::fillInIndex(indexSize, permutIndex);1785 // XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(it->second, permutIndex);1786 // BinarySearch binSearch(it->second);1787 // int nb = globalIndexDomainZoom.numElements();1788 // for (int i = 0; i < nb; ++i)1789 // {1790 // if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndexDomainZoom(i), itVec))1791 // {1792 // indSrv_[rank].push_back(localIndexDomainZoom(i));1793 // }1794 // }1795 // for (int i = 0; i < globalIndexWrittenDomain.numElements(); ++i)1796 // {1797 // if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndexWrittenDomain(i), itVec))1798 // {1799 // indWrittenSrv_[rank].push_back(globalIndexWrittenDomain(i));1800 // }1801 // }1802 // }1803 1804 1665 connectedServerRank_.clear(); 1805 1666 for (it = globalIndexDomainOnServer.begin(); it != ite; ++it) { … … 1823 1684 } 1824 1685 1825 const boost::unordered_map<int, vector<size_t> >& CDomain::getIndexServer() const1826 {1827 return indSrv_;1828 }1829 1686 /*! 1687 Compute index to write data. We only write data on the zoomed region, therefore, there should 1688 be a map between the complete grid and the reduced grid where we write data. 1689 By using global index we can easily create this kind of mapping. 1690 */ 1830 1691 void CDomain::computeWrittenIndex() 1831 1692 { … … 1976 1837 list_msgsIndex.back() << list_indGlob.back(); //list_indi.back() << list_indj.back(); 1977 1838 1978 // if (isCompressible_)1979 // {1980 // std::vector<int>& writtenIndSrc = indWrittenSrv_[rank];1981 // list_writtenInd.push_back(CArray<int,1>(writtenIndSrc.size()));1982 // CArray<int,1>& writtenInd = list_writtenInd.back();1983 1984 // for (n = 0; n < writtenInd.numElements(); ++n)1985 // writtenInd(n) = writtenIndSrc[n];1986 1987 // list_msgsIndex.back() << writtenInd;1988 // }1989 1990 1839 eventIndex.push(rank, nbConnectedClients_[rank], list_msgsIndex.back()); 1991 1840 } … … 1997 1846 /*! 1998 1847 Send global index and zoom index from client to connected client(s) 1999 zoom index can be smaller than global index 1848 zoom index can be smaller than global index. 1849 This function can be used in the future??? 2000 1850 */ 2001 1851 void CDomain::sendIndexZoom() … … 2100 1950 2101 1951 /*! 2102 Send mask index from client to connected(s) 1952 Send mask index from client to connected(s) clients 2103 1953 */ 2104 1954 void CDomain::sendMask() … … 2196 2046 /*! 2197 2047 Send longitude and latitude from client to servers 2198 Each client send long and lat information to corresponding connected server(s).2048 Each client send long and lat information to corresponding connected clients(s). 2199 2049 Because longitude and latitude are optional, this function only called if latitude and longitude exist 2200 2050 */ … … 2295 2145 Data index can be compressed however, we always send decompressed data index 2296 2146 and they will be compressed on receiving. 2147 The compressed index are represented with 1 and others are represented with -1 2297 2148 */ 2298 2149 void CDomain::sendDataIndex() … … 2431 2282 } 2432 2283 get(domainId)->recvIndex(rankBuffers); 2433 2434 // if (domain->isCompressible_)2435 // {2436 // std::sort(domain->indexesToWrite.begin(), domain->indexesToWrite.end());2437 2438 // CContextServer* server = CContext::getCurrent()->server;2439 // domain->numberWrittenIndexes_ = domain->indexesToWrite.size();2440 // MPI_Allreduce(&domain->numberWrittenIndexes_, &domain->totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);2441 // MPI_Scan(&domain->numberWrittenIndexes_, &domain->offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);2442 // domain->offsetWrittenIndexes_ -= domain->numberWrittenIndexes_;2443 // }2444 2284 } 2445 2285 2446 2286 /*! 2447 Receive index information from client(s) 2287 Receive index information from client(s). We use the global index for mapping index between 2288 sending clients and receiving clients. 2448 2289 \param[in] rankBuffers rank of sending client and the corresponding receive buffer 2449 2290 */ … … 2484 2325 ++nbIndGlob; 2485 2326 } 2486 } 2487 2488 // { 2489 // CContextServer* server = CContext::getCurrent()->server; 2490 // count_write_index_.resize(2); 2491 // start_write_index_.resize(2); 2492 // local_write_size_.resize(2); 2493 // global_write_size_.resize(2); 2494 // if ((this->type) == CDomain::type_attr::unstructured) 2495 // { 2496 // count_write_index_[0] = zoom_i_index.numElements(); 2497 // count_write_index_[1] = 0; 2498 // } 2499 // else 2500 // { 2501 // int ni_zoom = zoom_i_index.numElements(), idx, nbIZoom = 0, nbJZoom = 0; 2502 // for (idx =0; idx < ni_zoom; ++idx) 2503 // { 2504 // if ((ibegin <= zoom_i_index(idx)) && (zoom_i_index(idx) < ibegin+ni) && (nbIZoom < ni)) 2505 // ++nbIZoom; 2506 // if ((jbegin <= zoom_j_index(idx)) && (zoom_j_index(idx) < jbegin+nj) && (nbJZoom < nj)) 2507 // ++nbJZoom; 2508 // } 2509 // count_write_index_[0] = nbIZoom; 2510 // count_write_index_[1] = nbJZoom; 2511 2512 // // Reoder the zoom_index 2513 // for (int j = 0; j < nbJZoom; ++j) 2514 // for (int i = 0; i < nbIZoom; ++i) 2515 // { 2516 // idx = nbIZoom * j + i; 2517 // if (idx < ni_zoom) 2518 // { 2519 // zoom_i_index(idx) = ibegin + i; 2520 // zoom_j_index(idx) = jbegin + j; 2521 // } 2522 // } 2523 2524 // // Reorder the global index 2525 // for (int j = 0; j < nj; ++j) 2526 // for (int i = 0; i < ni; ++i) 2527 // { 2528 // idx = ni * j + i; 2529 // if (idx < nbIndGlob) 2530 // { 2531 // i_index(idx) = ibegin + i; 2532 // j_index(idx) = jbegin + j; 2533 // } 2534 // } 2535 // } 2536 2537 2538 // MPI_Scan(&count_write_index_[0], &start_write_index_[0], 2, MPI_INT, MPI_SUM, server->intraComm); 2539 // start_write_index_[0] = 0; 2540 // start_write_index_[1] -= count_write_index_[1]; 2541 // local_write_size_[0] = count_write_index_[0]; 2542 // local_write_size_[1] = count_write_index_[1]; 2543 // MPI_Allreduce(&count_write_index_[0], &global_write_size_[0], 2, MPI_INT, MPI_SUM, server->intraComm); 2544 // global_write_size_[0] = count_write_index_[0]; 2545 // global_write_size_[1] = (global_write_size_[1] > nj_glo) ? nj_glo : global_write_size_[1]; 2546 2547 2548 // } 2549 2550 // int type_int; 2551 // buffer >> type_int >> isCurvilinear >> indiSrv[rank] >> indjSrv[rank]; 2552 // type.setValue((type_attr::t_enum)type_int); // probleme des type enum avec les buffers : ToFix 2553 2554 // if (isCompressible_) 2555 // { 2556 // CArray<int, 1> writtenIndexes; 2557 // buffer >> writtenIndexes; 2558 // indexesToWrite.reserve(indexesToWrite.size() + writtenIndexes.numElements()); 2559 // for (int i = 0; i < writtenIndexes.numElements(); ++i) 2560 // indexesToWrite.push_back(writtenIndexes(i)); 2561 // } 2327 } 2562 2328 } 2563 2329 … … 2627 2393 { 2628 2394 } 2629 2630 // globalLocalIndexZoomMap_.rehash(std::ceil(nbZoomInd/globalLocalIndexZoomMap_.max_load_factor()));2631 // nbZoomInd = 0;2632 // for (int j = 0; j < zoom_nj; ++j)2633 // for (int i = 0; i < zoom_ni; ++i)2634 // {2635 // globalLocalIndexZoomMap_[(i + zoom_ibegin) + (j + zoom_jbegin) * ni_glo] = nbZoomInd;2636 // ++nbZoomInd;2637 // }2638 2395 } 2639 2396 … … 3004 2761 } 3005 2762 get(domainId)->recvDataIndex(rankBuffers); 3006 3007 // if (domain->isCompressible_)3008 // {3009 // std::sort(domain->indexesToWrite.begin(), domain->indexesToWrite.end());3010 3011 // CContextServer* server = CContext::getCurrent()->server;3012 // domain->numberWrittenIndexes_ = domain->indexesToWrite.size();3013 // MPI_Allreduce(&domain->numberWrittenIndexes_, &domain->totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);3014 // MPI_Scan(&domain->numberWrittenIndexes_, &domain->offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);3015 // domain->offsetWrittenIndexes_ -= domain->numberWrittenIndexes_;3016 // }3017 2763 } 3018 2764
Note: See TracChangeset
for help on using the changeset viewer.