changa  3.5
 All Classes Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
MultistepLB.h
1 /*****************************************************************************
2  * $Source$
3  * $Author$
4  * $Date$
5  * $Revision$
6  *****************************************************************************/
7 
12 
13 #ifndef _MULTISTEPLB_H_
14 #define _MULTISTEPLB_H_
15 
16 #define MCLBMS // multistepping enabled
17 #define MCLB_ORBSMOOTH // orbsmooth for large steps
18 #define MCLB_RR // round robin otherwise
19 
20 #include "CentralLB.h"
21 
22 #include "MapStructures.h"
23 
24 #include "MultistepLB.decl.h"
25 
26 //**************************************
27 
28 class MultistepLB : public CBase_MultistepLB {
29 private:
30  ComparatorFn compares[NDIMS];
31  ComparatorFn pc[NDIMS];
32 
33  decltype(LDStats::to_proc) *mapping;
34 
35  int procsPerNode;
36 
37  void init();
38  bool QueryBalanceNow(int step);
39 
40  void makeActiveProcessorList(BaseLB::LDStats *stats, int numActiveObjs);
41 public:
42  MultistepLB(const CkLBOptions &);
43  MultistepLB(CkMigrateMessage *m) : CBase_MultistepLB(m) {
44  init();
45  }
46 
47  void work(BaseLB::LDStats* stats);
48 
49 public:/* <- Sun CC demands Partition be public for ComputeLoad to access it. */
50 
51  class Partition {
52  public:
53  int refno;
54  double load; // total load in this set
55  int origin[3]; // box coordinates
56  int corner[3];
57  int count; // number of objects in this partition
58  int node, mapped;
59  CkVec<int> bkpes; // background processors
60  public:
61  Partition(): refno(0), load(0.0), node(-1), mapped(0) {};
62  };
63 
64 private:
65  struct ComputeLoad {
66  int id;
67  int v[3];
68  double load;
69  int refno;
70  double tv;
71  Partition * partition;
72  };
73 
74 
75  struct VecArray {
76  int v;
77  int id;
78  };
79 
80  enum {XDIR=0, YDIR, ZDIR};
81 
82 public:
83  double overLoad;
84 
85 //**************************************
86 // ORB3DLB functions
87 //**************************************
88 //
89  void work2(BaseLB::LDStats* stats, int count);
90  void greedy(BaseLB::LDStats* stats, int count);
91  void directMap(TPObject *tp, int ntp, Node *nodes);
92  void map(TPObject *tp, int ntp, int nn, Node *procs, int xs, int ys, int zs, int dim);
93  int nextDim(int dim, int xs, int ys, int zs);
94  TPObject *partitionEvenLoad(TPObject *tp, int &ntp);
95  Node *halveNodes(Node *start, int np);
96 
97  void pup(PUP::er &p);
98 };
99 
100 #endif /* _MultistepLB */
101 
hold information needed by the load balancer for each TreePiece.
Definition: MapStructures.h:121
Definition: MapStructures.h:170
Definition: MultistepLB.h:28
Definition: MultistepLB.h:51