Ignore:
Timestamp:
10/11/21 14:45:43 (3 years ago)
Author:
ymipsl
Message:

Rewrite domain distribution for servers. Previously it was leading that each client was communicating with each servers to send them a small part of the domain.

YM

File:
1 edited

Legend:

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

    r2206 r2247  
    18701870 
    18711871 
    1872   void CDomain::computeRemoteElement(CContextClient* client, EDistributionType type) 
     1872  void CDomain::computeRemoteElement(CContextClient* client, EDistributionType distType) 
    18731873  TRY 
    18741874  { 
    18751875    CContext* context = CContext::getCurrent(); 
    18761876    map<int, CArray<size_t,1>> globalIndex ; 
    1877  
     1877/* old method 
    18781878    if (type==EDistributionType::BANDS) // Bands distribution to send to file server 
    18791879    { 
     
    19091909        for(auto& rank : zeroIndex) globalIndex[rank] = CArray<size_t,1>() ;  
    19101910    } 
    1911     else if (type==EDistributionType::NONE) // domain is not distributed ie all servers get the same local domain 
     1911*/     
     1912    if (distType==EDistributionType::BANDS && isUnstructed_) distType==EDistributionType::COLUMNS ; 
     1913 
     1914    if (distType==EDistributionType::BANDS) // Bands distribution to send to file server 
     1915    { 
     1916      int nbServer = client->serverSize; 
     1917      int nbClient = client->clientSize ; 
     1918      int rankClient = client->clientRank ; 
     1919      int size = nbServer / nbClient ; 
     1920      int start ; 
     1921      if (nbServer%nbClient > rankClient) 
     1922      { 
     1923       start = (size+1) * rankClient ; 
     1924       size++ ; 
     1925      } 
     1926      else start = size*rankClient + nbServer%nbClient ; 
     1927      
     1928      for(int i=0; i<size; i++) 
     1929      {  
     1930        int rank=start+i ;  
     1931        size_t indSize = nj_glo/nbServer ; 
     1932        size_t indStart ; 
     1933        if (nj_glo % nbServer > rank) 
     1934        { 
     1935          indStart = (indSize+1) * rank ; 
     1936          indSize++ ; 
     1937        } 
     1938        else indStart = indSize*rank + nj_glo%nbServer ; 
     1939        
     1940        indStart=indStart*ni_glo ; 
     1941        indSize=indSize*ni_glo ; 
     1942        auto& globalInd =  globalIndex[rank] ; 
     1943        globalInd.resize(indSize) ; 
     1944        for(size_t n = 0 ; n<indSize; n++) globalInd(n)=indStart+n ; 
     1945      } 
     1946    } 
     1947    else if (distType==EDistributionType::COLUMNS) // Bands distribution to send to file server 
     1948    { 
     1949      int nbServer = client->serverSize; 
     1950      int nbClient = client->clientSize ; 
     1951      int rankClient = client->clientRank ; 
     1952      int size = nbServer / nbClient ; 
     1953      int start ; 
     1954      if (nbServer%nbClient > rankClient) 
     1955      { 
     1956       start = (size+1) * rankClient ; 
     1957       size++ ; 
     1958      } 
     1959      else start = size*rankClient + nbServer%nbClient ; 
     1960      
     1961      for(int i=0; i<size; i++) 
     1962      {  
     1963        int rank=start+i ;  
     1964        size_t indSize = ni_glo/nbServer ; 
     1965        size_t indStart ; 
     1966        if (ni_glo % nbServer > rank) 
     1967        { 
     1968          indStart = (indSize+1) * rank ; 
     1969          indSize++ ; 
     1970        } 
     1971        else indStart = indSize*rank + ni_glo%nbServer ; 
     1972        
     1973        auto& globalInd =  globalIndex[rank] ; 
     1974        globalInd.resize(indSize*nj_glo) ; 
     1975        size_t n=0 ; 
     1976        for(int j=0; j<nj_glo;j++) 
     1977        { 
     1978          for(int i=0; i<indSize; i++, n++)  globalInd(n)=indStart+i ; 
     1979          indStart=indStart+ni_glo ;   
     1980        } 
     1981      } 
     1982    } 
     1983    else if (distType==EDistributionType::NONE) // domain is not distributed ie all servers get the same local domain 
    19121984    { 
    19131985      int nbServer = client->serverSize; 
Note: See TracChangeset for help on using the changeset viewer.