From 3b032741e4ab20bb02ac9e40cb7f33cab1c07279 Mon Sep 17 00:00:00 2001 From: sunxiaoxia2022 Date: Fri, 24 Jan 2025 11:05:48 +0800 Subject: [PATCH] remove cpu_reset in destruction of CPUStreamsExecutor --- .../src/dev/threading/cpu_streams_executor.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/inference/src/dev/threading/cpu_streams_executor.cpp b/src/inference/src/dev/threading/cpu_streams_executor.cpp index bb47b813dce05f..e3e1379b6c26da 100644 --- a/src/inference/src/dev/threading/cpu_streams_executor.cpp +++ b/src/inference/src/dev/threading/cpu_streams_executor.cpp @@ -492,10 +492,10 @@ std::vector CPUStreamsExecutor::get_rank() { } void CPUStreamsExecutor::cpu_reset() { - if (!_impl->_cpu_ids_all.empty()) { - set_cpu_used(_impl->_cpu_ids_all, NOT_USED); - { - std::lock_guard lock(_impl->_cpu_ids_mutex); + { + std::lock_guard lock(_impl->_cpu_ids_mutex); + if (!_impl->_cpu_ids_all.empty()) { + set_cpu_used(_impl->_cpu_ids_all, NOT_USED); _impl->_cpu_ids_all.clear(); } } @@ -504,12 +504,6 @@ void CPUStreamsExecutor::cpu_reset() { CPUStreamsExecutor::CPUStreamsExecutor(const IStreamsExecutor::Config& config) : _impl{new Impl{config}} {} CPUStreamsExecutor::~CPUStreamsExecutor() { - try { - cpu_reset(); - } catch (const ov::Exception&) { - // Destructor should not throw - catch needed for static analysis. - OPENVINO_THROW("Reset CPU state error."); - } { std::lock_guard lock(_impl->_mutex); _impl->_isStopped = true;