Skip to content

Commit

Permalink
#1009: memory footprinting: add command-line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Nov 21, 2020
1 parent ac089a7 commit 2e8ef95
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
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 @@ -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;
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/vt/configs/arguments/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ 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: \"<value> {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);
auto mp = app.add_flag("--vt_allow_memory_report_with_ps", config_.vt_allow_memory_report_with_ps, mem_ps);
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);
Expand All @@ -120,6 +122,7 @@ void ArgConfig::addMemUsageArgs(CLI::App& app) {
mq->group(memoryGroup);
mr->group(memoryGroup);
ms->group(memoryGroup);
mf->group(memoryGroup);
}


Expand Down
4 changes: 3 additions & 1 deletion src/vt/runtime/runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion src/vt/runtime/runtime_banner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,9 @@ void Runtime::printStartupBanner() {
}
}

printMemoryFootprint();
if (getAppConfig()->vt_print_memory_footprint) {
printMemoryFootprint();
}

//fmt::print("{}\n", reset);
fmt::print(reset);
Expand Down

0 comments on commit 2e8ef95

Please sign in to comment.