Changeset 1576 for XIOS/dev


Ignore:
Timestamp:
09/10/18 17:18:33 (3 years ago)
Author:
oabramkina
Message:

Adding a check on the client side if all servers have data to receive. If servers have no data to receive the master process will send empty data to such servers. This ensures that all servers participate in collective calls.

Location:
XIOS/dev/dev_olga/src/node
Files:
3 edited

Legend:

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

    r1571 r1576  
    657657         // Even if a client has no index, it must connect to at least one server and  
    658658         // send an "empty" data to this server 
    659 //         if (connectedServerRank_[nbServer].empty()) 
    660 //          connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); 
    661         // Send empty data to all servers 
    662         if (connectedServerRank_[nbServer].empty()) 
    663           for (int i=0; i<nbServer; ++i) 
    664             connectedServerRank_[nbServer].push_back(i); 
    665  
    666  
    667          nbSenders[nbServer] = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); 
     659         if (connectedServerRank_[nbServer].empty()) 
     660          connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); 
     661 
     662        nbSenders[nbServer] = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); 
    668663 
    669664        delete clientServerMap; 
  • XIOS/dev/dev_olga/src/node/domain.cpp

    r1571 r1576  
    18481848          // Even if a client has no index, it must connect to at least one server and 
    18491849          // send an "empty" data to this server 
    1850 //          if (connectedServerRank_[nbServer].empty()) 
    1851 //            connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); 
    1852  
    1853           // Trying instead: send empty data to all servers 
    18541850          if (connectedServerRank_[nbServer].empty()) 
    1855             for (int i = 0; i < client->serverSize; ++i) 
    1856             connectedServerRank_[nbServer].push_back(i); 
    1857  
    1858  
     1851            connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); 
     1852 
     1853          // Now check if all servers have data to receive. If not, master client will send empty data. 
     1854          // This ensures that all servers will participate in collective calls upon receiving even if they have no date to receive. 
     1855          std::vector<int> counts (clientSize); 
     1856          std::vector<int> displs (clientSize); 
     1857          displs[0] = 0; 
     1858          int localCount = connectedServerRank_[nbServer].size() ; 
     1859          MPI_Gather(&localCount, 1, MPI_INT, &counts[0], 1, MPI_INT, 0, client->intraComm) ; 
     1860          for (int i = 0; i < clientSize-1; ++i) 
     1861          { 
     1862            displs[i+1] = displs[i] + counts[i]; 
     1863          } 
     1864          std::vector<int> allConnectedServers(displs[clientSize-1]+counts[clientSize-1]); 
     1865          MPI_Gatherv(&(connectedServerRank_[nbServer])[0], localCount, MPI_INT, &allConnectedServers[0], &counts[0], &displs[0], MPI_INT, 0, client->intraComm); 
     1866 
     1867          if ((allConnectedServers.size() != nbServer) && (rank == 0)) 
     1868          { 
     1869            std::vector<bool> isSrvConnected (nbServer, false); 
     1870            for (int i = 0; i < allConnectedServers.size(); ++i) isSrvConnected[allConnectedServers[i]] = true; 
     1871            for (int i = 0; i < nbServer; ++i) 
     1872            { 
     1873              if (!isSrvConnected[i]) connectedServerRank_[nbServer].push_back(i); 
     1874            } 
     1875          } 
    18591876          nbSenders[nbServer] = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); 
    18601877          delete clientServerMap; 
  • XIOS/dev/dev_olga/src/node/grid.cpp

    r1571 r1576  
    841841         // Even if a client has no index, it must connect to at least one server and 
    842842         // send an "empty" data to this server 
    843 //         if (connectedServerRank_[receiverSize].empty()) 
    844 //          connectedServerRank_[receiverSize].push_back(client->clientRank % client->serverSize); 
    845  
    846          // Trying instead: send empty data to all servers 
    847843         if (connectedServerRank_[receiverSize].empty()) 
    848            for (int i = 0; i < client->serverSize; ++i) 
    849            connectedServerRank_[receiverSize].push_back(i); 
     844          connectedServerRank_[receiverSize].push_back(client->clientRank % client->serverSize); 
     845 
     846         // Now check if all servers have data to receive. If not, master client will send empty data. 
     847         // This ensures that all servers will participate in collective calls upon receiving even if they have no date to receive. 
     848         std::vector<int> counts (client->clientSize); 
     849         std::vector<int> displs (client->clientSize); 
     850         displs[0] = 0; 
     851         int localCount = connectedServerRank_[receiverSize].size() ; 
     852         MPI_Gather(&localCount, 1, MPI_INT, &counts[0], 1, MPI_INT, 0, client->intraComm) ; 
     853         for (int i = 0; i < client->clientSize-1; ++i) 
     854         { 
     855           displs[i+1] = displs[i] + counts[i]; 
     856         } 
     857         std::vector<int> allConnectedServers(displs[client->clientSize-1]+counts[client->clientSize-1]); 
     858         MPI_Gatherv(&(connectedServerRank_[receiverSize])[0], localCount, MPI_INT, &allConnectedServers[0], &counts[0], &displs[0], MPI_INT, 0, client->intraComm); 
     859 
     860         if ((allConnectedServers.size() != receiverSize) && (client->clientRank == 0)) 
     861         { 
     862           std::vector<bool> isSrvConnected (receiverSize, false); 
     863           for (int i = 0; i < allConnectedServers.size(); ++i) isSrvConnected[allConnectedServers[i]] = true; 
     864           for (int i = 0; i < receiverSize; ++i) 
     865           { 
     866             if (!isSrvConnected[i]) connectedServerRank_[receiverSize].push_back(i); 
     867           } 
     868         } 
    850869 
    851870         nbSenders[receiverSize] = clientServerMap_->computeConnectedClients(receiverSize, client->clientSize, client->intraComm, connectedServerRank_[receiverSize]); 
Note: See TracChangeset for help on using the changeset viewer.