2 * Author: gplkrsh2@illinois.edu (Harshitha Menon)
4 * A distributed load balancer which consists of two phases.
5 * 1. Information propagation
6 * 2. Probabilistic transfer of load
8 * Information propagation is done using Gossip protocol where the information
9 * about the underloaded processors in the system is spread to the overloaded
11 * Once the overloaded processors receive the partial information about the
12 * underloaded processors in the system, it does probabilistic load transfer.
13 * The probability of a PE receiving load is inversely proportional to its
20 #include "DistBaseLB.h"
21 #include "DistributedLB.decl.h"
27 void CreateDistributedLB();
29 class DistributedLB
: public CBase_DistributedLB
{
31 DistributedLB(const CkLBOptions
&);
32 DistributedLB(CkMigrateMessage
*m
);
33 void GossipLoadInfo(int, int, int, int[], double[]);
34 void AvgLoadReduction(double x
);
36 void InformMigration(int obj_id
, int from_pe
, double obj_load
, bool force
);
37 void RecvAck(int obj_id
, int assigned_pe
, bool can_accept
);
38 void SendAfterBarrier(CkReductionMsg
*msg
);
41 CProxy_DistributedLB thisProxy
;
43 int underloaded_pe_count
;
44 std::vector
<int> pe_no
;
45 std::vector
<double> loads
;
46 std::vector
<double> distribution
;
48 int total_migrates_ack
;
50 std::vector
<MigrateInfo
*> migrateInfo
;
54 double kTransferThreshold
;
55 int kPartialInfoCount
;
57 int kMaxGossipMsgCount
;
65 double b_load_per_obj
;
70 const DistBaseLB::LDStats
* my_stats
;
72 void InitLB(const CkLBOptions
&);
75 void LoadBalance(CkVec
<int> &obj_no
, CkVec
<int> &obj_pe_no
);
76 void MapObjsToPe(minHeap
&objs
, CkVec
<int> &obj_no
, CkVec
<int> &obj_pe_no
);
77 int PickRandReceiverPeIdx() const;
78 void CalculateCumulateDistribution();
79 void Strategy(const DistBaseLB::LDStats
* const stats
);
81 bool QueryBalanceNow(int step
) { return true; };
84 #endif /* _DistributedLB_H_ */