From 5a6c3cd9e08fb4a39605b53bb4a8d2520bcbbb75 Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Mon, 13 Aug 2018 11:02:18 +0800 Subject: [PATCH] fix profiler dead lock --- paddle/fluid/platform/device_tracer.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/platform/device_tracer.cc b/paddle/fluid/platform/device_tracer.cc index e5425209f18..dc1d7511411 100644 --- a/paddle/fluid/platform/device_tracer.cc +++ b/paddle/fluid/platform/device_tracer.cc @@ -318,11 +318,12 @@ class DeviceTracerImpl : public DeviceTracer { } void Disable() { - std::lock_guard l(trace_mu_); #ifdef PADDLE_WITH_CUPTI // flush might cause additional calls to DeviceTracker. dynload::cuptiActivityFlushAll(CUPTI_ACTIVITY_FLAG_FLUSH_FORCED); - +#endif // PADDLE_WITH_CUPTI + std::lock_guard l(trace_mu_); +#ifdef PADDLE_WITH_CUPTI DisableActivity(); dynload::cuptiUnsubscribe(subscriber_); CUPTI_CALL(dynload::cuptiGetTimestamp(&end_ns_)); -- GitLab