Skip to content

Commit a85ffd5

Browse files
ppebaylifflander
authored andcommitted
#2201: reviewed algorithm and annotated for better legibility
1 parent 47d29c5 commit a85ffd5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -1852,18 +1852,22 @@ void TemperedLB::considerSwapsAfterLock(MsgSharedPtr<LockedInfoMsg> msg) {
18521852
auto const src_after_mem = current_memory_usage_ - src_bytes + try_bytes;
18531853
auto const try_after_mem = try_total_bytes + src_bytes - try_bytes;
18541854

1855+
// Check whether strict bounds on memory are satisfied
18551856
if (src_after_mem > mem_thresh_ or try_after_mem > mem_thresh_) {
18561857
return - std::numeric_limits<double>::infinity();
18571858
}
18581859

1860+
// Compute maximum work of original arrangement
18591861
auto const before_work_src = this_new_load_;
18601862
auto const before_work_try = try_total_load;
18611863
auto const w_max_0 = std::max(before_work_src, before_work_try);
18621864

1865+
// Compute maximum work of proposed new arrangement
18631866
auto const after_work_src = this_new_load_ - src_load + try_load;
18641867
auto const after_work_try = before_work_try + src_load - try_load;
18651868
auto const w_max_new = std::max(after_work_src, after_work_try);
18661869

1870+
// Return criterion value
18671871
return w_max_0 - w_max_new;
18681872
};
18691873

@@ -2258,7 +2262,7 @@ void TemperedLB::swapClusters() {
22582262
theTerm()->pushEpoch(lazy_epoch);
22592263

22602264
auto criterion = [this](auto src_cluster, auto try_cluster) -> double {
2261-
// this does not handle empty cluster swaps
2265+
// FIXME: this does not swaps with an empty cluster
22622266
auto const& [src_id, src_bytes, src_load] = src_cluster;
22632267
auto const& [try_rank, try_id, try_bytes, try_load, try_mem] = try_cluster;
22642268

@@ -2362,9 +2366,9 @@ void TemperedLB::swapClusters() {
23622366
getSharedBlocksHere().size(), mem_thresh_, this_new_load_
23632367
);
23642368

2365-
int n_rejected = 0;
23662369

23672370
// Report on rejection rate in debug mode
2371+
int n_rejected = 0;
23682372
if (theConfig()->vt_debug_temperedlb) {
23692373
runInEpochCollective("TemperedLB::swapClusters -> compute rejection", [=] {
23702374
proxy_.allreduce<&TemperedLB::rejectionStatsHandler, collective::PlusOp>(

0 commit comments

Comments
 (0)