From 4e3c83d62a5c713506a341bbfe0037b47c8aae0f Mon Sep 17 00:00:00 2001 From: Yeeland <71429545+YeelandX@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:40:34 +0800 Subject: [PATCH] add fc hit rate log (#46) * add fc hit rate log --------- Co-authored-by: Yeeland --- paddle/fluid/framework/fleet/box_wrapper.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paddle/fluid/framework/fleet/box_wrapper.cc b/paddle/fluid/framework/fleet/box_wrapper.cc index 99b94dba726c7a..70417f52de398d 100644 --- a/paddle/fluid/framework/fleet/box_wrapper.cc +++ b/paddle/fluid/framework/fleet/box_wrapper.cc @@ -1152,6 +1152,13 @@ void BoxWrapper::PrintSyncTimer(int device, double train_span) { << ", dense nccl:" << dev.dense_nccl_timer.ElapsedSec() << ", sync stream:" << dev.dense_sync_timer.ElapsedSec() << ", wrapper xpu memory:" << dev.GpuMemUsed() << "MB"; + + auto env_str = std::getenv("ENABLE_FC_HIT_RATE"); + if (env_str != nullptr && (strcmp(env_str, "true") == 0 || strcmp(env_str, "1") == 0)) { + auto place = platform::XPUPlace(device); + auto xpu_context = static_cast(platform::DeviceContextPool::Instance().Get(place))->x_context(); + LOG(INFO) << "xpu: " << device << ", fc_hit_rate: " << xpu_context->get_fc_hit_rate(); + } #else LOG(WARNING) << "cpu: " << device << ", phase: " << phase_ << ", train dnn: " << train_span