Changeset 1232 for XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp
- Timestamp:
- 07/31/17 17:59:25 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp
r1223 r1232 1810 1810 } 1811 1811 1812 // Even if servers have no index, they must received something from client 1813 // We only use several client to send "empty" message to these servers 1812 1814 CServerDistributionDescription serverDescription(nGlobDomain, nbServer); 1813 if (isUnstructed_) serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd), 0); 1814 else serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd), 1); 1815 std::vector<int> serverZeroIndex; 1816 if (isUnstructed_) serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd), 0); 1817 else serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd), 1); 1818 1819 std::list<int> serverZeroIndexLeader; 1820 std::list<int> serverZeroIndexNotLeader; 1821 CContextClient::computeLeader(client->clientRank, client->clientSize, serverZeroIndex.size(), serverZeroIndexLeader, serverZeroIndexNotLeader); 1822 for (std::list<int>::iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) 1823 *it = serverZeroIndex[*it]; 1815 1824 1816 1825 CClientServerMapping* clientServerMap = new CClientServerMappingDistributed(serverDescription.getGlobalIndexRange(), … … 1821 1830 CClientServerMapping::GlobalIndexMap::const_iterator it = globalIndexDomainOnServer.begin(), 1822 1831 ite = globalIndexDomainOnServer.end(); 1832 indSrv_.swap(globalIndexDomainOnServer); 1823 1833 connectedServerRank_.clear(); 1824 for (it = globalIndexDomainOnServer.begin(); it != ite; ++it) {1834 for (it = indSrv_.begin(); it != ite; ++it) 1825 1835 connectedServerRank_.push_back(it->first); 1826 } 1827 1828 indSrv_.swap(globalIndexDomainOnServer); 1836 1837 for (std::list<int>::const_iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) 1838 connectedServerRank_.push_back(*it); 1839 1840 // Even if a client has no index, it must connect to at least one server and 1841 // send an "empty" data to this server 1842 if (connectedServerRank_.empty()) 1843 connectedServerRank_.push_back(client->clientRank % client->serverSize); 1844 1829 1845 nbConnectedClients_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_); 1830 1846 1831 clientServerMap->computeServerIndexMapping(globalIndexDomainZoom);1832 CClientServerMapping::GlobalIndexMap& globalIndexDomainZoomOnServer = clientServerMap->getGlobalIndexOnServer();1833 indZoomSrv_.swap(globalIndexDomainZoomOnServer);1847 // clientServerMap->computeServerIndexMapping(globalIndexDomainZoom); 1848 // CClientServerMapping::GlobalIndexMap& globalIndexDomainZoomOnServer = clientServerMap->getGlobalIndexOnServer(); 1849 // indZoomSrv_.swap(globalIndexDomainZoomOnServer); 1834 1850 1835 for (it = indZoomSrv_.begin(); it != indZoomSrv_.end(); ++it)1836 connectedServerZoomRank_.push_back(it->first);1837 1838 nbConnectedClientsZoom_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerZoomRank_);1851 // for (it = indZoomSrv_.begin(); it != indZoomSrv_.end(); ++it) 1852 // connectedServerZoomRank_.push_back(it->first); 1853 1854 // nbConnectedClientsZoom_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerZoomRank_); 1839 1855 1840 1856 delete clientServerMap; … … 2007 2023 This function can be used in the future??? 2008 2024 */ 2009 void CDomain::sendIndexZoom()2010 {2011 int ns, n, i, j, ind, nv, idx;2012 CContext* context = CContext::getCurrent();2013 2014 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1;2015 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1;2016 for (int p = 0; p < nbSrvPools; ++p)2017 {2018 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client;2019 CEventClient eventIndexZoom(getType(), EVENT_ID_INDEX_ZOOM);2020 2021 list<CMessage> list_msgsIndex;2022 list<CArray<int,1> > list_indZoom;2023 2024 boost::unordered_map<int, vector<size_t> >::const_iterator itZoom, iteZoom;2025 iteZoom = indZoomSrv_.end();2026 for (int k = 0; k < connectedServerZoomRank_.size(); ++k)2027 {2028 int nbIndGlob = 0;2029 int rank = connectedServerZoomRank_[k];2030 int nbIndZoom = 0;2031 itZoom = indZoomSrv_.find(rank);2032 if (iteZoom != itZoom)2033 nbIndZoom = itZoom->second.size();2025 // void CDomain::sendIndexZoom() 2026 // { 2027 // int ns, n, i, j, ind, nv, idx; 2028 // CContext* context = CContext::getCurrent(); 2029 2030 // // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 2031 // int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 2032 // for (int p = 0; p < nbSrvPools; ++p) 2033 // { 2034 // CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; 2035 // CEventClient eventIndexZoom(getType(), EVENT_ID_INDEX_ZOOM); 2036 2037 // list<CMessage> list_msgsIndex; 2038 // list<CArray<int,1> > list_indZoom; 2039 2040 // boost::unordered_map<int, vector<size_t> >::const_iterator itZoom, iteZoom; 2041 // iteZoom = indZoomSrv_.end(); 2042 // for (int k = 0; k < connectedServerZoomRank_.size(); ++k) 2043 // { 2044 // int nbIndGlob = 0; 2045 // int rank = connectedServerZoomRank_[k]; 2046 // int nbIndZoom = 0; 2047 // itZoom = indZoomSrv_.find(rank); 2048 // if (iteZoom != itZoom) 2049 // nbIndZoom = itZoom->second.size(); 2034 2050 2035 list_indZoom.push_back(CArray<int,1>(nbIndZoom));2036 CArray<int,1>& indZoom = list_indZoom.back();2037 for (n = 0; n < nbIndZoom; ++n)2038 {2039 indZoom(n) = static_cast<int>(itZoom->second[n]);2040 }2041 2042 list_msgsIndex.push_back(CMessage());2043 list_msgsIndex.back() << this->getId(); // enum ne fonctionne pour les message => ToFix2044 list_msgsIndex.back() << list_indZoom.back() << doZoomByIndex_; //list_indi.back() << list_indj.back2045 2046 eventIndexZoom.push(rank, nbConnectedClientsZoom_[rank], list_msgsIndex.back());2047 }2048 2049 client->sendEvent(eventIndexZoom);2050 }2051 }2051 // list_indZoom.push_back(CArray<int,1>(nbIndZoom)); 2052 // CArray<int,1>& indZoom = list_indZoom.back(); 2053 // for (n = 0; n < nbIndZoom; ++n) 2054 // { 2055 // indZoom(n) = static_cast<int>(itZoom->second[n]); 2056 // } 2057 2058 // list_msgsIndex.push_back(CMessage()); 2059 // list_msgsIndex.back() << this->getId(); // enum ne fonctionne pour les message => ToFix 2060 // list_msgsIndex.back() << list_indZoom.back() << doZoomByIndex_; //list_indi.back() << list_indj.back 2061 2062 // eventIndexZoom.push(rank, nbConnectedClientsZoom_[rank], list_msgsIndex.back()); 2063 // } 2064 2065 // client->sendEvent(eventIndexZoom); 2066 // } 2067 // } 2052 2068 2053 2069 /*! … … 2673 2689 { 2674 2690 lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; 2675 if (!mask_1d(lInd)) 2676 mask_1d(lInd) = tmp(ind);2691 if (!mask_1d(lInd)) // Only rewrite mask_1d if it's not true 2692 mask_1d(lInd) = tmp(ind); 2677 2693 } 2678 2694 }
Note: See TracChangeset
for help on using the changeset viewer.