Skip to content

Commit

Permalink
#1014 dump node stats even if LB was not run
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Strzebonski committed Sep 21, 2020
1 parent cc3ae67 commit ec8ab0d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
4 changes: 4 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 @@ -353,4 +353,8 @@ void LBManager::triggerListeners(PhaseType phase) {
}
}

void LBManager::flushNodeStats(PhaseType phase) {
theNodeStats()->outputStatsForPhase(phase);
}

}}}} /* end namespace vt::vrt::collection::balance */
11 changes: 11 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 @@ -203,6 +203,7 @@ struct LBManager : runtime::component::Component<LBManager> {
void sysReleaseLB(MsgT* msg) {
vt_debug_print(lb, node, "sysReleaseLB\n");
printMemoryUsage(msg->phase_);
flushNodeStats(msg->phase_);
flushTraceNextPhase();
setTraceEnabledNextPhase(msg->phase_);
return releaseImpl(msg->phase_, msg->num_collections_);
Expand Down Expand Up @@ -263,6 +264,16 @@ struct LBManager : runtime::component::Component<LBManager> {
template <typename LB>
void makeLB(MsgSharedPtr<StartLBMsg> msg);

private:
/**
* \internal \brief Communicate to the NodeStats component that a new phase
* occurred without running LB so flushing of previous node stats
* can occur if required
*
* \param[in] phase the phase
*/
void flushNodeStats(PhaseType phase);

private:
std::size_t num_invocations_ = 0;
std::size_t num_release_ = 0;
Expand Down
12 changes: 7 additions & 5 deletions src/vt/vrt/collection/balance/node_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,7 @@ void NodeStats::startIterCleanup(PhaseType phase, int look_back) {
}
node_data_[phase] = std::move(new_data);

// Statistics output when LB is enabled and appropriate flag is enabled
if (theConfig()->vt_lb_stats) {
outputStatsForPhase(phase);
}
outputStatsForPhase(phase);

if (phase - look_back >= 0) {
node_data_.erase(phase - look_back);
Expand Down Expand Up @@ -192,7 +189,7 @@ void NodeStats::createStatsFile() {

vt_debug_print(
lb, node,
"NodeStats: createStatsFile file={}\n", file_name
"NodeStats::createStatsFile file={}\n", file_name
);

// Node 0 creates the directory
Expand Down Expand Up @@ -232,6 +229,11 @@ void NodeStats::closeStatsFile() {
}

void NodeStats::outputStatsForPhase(PhaseType phase) {
// Statistics output when LB is enabled and appropriate flag is enabled
if (!theConfig()->vt_lb_stats) {
return;
}

vtAssertExpr(stats_file_ != nullptr);

vt_print(lb, "NodeStats::outputStatsForPhase: file={}, phase={}\n", print_ptr(stats_file_), phase);
Expand Down

0 comments on commit ec8ab0d

Please sign in to comment.