Skip to content

Commit

Permalink
#2201: annotated code for side-by-side comparison with LBAF
Browse files Browse the repository at this point in the history
  • Loading branch information
ppebay committed Dec 5, 2023
1 parent 7d251f2 commit 704a21d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/vt/vrt/collection/balance/temperedlb/temperedlb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1895,35 +1895,41 @@ void TemperedLB::swapClusters() {

auto const this_node = theContext()->getNode();

// Iddentify and perform beneficial cluster swaps
int n_rank_swaps = 0;
for (auto const& [try_rank, try_clusters] : other_rank_clusters_) {
bool found_potential_good_swap = false;

// if (try_clusters.size() < cur_clusters_.size()) {
// proxy_[try_rank].template send<&TemperedLB::tryLock>(this_node, 100);
// continue;
// }


// Iterate over source clusters
for (auto const& [src_shared_id, src_cluster] : cur_clusters_) {
auto const& [src_cluster_bytes, src_cluster_load] = src_cluster;

// Iterate over target clusters
for (auto const& [try_shared_id, try_cluster] : try_clusters) {
auto const& [try_cluster_bytes, try_cluster_load] = try_cluster;
// Decide whether swap is beneficial
double c_try = criterion(
std::make_tuple(src_shared_id, src_cluster_bytes, src_cluster_load),
std::make_tuple(try_rank, try_shared_id, try_cluster_bytes, try_cluster_load)
);
if (c_try > 0.0) {
// Try to perform swap
found_potential_good_swap = true;
// request lock
proxy_[try_rank].template send<&TemperedLB::tryLock>(this_node, c_try);
n_rank_swaps;

Check warning on line 1924 in src/vt/vrt/collection/balance/temperedlb/temperedlb.cc

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/vt/vrt/collection/balance/temperedlb/temperedlb.cc#L1924

Unused variable value 'n_rank_swaps'
break;
}
}
if (found_potential_good_swap) {
break;
}
}
}
} // try_clusters
} // cur_clusters_
} // other_rank_clusters

// We have to be very careful here since we will allow some reentrancy here.
constexpr int turn_scheduler_times = 10;
Expand Down

0 comments on commit 704a21d

Please sign in to comment.