XIOS  1.0
Xml I/O Server
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Énumérations Valeurs énumérées Amis Macros
server_distribution_description.hpp
Aller à la documentation de ce fichier.
1 
10 #ifndef __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP
11 #define __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP
12 
13 #include "xios_spl.hpp"
14 #include "array_new.hpp"
15 #include <unordered_map>
16 
17 namespace xios
18 {
24 {
25  public:
27  {
29  };
30 
32  CServerDistributionDescription(const std::vector<int>& globalDimensionSize,
33  int nServer,
35 
38 
39  void computeServerDistribution(bool doComputeGlobalIndex = false, int positionDimensionDistributed = 1);
40  std::vector<int> computeServerGlobalIndexInRange(const std::pair<size_t, size_t>& indexBeginEnd, int positionDimensionDistributed = 1);
41  std::vector<int> computeServerGlobalByElement(std::vector<std::unordered_map<size_t,std::vector<int> > >& indexServerOnElement,
42  int rank,
43  int clientSize,
44  const CArray<int,1>& axisDomainOrder,
45  int positionDimensionDistributed = 1);
46 
47  std::vector<std::vector<int> > getServerIndexBegin() const;
48  std::vector<std::vector<int> > getServerDimensionSizes() const;
49  const std::vector<CArray<size_t,1> >& getGlobalIndex() const;
50  const std::unordered_map<size_t,int>& getGlobalIndexRange() const;
52 
53  static int defaultDistributedDimension(int gridDimension,
55 
56  protected:
57  int computeBandDistribution(int nServer, int positionDimensionDistributed = 1);
58  int computeRootDistribution(int nServer, int positionDimensionDistributed = 1);
59  void computePlanDistribution(int nServer);
60  void computeRangeProcIndex(int clientRank,
61  int clientSize,
62  int rangeProcSize,
63  int& rangeBegin,
64  int& rangeSize);
65 
66  private:
67  std::vector<std::vector<int> > indexBegin_;
68  std::vector<std::vector<int> > dimensionSizes_;
69  std::vector<int> nGlobal_;
70 
72  std::vector<CArray<size_t,1> > vecGlobalIndex_;
73 
75  std::unordered_map<size_t,int> globalIndex_;
76 
79 
81  int nServer_;
82 
85 };
86 
87 } // namespace xios
88 #endif // __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP
This class contains information that describe distribution of servers.
int computeRootDistribution(int nServer, int positionDimensionDistributed=1)
Compute global index of servers with root distribution : only root server will received data...
std::vector< int > computeServerGlobalIndexInRange(const std::pair< size_t, size_t > &indexBeginEnd, int positionDimensionDistributed=1)
Compute global index assigned to a server with a range.E.g: if a grid has 100 points and there are 2 ...
std::vector< std::vector< int > > getServerDimensionSizes() const
Get size of each dimension on distributed server.
void computePlanDistribution(int nServer)
#define xios(arg)
std::vector< std::vector< int > > getServerIndexBegin() const
Get index begin of each dimension on distributed server.
const std::vector< CArray< size_t, 1 > > & getGlobalIndex() const
Get global index on distributed server.
ServerDistributionType serverType_
Number of server.
std::unordered_map< size_t, int > globalIndex_
Type of distribution on server side.
void computeRangeProcIndex(int clientRank, int clientSize, int rangeProcSize, int &rangeBegin, int &rangeSize)
Compute a range of index on server which a client holds For a range of index on a specific server...
std::vector< std::vector< int > > indexBegin_
Begin index of each dimension.
void computeServerDistribution(bool doComputeGlobalIndex=false, int positionDimensionDistributed=1)
Compute pre-defined global index distribution of server(s).
int nServer_
Position of dimension distributed on server side (by default, the second dimension) ...
std::vector< std::vector< int > > dimensionSizes_
Size of each dimension.
const std::unordered_map< size_t, int > & getGlobalIndexRange() const
Get global index calculated by computeServerGlobalIndexInRange.
std::vector< int > nGlobal_
Global size of each dimension.
CServerDistributionDescription(const std::vector< int > &globalDimensionSize, int nServer, ServerDistributionType serType=BAND_DISTRIBUTION)
std::vector< int > computeServerGlobalByElement(std::vector< std::unordered_map< size_t, std::vector< int > > > &indexServerOnElement, int rank, int clientSize, const CArray< int, 1 > &axisDomainOrder, int positionDimensionDistributed=1)
Compute the global index of grid elements (domain, axis) and their associated server rank...
static int defaultDistributedDimension(int gridDimension, ServerDistributionType serType=BAND_DISTRIBUTION)
int computeBandDistribution(int nServer, int positionDimensionDistributed=1)
Compute global index of servers with band distribution.
std::vector< CArray< size_t, 1 > > vecGlobalIndex_
In case we need only global index of one server with specific rank.