diff --git a/src/vt/configs/arguments/app_config.h b/src/vt/configs/arguments/app_config.h index 15f8f55b49..986e0074b5 100644 --- a/src/vt/configs/arguments/app_config.h +++ b/src/vt/configs/arguments/app_config.h @@ -102,6 +102,7 @@ struct AppConfig { bool vt_print_memory_at_threshold = false; std::string vt_print_memory_threshold = "1 GiB"; int32_t vt_print_memory_sched_poll = 100; + bool vt_print_memory_footprint = false; bool vt_no_warn_stack = false; bool vt_no_assert_stack = false; @@ -249,6 +250,7 @@ struct AppConfig { | vt_print_memory_at_threshold | vt_print_memory_threshold | vt_print_memory_sched_poll + | vt_print_memory_footprint | vt_no_warn_stack | vt_no_assert_stack diff --git a/src/vt/configs/arguments/args.cc b/src/vt/configs/arguments/args.cc index 355db84ba6..a45290ffee 100644 --- a/src/vt/configs/arguments/args.cc +++ b/src/vt/configs/arguments/args.cc @@ -105,6 +105,7 @@ void ArgConfig::addMemUsageArgs(CLI::App& app) { auto mem_at_thresh = "Print memory usage from scheduler when reaches a threshold increment"; auto mem_thresh = "The threshold increments to print memory usage: \" {GiB,MiB,KiB,B}\""; auto mem_sched = "The frequency to query the memory threshold check (some memory reporters might be expensive)"; + auto mem_footprint = "Print live components' memory footprint after initialization and before shutdown"; auto mm = app.add_option("--vt_memory_reporters", config_.vt_memory_reporters, mem_desc, true); auto mn = app.add_flag("--vt_print_memory_each_phase", config_.vt_print_memory_each_phase, mem_phase); auto mo = app.add_option("--vt_print_memory_node", config_.vt_print_memory_node, mem_node, true); @@ -112,6 +113,7 @@ void ArgConfig::addMemUsageArgs(CLI::App& app) { auto mq = app.add_flag("--vt_print_memory_at_threshold", config_.vt_print_memory_at_threshold, mem_at_thresh); auto mr = app.add_option("--vt_print_memory_threshold", config_.vt_print_memory_threshold, mem_thresh, true); auto ms = app.add_option("--vt_print_memory_sched_poll", config_.vt_print_memory_sched_poll, mem_sched, true); + auto mf = app.add_flag("--vt_print_memory_footprint", config_.vt_print_memory_footprint, mem_footprint); auto memoryGroup = "Memory Usage Reporting"; mm->group(memoryGroup); mn->group(memoryGroup); @@ -120,6 +122,7 @@ void ArgConfig::addMemUsageArgs(CLI::App& app) { mq->group(memoryGroup); mr->group(memoryGroup); ms->group(memoryGroup); + mf->group(memoryGroup); } diff --git a/src/vt/runtime/runtime.cc b/src/vt/runtime/runtime.cc index dccc617869..fd646e7483 100644 --- a/src/vt/runtime/runtime.cc +++ b/src/vt/runtime/runtime.cc @@ -441,7 +441,9 @@ bool Runtime::finalize(bool const force_now, bool const disable_sig) { } # endif - printMemoryFootprint(); + if (getAppConfig()->vt_print_memory_footprint) { + printMemoryFootprint(); + } auto const& num_units = theTerm->getNumUnits(); auto const coll_epochs = theTerm->getNumTerminatedCollectiveEpochs(); diff --git a/src/vt/runtime/runtime_banner.cc b/src/vt/runtime/runtime_banner.cc index 90edc90a98..a89bb29894 100644 --- a/src/vt/runtime/runtime_banner.cc +++ b/src/vt/runtime/runtime_banner.cc @@ -855,7 +855,9 @@ void Runtime::printStartupBanner() { } } - printMemoryFootprint(); + if (getAppConfig()->vt_print_memory_footprint) { + printMemoryFootprint(); + } //fmt::print("{}\n", reset); fmt::print(reset);