Changeset 1054 for XIOS/dev/dev_olga/src/node/domain.cpp
- Timestamp:
- 02/17/17 19:51:36 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/domain.cpp
r1030 r1054 156 156 std::map<int, StdSize> CDomain::getAttributesBufferSize() 157 157 { 158 CContextClient* client = CContext::getCurrent()->client; 158 CContext* context = CContext::getCurrent(); 159 // For now the assumption is that secondary server pools consist of the same number of procs. 160 // CHANGE the line below if the assumption changes. 161 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client; 159 162 160 163 std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(); … … 272 275 this->isRedistributed_ = true; 273 276 CContext* context = CContext::getCurrent(); 274 CContextClient* client = context->client; 277 // For now the assumption is that secondary server pools consist of the same number of procs. 278 // CHANGE the line below if the assumption changes. 279 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client; 275 280 int rankClient = client->clientRank; 276 281 int rankOnDomain = rankClient%nbLocalDomain; … … 508 513 { 509 514 CContext* context = CContext::getCurrent(); 510 CContextClient* client = context->client; 515 // For now the assumption is that secondary server pools consist of the same number of procs. 516 // CHANGE the line below if the assumption changes. 517 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client; 511 518 lon_g.resize(ni_glo) ; 512 519 lat_g.resize(nj_glo) ; … … 1351 1358 this->computeConnectedClients(); 1352 1359 // if (hasLonLat || hasArea || isCompressible_) this->computeConnectedClients(); 1353 if (hasLonLat) this->completeLonLatClient(); 1360 if (hasLonLat) 1361 if (!context->hasServer) 1362 this->completeLonLatClient(); 1354 1363 } 1355 1364 … … 1397 1406 if (context->hasClient) 1398 1407 { 1408 // this->completeLonLatClient(); 1399 1409 sendAttributes(); 1400 1410 } … … 1444 1454 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1445 1455 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 1446 for (int i = 0; i < nbSrvPools; ++i) 1447 { 1448 CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] 1449 : context->client; 1456 for (int p = 0; p < nbSrvPools; ++p) 1457 { 1458 CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[p] 1459 : context->client; 1460 1450 1461 int nbServer = contextClientTmp->serverSize; 1451 1462 std::vector<int> nGlobDomain(2); … … 1498 1509 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1499 1510 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 1500 for (int i = 0; i < nbSrvPools; ++i)1501 { 1502 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[ i] : context->client;1511 for (int p = 0; p < nbSrvPools; ++p) 1512 { 1513 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; 1503 1514 int nbServer=client->serverSize; 1504 1515 int rank = client->clientRank; … … 1668 1679 for (it = globalIndexDomainOnServer.begin(); it != ite; ++it) { 1669 1680 connectedServerRank_.push_back(it->first); 1670 //std::vector<size_t> vec = it->second;1671 //std::sort(vec.begin(), vec.end());1672 //indSrv_[it->first] = vec;1673 } 1674 1675 indSrv_.swap(globalIndexDomainOnServer);1681 std::vector<size_t> vec = it->second; 1682 std::sort(vec.begin(), vec.end()); 1683 indSrv_[it->first] = vec; 1684 } 1685 1686 // indSrv_.swap(globalIndexDomainOnServer); 1676 1687 nbConnectedClients_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_); 1677 1688 1678 1689 clientServerMap->computeServerIndexMapping(globalIndexDomainZoom); 1679 1690 CClientServerMapping::GlobalIndexMap& globalIndexDomainZoomOnServer = clientServerMap->getGlobalIndexOnServer(); 1680 indZoomSrv_.swap(globalIndexDomainZoomOnServer);1691 // indZoomSrv_.swap(globalIndexDomainZoomOnServer); 1681 1692 std::vector<int> connectedServerZoomRank(indZoomSrv_.size()); 1682 for (it = indZoomSrv_.begin(); it != indZoomSrv_.end(); ++it) 1693 // for (it = indZoomSrv_.begin(); it != indZoomSrv_.end(); ++it) 1694 // connectedServerZoomRank.push_back(it->first); 1695 for (it = globalIndexDomainZoomOnServer.begin(); it != globalIndexDomainZoomOnServer.end(); ++it) 1696 { 1683 1697 connectedServerZoomRank.push_back(it->first); 1698 std::vector<size_t> vec = it->second; 1699 std::sort(vec.begin(), vec.end()); 1700 indZoomSrv_[it->first] = vec; 1701 } 1684 1702 nbConnectedClientsZoom_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerZoomRank); 1685 1703 … … 1699 1717 void CDomain::sendAttributes() 1700 1718 { 1719 sendDistributionAttributes(); 1701 1720 sendIndex(); 1702 sendDistributionAttributes();1703 1721 sendMask(); 1704 1722 sendLonLat(); … … 1717 1735 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1718 1736 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 1719 for (int i = 0; i < nbSrvPools; ++i)1720 { 1721 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[ i] : context->client;1737 for (int p = 0; p < nbSrvPools; ++p) 1738 { 1739 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; 1722 1740 1723 1741 CEventClient eventIndex(getType(), EVENT_ID_INDEX); … … 1788 1806 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1789 1807 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 1790 for (int i = 0; i < nbSrvPools; ++i)1791 { 1792 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[ i] : context->client;1808 for (int p = 0; p < nbSrvPools; ++p) 1809 { 1810 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; 1793 1811 1794 1812 // send area for each connected server … … 1835 1853 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1836 1854 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 1837 for (int i = 0; i < nbSrvPools; ++i)1838 { 1839 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[ i] : context->client;1855 for (int p = 0; p < nbSrvPools; ++p) 1856 { 1857 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; 1840 1858 1841 1859 // send area for each connected server … … 1885 1903 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1886 1904 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 1887 for (int i = 0; i < nbSrvPools; ++i)1888 { 1889 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[ i] : context->client;1905 for (int p = 0; p < nbSrvPools; ++p) 1906 { 1907 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; 1890 1908 1891 1909 // send lon lat for each connected server … … 1954 1972 eventLat.push(rank, nbConnectedClients_[rank], list_msgsLat.back()); 1955 1973 } 1956 1957 1974 client->sendEvent(eventLon); 1958 1975 client->sendEvent(eventLat); … … 1971 1988 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1972 1989 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 1973 for (int i = 0; i < nbSrvPools; ++i)1974 { 1975 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[ i] : context->client;1990 for (int p = 0; p < nbSrvPools; ++p) 1991 { 1992 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; 1976 1993 1977 1994 // send area for each connected server … … 2204 2221 for (idx =0; idx < ni_zoom; ++idx) 2205 2222 { 2206 2223 if ((ibegin <= zoom_i_index(idx)) && (zoom_i_index(idx) < ibegin+ni) && (nbIZoom < ni)) 2207 2224 ++nbIZoom; 2208 2225 if ((jbegin <= zoom_j_index(idx)) && (zoom_j_index(idx) < jbegin+nj) && (nbJZoom < nj)) 2209 2226 ++nbJZoom; 2210 2227 } … … 2237 2254 } 2238 2255 2239 MPI_Scan(&count_write_index_[0], &start_write_index_[0], 2, MPI_INT, MPI_SUM, server->intraComm); 2240 start_write_index_[0] = 0; 2241 start_write_index_[1] -= count_write_index_[1]; 2256 MPI_Scan(&count_write_index_[0], &start_write_index_[0], 2, MPI_INT, MPI_SUM, server->intraComm); 2257 if ((this->type) != CDomain::type_attr::unstructured) 2258 { 2259 start_write_index_[0] = 0; 2260 start_write_index_[1] -= count_write_index_[1]; 2261 } 2262 else 2263 { 2264 start_write_index_[0] -= count_write_index_[0]; 2265 } 2242 2266 local_write_size_[0] = count_write_index_[0]; 2243 2267 local_write_size_[1] = count_write_index_[1]; 2244 2268 MPI_Allreduce(&count_write_index_[0], &global_write_size_[0], 2, MPI_INT, MPI_SUM, server->intraComm); 2245 global_write_size_[0] = count_write_index_[0]; 2246 global_write_size_[1] = (global_write_size_[1] > nj_glo) ? nj_glo : global_write_size_[1]; 2247 2269 if ((this->type) != CDomain::type_attr::unstructured) 2270 { 2271 global_write_size_[0] = count_write_index_[0]; 2272 global_write_size_[1] = (global_write_size_[1] > nj_glo) ? nj_glo : global_write_size_[1]; 2273 } 2248 2274 } 2249 2275
Note: See TracChangeset
for help on using the changeset viewer.