Skip to content

Commit f2332af

Browse files
committed
#2201: temperedlb: sketch of some code written in the meeting
1 parent 02a9396 commit f2332af

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

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

+22-19
Original file line numberDiff line numberDiff line change
@@ -1552,39 +1552,42 @@ void TemperedLB::originalTransfer() {
15521552
}
15531553
}
15541554

1555+
// void TemperedLB::tryLock(
1556+
// NodeType requesting_node, double criterion_value, SharedIDType cluster_id
1557+
// ) {
1558+
// // some logic
1559+
1560+
// // if yes
1561+
// is_locked = true;
1562+
// proxy_[requesting_node].template send<ThisType::lockObtained>(/*full info on cluster*/);
1563+
// }
1564+
1565+
// void TemperedLB::lockObtained() {
1566+
1567+
// }
1568+
15551569
void TemperedLB::swapClusters() {
15561570
auto lazy_epoch = theTerm()->makeEpochCollective("TemperedLB: swapClusters");
15571571

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

15611575
// Try to migrate objects only from overloaded ranks
1562-
if (is_overloaded_) {
1563-
// Compute collection of potential targets
1564-
std::vector<NodeType> under = makeUnderloaded();
1565-
std::unordered_map<NodeType, ObjsType> migrate_objs;
1566-
if (under.size() > 0) {
1567-
std::vector<ObjIDType> ordered_obj_ids = orderObjects(
1568-
obj_ordering_, cur_objs_, this_new_load_, target_max_load_
1569-
);
1576+
// Compute collection of potential targets
1577+
// std::vector<NodeType> targets = other_rank_clusters_.keys();
1578+
// sample cmf
1579+
// Iterage over potential targets to try to swap clusters
15701580

1571-
// Cluster migratable objects on source rank
1581+
//// Iteratr over target clusters
15721582

1573-
// Iterage over potential targets to try to swap clusters
1574-
1575-
//// Iteratr over target clusters
1576-
1577-
////// Decide whether swap is beneficial
1583+
////// Decide whether swap is beneficial
15781584

15791585

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

1583-
////////// Only in this case perform swap
1584-
////////// Else reject swap
1585-
1586-
} // if (under.size() > 0)
1587-
} // if (is_overloaded_)
1589+
// send try-lock message, with numerical criterion value
1590+
// spin in the scheduler
15881591

15891592
// Finalize epoch
15901593
theTerm()->finishedEpoch(lazy_epoch);

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

+2
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ struct TemperedLB : BaseLB {
233233
std::unordered_map<NodeType, ClusterSummaryType> other_rank_clusters_;
234234
/// User-defined memory threshold
235235
BytesType mem_thresh_ = 0;
236+
///
237+
bool is_locked = false;
236238
};
237239

238240
}}}} /* end namespace vt::vrt::collection::lb */

0 commit comments

Comments
 (0)