diff --git a/docs/md/lb-manager.md b/docs/md/lb-manager.md index d5accf4714..be39e25962 100644 --- a/docs/md/lb-manager.md +++ b/docs/md/lb-manager.md @@ -46,7 +46,7 @@ The following is an example LB specification: 120 GreedyLB c=0 k=2 f=3 i=3 \endcode -To print LB specification during startup, use `--vt_lb_print_file` command line flag. +To print LB specification during startup, use `--vt_lb_show_spec` command line flag. \section load-balancers Load balancers diff --git a/src/vt/configs/arguments/app_config.h b/src/vt/configs/arguments/app_config.h index 75c604e27f..596232cc54 100644 --- a/src/vt/configs/arguments/app_config.h +++ b/src/vt/configs/arguments/app_config.h @@ -130,7 +130,7 @@ struct AppConfig { bool vt_trace_irecv_polling = false; bool vt_lb = false; - bool vt_lb_print_file = false; + bool vt_lb_show_spec = false; bool vt_lb_quiet = false; std::string vt_lb_file_name = ""; std::string vt_lb_name = "NoLB"; diff --git a/src/vt/configs/arguments/args.cc b/src/vt/configs/arguments/args.cc index 67ef1aa25d..6b6540e5c7 100644 --- a/src/vt/configs/arguments/args.cc +++ b/src/vt/configs/arguments/args.cc @@ -327,7 +327,7 @@ void ArgConfig::addLbArgs(CLI::App& app) { auto lb_args = "Arguments pass to LB: \"x=0 y=1 test=2\""; auto lb_quiet = "Silence load balancing output"; auto lb_file_name = "LB specification file to read"; - auto lb_print_file = "Print LB specification file during startup"; + auto lb_show_spec = "Show LB specification during startup"; auto lb_name = "Name of the load balancer to use"; auto lb_interval = "Load balancing interval"; auto lb_stats = "Enable load balancing statistics"; @@ -345,7 +345,7 @@ void ArgConfig::addLbArgs(CLI::App& app) { auto t1 = app.add_flag("--vt_lb_quiet", config_.vt_lb_quiet, lb_quiet); auto u = app.add_option("--vt_lb_file_name", config_.vt_lb_file_name, lb_file_name, lbf) ->check(CLI::ExistingFile); - auto u1 = app.add_flag("--vt_lb_print_file", config_.vt_lb_print_file, lb_print_file); + auto u1 = app.add_flag("--vt_lb_show_spec", config_.vt_lb_show_spec, lb_show_spec); auto v = app.add_option("--vt_lb_name", config_.vt_lb_name, lb_name, lbn); auto v1 = app.add_option("--vt_lb_args", config_.vt_lb_args, lb_args, lba); auto w = app.add_option("--vt_lb_interval", config_.vt_lb_interval, lb_interval, lbi); diff --git a/src/vt/runtime/runtime_banner.cc b/src/vt/runtime/runtime_banner.cc index 038a0eb9f7..ce3e465f2b 100644 --- a/src/vt/runtime/runtime_banner.cc +++ b/src/vt/runtime/runtime_banner.cc @@ -63,27 +63,44 @@ #include -void printLBConfig(std::string const& filename) { +auto param_str = [](std::unordered_map const& params) -> std::string { + std::stringstream ss; + for (auto&& param : params) { + ss << fmt::format("{}={} ", + vt::debug::emph(param.first), + vt::debug::emph(param.second)); + } + std::string s = ss.str(); + return s.empty() ? s : s.substr(0, s.size() - 1); +}; + +void printLBSpec(std::string const& filename) { using Spec = vt::vrt::collection::balance::ReadLBSpec; Spec::openFile(filename); Spec::readFile(); + if (not Spec::getExactEntries().empty()) { + fmt::print("{}\tExact specification lines:\n", vt::debug::vtPre()); + } for (auto const& exact_entry : Spec::getExactEntries()) { - std::string formatted_params; - for (auto const& param : exact_entry.second.getParams()) { - formatted_params += fmt::format("{}={} ", param.first, param.second); - } + fmt::print("{}\tRun `{}` on phase {} with arguments `{}`\n", + vt::debug::vtPre(), + vt::debug::emph(exact_entry.second.getName()), + vt::debug::emph(std::to_string(exact_entry.second.getIdx())), + param_str(exact_entry.second.getParams())); + } - fmt::print("Run `{}` on phase {} with arguments `{}`\n", exact_entry.second.getName(), exact_entry.second.getIdx(), formatted_params); + if (not Spec::getModEntries().empty()) { + fmt::print("{}\tMod (%) specification lines:\n", vt::debug::vtPre()); } for (auto const& mod_entry : Spec::getModEntries()) { - std::string formatted_params; - for (auto const& param : mod_entry.second.getParams()) { - formatted_params += fmt::format("{}={} ", param.first, param.second); - } - - fmt::print("Run `{}` every {} phases with arguments `{}`\n", mod_entry.second.getName(), mod_entry.second.getIdx(), formatted_params); + fmt::print("{}\tRun `{}` every {} phases with arguments {}\n", + vt::debug::vtPre(), + vt::debug::emph(mod_entry.second.getName()), + vt::debug::emph(std::to_string(mod_entry.second.getIdx())), + param_str(mod_entry.second.getParams())); } return; @@ -308,14 +325,14 @@ void Runtime::printStartupBanner() { auto f9 = opt_on("--vt_lb", "Load balancing enabled"); fmt::print("{}\t{}{}", vt_pre, f9, reset); if (getAppConfig()->vt_lb_file_name != "") { - auto f10 = opt_on("--vt_lb_file", "Reading LB config from file"); - fmt::print("{}\t{}{}", vt_pre, f10, reset); - auto f12 = fmt::format("Reading file \"{}\"", getAppConfig()->vt_lb_file_name); + auto f12 = fmt::format("Reading LB specification from file \"{}\"", getAppConfig()->vt_lb_file_name); auto f11 = opt_on("--vt_lb_file_name", f12); fmt::print("{}\t{}{}", vt_pre, f11, reset); - if (getAppConfig()->vt_lb_print_file) { - printLBConfig(getAppConfig()->vt_lb_file_name); + if (getAppConfig()->vt_lb_show_spec) { + auto s = opt_on("--vt_lb_show_spec", "Showing LB specification"); + fmt::print("{}\t{}", vt_pre, s); + printLBSpec(getAppConfig()->vt_lb_file_name); } } else { auto a3 = fmt::format("Load balancer name: \"{}\"", getAppConfig()->vt_lb_name);