Skip to content

Commit

Permalink
#2201: added tempered criterion when ONLY load transfer is considered
Browse files Browse the repository at this point in the history
  • Loading branch information
ppebay committed Dec 9, 2023
1 parent 0536012 commit f00853c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/vt/vrt/collection/balance/temperedlb/temperedlb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,22 @@ auto TemperedLB::removeClusterToSend(
);
}

double loadTransferCriterion(std::tuple<double, double, double> in_values){
// Compute maximum work of original arrangement
auto const before_w_src = std::get<0>(in_values);
auto const before_w_dst = std::get<1>(in_values);
auto const w_max_0 = std::max(before_w_src, before_w_dst);

// Compute maximum work of arrangement after load transfer
auto const src_l = std::get<2>(in_values);
auto const after_w_src = before_w_src - src_l;
auto const after_w_dst = before_w_dst + src_l;
auto const w_max_new = std::max(after_w_src, after_w_dst);

// Return criterion value
return w_max_0 - w_max_new;
} // double loadTransferCriterion

void TemperedLB::considerSubClustersAfterLock(MsgSharedPtr<LockedInfoMsg> msg) {
is_swapping_ = true;

Expand All @@ -1666,18 +1682,22 @@ void TemperedLB::considerSubClustersAfterLock(MsgSharedPtr<LockedInfoMsg> msg) {
auto const src_after_mem = current_memory_usage_;
auto const try_after_mem = try_total_bytes + src_bytes;

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

// Compute maximum work of original arrangement
auto const before_work_src = this_new_load_;
auto const before_work_try = try_total_load;
auto const w_max_0 = std::max(before_work_src, before_work_try);

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

// Return criterion value
return w_max_0 - w_max_new;
};

Expand Down
7 changes: 7 additions & 0 deletions src/vt/vrt/collection/balance/temperedlb/temperedlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ struct TemperedLB : BaseLB {
*/
void lockObtained(LockedInfoMsg* msg);

/**
* \brief Compute tempered criterion when only load transfer is considered
*
* \param[in] in_value contains: source work, destination work, transferred load
*/
double loadTransferCriterion(std::tuple<double, double, double> in_values);

/**
* \brief Consider possible swaps with all the up-to-date info from a rank
*
Expand Down

0 comments on commit f00853c

Please sign in to comment.