From d79c04a0b1f10c029082e17fd48c95cce17b0d8b Mon Sep 17 00:00:00 2001 From: yanlan song Date: Sun, 15 Jan 2023 11:03:38 +0800 Subject: [PATCH] unify name (#15067) Signed-off-by: fishbell Signed-off-by: fishbell --- src/plugins/auto/auto_executable_network.cpp | 2 ++ src/tests/unit/auto/auto_release_helper_test.cpp | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugins/auto/auto_executable_network.cpp b/src/plugins/auto/auto_executable_network.cpp index 45f399049f2..7f1d570e36f 100644 --- a/src/plugins/auto/auto_executable_network.cpp +++ b/src/plugins/auto/auto_executable_network.cpp @@ -165,6 +165,8 @@ IE::Parameter AutoExecutableNetwork::GetMetric(const std::string& name) const { continue; } else { std::string exeDevices_string = _autoSchedule->_loadContext[i].workName.substr(_autoSchedule->_loadContext[i].workName.find(":") + 1); + if (exeDevices_string == "CPU_HELP") + exeDevices_string = "(CPU)"; std::stringstream ss(exeDevices_string); std::string item; while (getline(ss, item, ',')) { diff --git a/src/tests/unit/auto/auto_release_helper_test.cpp b/src/tests/unit/auto/auto_release_helper_test.cpp index 1de2afb0ee6..29ea61caff0 100644 --- a/src/tests/unit/auto/auto_release_helper_test.cpp +++ b/src/tests/unit/auto/auto_release_helper_test.cpp @@ -170,15 +170,26 @@ TEST_P(AutoReleaseHelperTest, releaseResource) { config.insert({InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_CPU + std::string(",") + CommonTestUtils::DEVICE_GPU}); std::shared_ptr exeNetwork; - if (cpuSuccess || accSuccess) + if (cpuSuccess || accSuccess) { ASSERT_NO_THROW(exeNetwork = plugin->LoadExeNetworkImpl(cnnNet, config)); - else + if (!cpuSuccess) + EXPECT_EQ(exeNetwork->GetMetric(ov::execution_devices.name()).as(), CommonTestUtils::DEVICE_GPU); + else + EXPECT_EQ(exeNetwork->GetMetric(ov::execution_devices.name()).as(), "(CPU)"); + } else { ASSERT_THROW(exeNetwork = plugin->LoadExeNetworkImpl(cnnNet, config), InferenceEngine::Exception); + } auto sharedcount = mockExeNetwork._ptr.use_count(); auto requestsharedcount = inferReqInternal.use_count(); std::this_thread::sleep_for(std::chrono::milliseconds(500)); EXPECT_EQ(mockExeNetwork._ptr.use_count(), sharedcount - decreaseCount); EXPECT_EQ(inferReqInternal.use_count(), requestsharedcount - decreaseCount); + if (cpuSuccess || accSuccess) { + if (accSuccess) + EXPECT_EQ(exeNetwork->GetMetric(ov::execution_devices.name()).as(), CommonTestUtils::DEVICE_GPU); + else + EXPECT_EQ(exeNetwork->GetMetric(ov::execution_devices.name()).as(), CommonTestUtils::DEVICE_CPU); + } } //