source: XIOS/trunk/src/server_distribution_description.hpp @ 568

Last change on this file since 568 was 568, checked in by mhnguyen, 7 years ago

Implementing discovering algorithm of server index

+) Implement the algorithm with only one level
+) Remove some redundant functions, corrects some interface

Test
+) On Curie
+) Test passed and results are correct

File size: 2.2 KB
Line 
1/*!
2   \file server_distribution_description.hpp
3   \author Ha NGUYEN
4   \since 04 Jan 2015
5   \date 09 Feb 2015
6
7   \brief Description of index distribution on server(s).
8 */
9
10#ifndef __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP
11#define __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP
12
13#include "xmlioserver_spl.hpp"
14#include "array_new.hpp"
15#include <boost/unordered_map.hpp>
16
17namespace xios
18{
19/*!
20   \class CServerDistributionDescription
21   This class contains information that describe distribution of servers.
22*/
23class CServerDistributionDescription
24{
25  public:
26    enum ServerDistributionType
27    {
28      BAND_DISTRIBUTION, PLAN_DISTRIBUTION
29    };
30
31    /** Default constructor */
32    CServerDistributionDescription(const std::vector<int>& globalDimensionSize);
33    /** Default destructor */
34    virtual ~CServerDistributionDescription();
35
36    void computeServerDistribution(int nServer, bool doComputeGlobalIndex = false,
37                                   ServerDistributionType type = BAND_DISTRIBUTION);
38
39    void computeServerGlobalIndexInRange(int nServer,
40                                         const std::pair<size_t, size_t>& indexBeginEnd,
41                                         ServerDistributionType = BAND_DISTRIBUTION);
42
43    std::vector<std::vector<int> > getServerIndexBegin() const;
44    std::vector<std::vector<int> > getServerDimensionSizes() const;
45    const std::vector<CArray<size_t,1>* >& getGlobalIndex() const;
46    const boost::unordered_map<size_t,int>& getGlobalIndexRange() const;
47
48  protected:
49    void computeBandDistribution(int nServer);
50    void computePlanDistribution(int nServer);
51
52  private:
53    std::vector<std::vector<int> > indexBegin_;     //!< Begin index of each dimension
54    std::vector<std::vector<int> > dimensionSizes_; //!< Size of each dimension
55    std::vector<int> nGlobal_; //!< Global size of each dimension
56
57    //!< General case, index describes distribution of each server (rarely use)
58    std::vector<CArray<size_t,1>* > vecGlobalIndex_;
59
60    //!< In case we need only global index of one server with specific rank
61    boost::unordered_map<size_t,int> globalIndex_;
62};
63
64} // namespace xios
65#endif // __XIOS_SERVER_DISTRIBUTION_DESCRIPTION_HPP
Note: See TracBrowser for help on using the repository browser.