Skip to content

Commit

Permalink
Rearrange metric enablement, so that model metric reporter can procee…
Browse files Browse the repository at this point in the history
…d properly
  • Loading branch information
ClifHouck committed Jan 26, 2024
1 parent 6e91ff3 commit b0a970d
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/tritonserver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2330,6 +2330,25 @@ TRITONSERVER_ServerNew(
tc::Metrics::SetMetricsInterval(loptions->MetricsInterval());
tc::Metrics::SetConfigMap(loptions->MetricsConfigMap());
}

#ifdef TRITON_ENABLE_METRICS_GPU
if (loptions->Metrics() && loptions->GpuMetrics()) {
tc::Metrics::EnableGPUMetrics();
}
#endif // TRITON_ENABLE_METRICS_GPU

#ifdef TRITON_ENABLE_METRICS_CPU
if (loptions->Metrics() && loptions->CpuMetrics()) {
tc::Metrics::EnableCpuMetrics();
}
#endif // TRITON_ENABLE_METRICS_CPU

const bool poll_metrics = (loptions->GpuMetrics() || loptions->CpuMetrics());
if (loptions->Metrics() && poll_metrics) {
// Start thread to poll enabled metrics periodically
tc::Metrics::StartPollingThreadSingleton();
}

#endif // TRITON_ENABLE_METRICS

lserver->SetId(loptions->ServerId());
Expand Down Expand Up @@ -2376,27 +2395,6 @@ TRITONSERVER_ServerNew(
// Initialize server
tc::Status status = lserver->Init();

#ifdef TRITON_ENABLE_METRICS
#ifdef TRITON_ENABLE_METRICS_GPU
if (loptions->Metrics() && loptions->GpuMetrics()) {
tc::Metrics::EnableGPUMetrics();
}
#endif // TRITON_ENABLE_METRICS_GPU

#ifdef TRITON_ENABLE_METRICS_CPU
if (loptions->Metrics() && loptions->CpuMetrics()) {
tc::Metrics::EnableCpuMetrics();
}
#endif // TRITON_ENABLE_METRICS_CPU

const bool poll_metrics = (loptions->GpuMetrics() || loptions->CpuMetrics());
if (loptions->Metrics() && poll_metrics) {
// Start thread to poll enabled metrics periodically
tc::Metrics::StartPollingThreadSingleton();
}
#endif // TRITON_ENABLE_METRICS


// Setup tritonserver options table
std::vector<std::string> options_headers;
options_headers.emplace_back("Option");
Expand Down

0 comments on commit b0a970d

Please sign in to comment.