Skip to content

Commit

Permalink
#1359: config: add cli argument for lb arg help
Browse files Browse the repository at this point in the history
  • Loading branch information
nlslatt authored and lifflander committed Sep 28, 2021
1 parent 2afc750 commit 6071c69
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/vt/configs/arguments/app_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ struct AppConfig {
std::string vt_lb_stats_file = "stats.%p.json";
std::string vt_lb_stats_dir_in = "vt_lb_stats_in";
std::string vt_lb_stats_file_in = "stats.%p.json";
bool vt_help_lb_args = false;

bool vt_no_detect_hang = false;
bool vt_print_no_progress = true;
Expand Down Expand Up @@ -308,6 +309,7 @@ struct AppConfig {
| vt_lb_stats_file
| vt_lb_stats_dir_in
| vt_lb_stats_file_in
| vt_help_lb_args

| vt_no_detect_hang
| vt_print_no_progress
Expand Down
8 changes: 7 additions & 1 deletion src/vt/configs/arguments/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ void ArgConfig::addLbArgs(CLI::App& app) {
* Flags for enabling load balancing and configuring it
*/
auto lb = "Enable load balancing";
auto lb_args = "Arguments pass to LB: \"x=0 y=1 test=2\"";
auto lb_args = "Arguments pass to LB: \"x=0 y=1\"; try --vt_help_lb_args";
auto lb_quiet = "Silence load balancing output";
auto lb_file_name = "LB specification file to read";
auto lb_show_spec = "Show LB specification during startup";
Expand Down Expand Up @@ -393,6 +393,12 @@ void ArgConfig::addLbArgs(CLI::App& app) {
xx->group(debugLB);
xy->group(debugLB);
xz->group(debugLB);

// help options deliberately omitted from the debugLB group above so that
// they appear grouped with --vt_help when --vt_help is used
auto help_lb_args = "Print help for --vt_lb_args";
auto h1 = app.add_flag("--vt_help_lb_args", config_.vt_help_lb_args, help_lb_args);
(void) h1;
}

void ArgConfig::addDiagnosticArgs(CLI::App& app) {
Expand Down
8 changes: 8 additions & 0 deletions src/vt/runtime/runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ Runtime::Runtime(
arg_config_->parse(/*out*/ argc, /*out*/ argv);
int exit_code = std::get<0>(result);

if (getAppConfig()->vt_help_lb_args) {
// Help requested
vrt::collection::balance::LBManager::printLBArgsHelp(getAppConfig()->vt_lb_name);
if (exit_code == -1) {
exit_code = 0;
}
}

if (exit_code not_eq -1) {
// Help requested or invalid argument(s).
MPI_Comm comm = initial_communicator_;
Expand Down

0 comments on commit 6071c69

Please sign in to comment.