Ignore:
Timestamp:
02/17/17 19:51:36 (7 years ago)
Author:
oabramkina
Message:

dev: intermediate commit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/node/domain.cpp

    r1030 r1054  
    156156   std::map<int, StdSize> CDomain::getAttributesBufferSize() 
    157157   { 
    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; 
    159162 
    160163     std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(); 
     
    272275     this->isRedistributed_ = true; 
    273276     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; 
    275280     int rankClient = client->clientRank; 
    276281     int rankOnDomain = rankClient%nbLocalDomain; 
     
    508513   { 
    509514          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; 
    511518          lon_g.resize(ni_glo) ; 
    512519          lat_g.resize(nj_glo) ; 
     
    13511358      this->computeConnectedClients(); 
    13521359       // if (hasLonLat || hasArea || isCompressible_) this->computeConnectedClients(); 
    1353        if (hasLonLat) this->completeLonLatClient(); 
     1360       if (hasLonLat) 
     1361         if (!context->hasServer) 
     1362           this->completeLonLatClient(); 
    13541363     } 
    13551364 
     
    13971406     if (context->hasClient) 
    13981407     { 
     1408//       this->completeLonLatClient(); 
    13991409       sendAttributes(); 
    14001410     } 
     
    14441454    // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    14451455    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 
    14501461      int nbServer = contextClientTmp->serverSize; 
    14511462      std::vector<int> nGlobDomain(2); 
     
    14981509    // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    14991510    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; 
    15031514      int nbServer=client->serverSize; 
    15041515      int rank = client->clientRank; 
     
    16681679      for (it = globalIndexDomainOnServer.begin(); it != ite; ++it) { 
    16691680        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); 
    16761687      nbConnectedClients_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_); 
    16771688 
    16781689      clientServerMap->computeServerIndexMapping(globalIndexDomainZoom); 
    16791690      CClientServerMapping::GlobalIndexMap& globalIndexDomainZoomOnServer = clientServerMap->getGlobalIndexOnServer(); 
    1680       indZoomSrv_.swap(globalIndexDomainZoomOnServer); 
     1691//      indZoomSrv_.swap(globalIndexDomainZoomOnServer); 
    16811692      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      { 
    16831697        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      } 
    16841702      nbConnectedClientsZoom_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerZoomRank); 
    16851703 
     
    16991717  void CDomain::sendAttributes() 
    17001718  { 
     1719    sendDistributionAttributes(); 
    17011720    sendIndex(); 
    1702     sendDistributionAttributes(); 
    17031721    sendMask(); 
    17041722    sendLonLat(); 
     
    17171735    // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    17181736    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; 
    17221740 
    17231741      CEventClient eventIndex(getType(), EVENT_ID_INDEX); 
     
    17881806    // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    17891807    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; 
    17931811 
    17941812      // send area for each connected server 
     
    18351853    // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    18361854    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; 
    18401858 
    18411859      // send area for each connected server 
     
    18851903    // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    18861904    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; 
    18901908 
    18911909      // send lon lat for each connected server 
     
    19541972        eventLat.push(rank, nbConnectedClients_[rank], list_msgsLat.back()); 
    19551973      } 
    1956  
    19571974      client->sendEvent(eventLon); 
    19581975      client->sendEvent(eventLat); 
     
    19711988    // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    19721989    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; 
    19761993 
    19771994      // send area for each connected server 
     
    22042221        for (idx =0; idx < ni_zoom; ++idx) 
    22052222        { 
    2206            if ((ibegin <= zoom_i_index(idx)) && (zoom_i_index(idx) < ibegin+ni) && (nbIZoom < ni)) 
     2223          if ((ibegin <= zoom_i_index(idx)) && (zoom_i_index(idx) < ibegin+ni) && (nbIZoom < ni)) 
    22072224            ++nbIZoom; 
    2208            if ((jbegin <= zoom_j_index(idx)) && (zoom_j_index(idx) < jbegin+nj) && (nbJZoom < nj)) 
     2225          if ((jbegin <= zoom_j_index(idx)) && (zoom_j_index(idx) < jbegin+nj) && (nbJZoom < nj)) 
    22092226            ++nbJZoom; 
    22102227        } 
     
    22372254      } 
    22382255             
    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      } 
    22422266      local_write_size_[0] = count_write_index_[0]; 
    22432267      local_write_size_[1] = count_write_index_[1]; 
    22442268      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      } 
    22482274    } 
    22492275 
Note: See TracChangeset for help on using the changeset viewer.