Skip to content

Commit

Permalink
#769: gossiplb: use reduction instead for sync
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Apr 15, 2020
1 parent 0e025b0 commit 442e579
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
14 changes: 13 additions & 1 deletion src/vt/vrt/collection/balance/gossiplb/gossiplb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,15 @@ void GossipLB::inform() {
k_max_, k_cur_, is_underloaded_, is_overloaded_, this_new_load_
);

theCollective()->barrier();
setup_done_ = false;

auto cb = theCB()->makeBcast<GossipLB, ReduceMsgType, &GossipLB::setupDone>(proxy_);
auto msg = makeMessage<ReduceMsgType>();
proxy_.reduce(msg.get(), cb);

while (not setup_done_) {
vt::runScheduler();
}

bool inform_done = false;
auto propagate_epoch = theTerm()->makeEpochCollective("GossipLB: inform");
Expand All @@ -207,6 +215,10 @@ void GossipLB::inform() {
);
}

void GossipLB::setupDone(ReduceMsgType* msg) {
setup_done_ = true;
}

void GossipLB::propagateRound(EpochType epoch) {
debug_print(
gossiplb, node,
Expand Down
10 changes: 7 additions & 3 deletions src/vt/vrt/collection/balance/gossiplb/gossiplb.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@
namespace vt { namespace vrt { namespace collection { namespace lb {

struct GossipLB : BaseLB {
using GossipMsg = balance::GossipMsg;
using NodeSetType = std::vector<NodeType>;
using ObjsType = std::unordered_map<ObjIDType, LoadType>;
using GossipMsg = balance::GossipMsg;
using NodeSetType = std::vector<NodeType>;
using ObjsType = std::unordered_map<ObjIDType, LoadType>;
using ReduceMsgType = vt::collective::ReduceNoneMsg;

GossipLB() = default;

Expand Down Expand Up @@ -96,6 +97,8 @@ struct GossipLB : BaseLB {
void inLazyMigrations(balance::LazyMigrationMsg* msg);
void thunkMigrations();

void setupDone(ReduceMsgType* msg);

private:
uint8_t f_ = 4;
uint8_t k_max_ = 4;
Expand All @@ -112,6 +115,7 @@ struct GossipLB : BaseLB {
std::unordered_map<ObjIDType, TimeType> cur_objs_ = {};
LoadType this_new_load_ = 0.0;
CriterionEnum criterion_ = CriterionEnum::ModifiedGrapevine;
bool setup_done_ = false;
};

}}}} /* end namespace vt::vrt::collection::lb */
Expand Down

0 comments on commit 442e579

Please sign in to comment.