Skip to content

Commit

Permalink
#1279: gossiplb: select unique nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
nlslatt committed Mar 8, 2021
1 parent 23a2469 commit 63cc8f1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/vt/vrt/collection/balance/gossiplb/gossiplb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ void GossipLB::propagateRound(EpochType epoch) {

auto& selected = selected_;
selected = underloaded_;
if (selected.find(this_node) == selected.end()) {
selected.insert(this_node);
}

auto const fanout = std::min(f_, static_cast<decltype(f_)>(num_nodes - 1));

Expand All @@ -366,7 +369,7 @@ void GossipLB::propagateRound(EpochType epoch) {

for (int i = 0; i < fanout; i++) {
// This implies full knowledge of all processors
if (selected.size() >= static_cast<size_t>(num_nodes - 1)) {
if (selected.size() >= static_cast<size_t>(num_nodes)) {
return;
}

Expand All @@ -377,9 +380,9 @@ void GossipLB::propagateRound(EpochType epoch) {
do {
random_node = dist(gen);
} while (
selected.find(random_node) != selected.end() or
random_node == this_node
selected.find(random_node) != selected.end()
);
selected.insert(random_node);

debug_print(
gossiplb, node,
Expand Down

0 comments on commit 63cc8f1

Please sign in to comment.