Skip to content

Commit

Permalink
#1359: LB: add function for printing lb-specific args
Browse files Browse the repository at this point in the history
  • Loading branch information
nlslatt committed Sep 17, 2021
1 parent 11571b6 commit d104b19
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,40 @@ void LBManager::startLB(PhaseType phase, LBType lb) {
runLB(base_proxy, phase);
}

void LBManager::printLBArgsHelp(LBType lb) {
if (theContext()->getNode() == 0) {
fmt::print("\nLB arguments for {}:\n\n", lb_names_[lb]);

std::unordered_map<std::string, std::string> help;

switch (lb) {
case LBType::HierarchicalLB:
help = std::move(lb::HierarchicalLB::getInputKeysWithHelp());
break;
case LBType::GreedyLB:
help = std::move(lb::GreedyLB::getInputKeysWithHelp());
break;
case LBType::RotateLB:
help = std::move(lb::RotateLB::getInputKeysWithHelp());
break;
case LBType::TemperedLB:
help = std::move(lb::TemperedLB::getInputKeysWithHelp());
break;
case LBType::RandomLB:
help = std::move(lb::RandomLB::getInputKeysWithHelp());
break;
default:
fmt::print("Documentation has not been provided for this LB.\n\n");
break;
}

for (auto &arg_help : help) {
fmt::print("Argument: {}\n", arg_help.first);
fmt::print("{}\n", arg_help.second);
}
}
}

void LBManager::startup() {
thePhase()->registerHookCollective(phase::PhaseHook::EndPostMigration, []{
auto const phase = thePhase()->getCurrentPhase();
Expand Down
8 changes: 8 additions & 0 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ struct LBManager : runtime::component::Component<LBManager> {
*/
void startLB(PhaseType phase, LBType lb);

/**
* \internal
* \brief Print documentation for LB args for the chosen LB
*
* \param[in] lb the load balancer to query
*/
static void printLBArgsHelp(LBType lb);

protected:
/**
* \internal
Expand Down

0 comments on commit d104b19

Please sign in to comment.