Skip to content

Commit

Permalink
#2201: fixed print errors; added pseudocode; and epoch boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
ppebay committed Nov 29, 2023
1 parent 7133f33 commit 3cd9309
Showing 1 changed file with 47 additions and 6 deletions.
53 changes: 47 additions & 6 deletions src/vt/vrt/collection/balance/temperedlb/temperedlb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ void TemperedLB::originalTransfer() {
// Initialize transfer and rejection counters
int n_transfers = 0, n_rejected = 0;

// Try to migrate objects only from overloaded objects
// Try to migrate objects only from overloaded ranks
if (is_overloaded_) {
std::vector<NodeType> under = makeUnderloaded();
std::unordered_map<NodeType, ObjsType> migrate_objs;
Expand Down Expand Up @@ -1473,7 +1473,7 @@ void TemperedLB::originalTransfer() {

vt_debug_print(
verbose, temperedlb,
"TemperedLB::decide: selected_node={}, load_info_.size()={}\n",
"TemperedLB::originalTransfer: selected_node={}, load_info_.size()={}\n",
selected_node, load_info_.size()
);

Expand All @@ -1488,7 +1488,7 @@ void TemperedLB::originalTransfer() {
);
vt_debug_print(
verbose, temperedlb,
"TemperedLB::decide: trial={}, iter={}, under.size()={}, "
"TemperedLB::originalTransfer: trial={}, iter={}, under.size()={}, "
"selected_node={}, selected_load={:e}, obj_id={:x}, home={}, "
"obj_load={}, target_max_load={}, this_new_load_={}, "
"criterion={}\n",
Expand Down Expand Up @@ -1544,7 +1544,7 @@ void TemperedLB::originalTransfer() {

if (theConfig()->vt_debug_temperedlb) {
// compute rejection rate because it will be printed
runInEpochCollective("TemperedLB::decide -> compute rejection", [=] {
runInEpochCollective("TemperedLB::originalTransfer -> compute rejection", [=] {
proxy_.allreduce<&TemperedLB::rejectionStatsHandler, collective::PlusOp>(
n_rejected, n_transfers
);
Expand All @@ -1553,11 +1553,52 @@ void TemperedLB::originalTransfer() {
}

void TemperedLB::swapClusters() {
//auto lazy_epoch = theTerm()->makeEpochCollective("TemperedLB: swapClusters");
auto lazy_epoch = theTerm()->makeEpochCollective("TemperedLB: swapClusters");

// Initialize transfer and rejection counters
//int n_transfers = 0, n_rejected = 0;
int n_transfers = 0, n_rejected = 0;

Check notice on line 1559 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#L1559

The scope of the variable 'n_transfers' can be reduced.

// Try to migrate objects only from overloaded ranks
if (is_overloaded_) {
// Compute collection of potential targets
std::vector<NodeType> under = makeUnderloaded();
std::unordered_map<NodeType, ObjsType> migrate_objs;
if (under.size() > 0) {
std::vector<ObjIDType> ordered_obj_ids = orderObjects(
obj_ordering_, cur_objs_, this_new_load_, target_max_load_
);

// Cluster migratable objects on source rank

// Iterage over potential targets to try to swap clusters

//// Iteratr over target clusters

////// Decide whether swap is beneficial


//////// If swap is beneficial compute source cluster size
//////// Test whether criterion is creater than swap RTOL times source size

////////// Only in this case perform swap
////////// Else reject swap

} // if (under.size() > 0)
} // if (is_overloaded_)

// Finalize epoch
theTerm()->finishedEpoch(lazy_epoch);
vt::runSchedulerThrough(lazy_epoch);

// Report on rejection rate in debug mode
if (theConfig()->vt_debug_temperedlb) {
runInEpochCollective("TemperedLB::swapClusters -> compute rejection", [=] {
proxy_.allreduce<&TemperedLB::rejectionStatsHandler, collective::PlusOp>(
n_rejected, n_transfers
);
});
}

} // void TemperedLB::originalTransfer()

void TemperedLB::thunkMigrations() {
Expand Down

0 comments on commit 3cd9309

Please sign in to comment.