From 00b53d6c33d59681cc459f216c149b3b917a89c7 Mon Sep 17 00:00:00 2001 From: Anton Zaytsev Date: Thu, 28 May 2020 13:55:37 +0300 Subject: [PATCH] [IE TESTS] Move Config behavior tests (#615) * [ci-skip][IE TESTS] move config test * [ci-skip][IE TESTS] fix config --- .../shared_tests_instances/behavior/config.cpp | 51 ++++ .../plugin_tests/behavior_test_plugin_config.cpp | 17 -- .../cpu/shared_tests_instances/behavior/config.cpp | 124 +++++++++ .../gna/shared_tests_instances/behavior/config.cpp | 64 +++++ .../gpu/shared_tests_instances/behavior/config.cpp | 90 ++++++ .../shared_tests_instances/behavior/config.cpp | 167 +++++++++++ .../tests/functional/plugin/shared/CMakeLists.txt | 1 + .../plugin/shared/include/behavior/config.hpp | 69 +++++ .../plugin/shared/src/behavior/config.cpp | 307 +++++++++++++++++++++ .../plugin_tests/behavior_test_plugin_config.cpp | 18 -- .../plugin_tests/behavior_test_plugin_config.cpp | 17 -- .../plugin_tests/behavior_test_plugin_config.cpp | 21 -- .../plugin_tests/behavior_test_plugin_config.hpp | 203 -------------- .../plugin_tests/behavior_test_plugin_config.cpp | 28 -- 14 files changed, 873 insertions(+), 304 deletions(-) create mode 100644 docs/template_plugin/tests/functional/shared_tests_instances/behavior/config.cpp delete mode 100644 docs/template_plugin/tests_deprecated/behavior/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp create mode 100644 inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/config.cpp create mode 100644 inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/config.cpp create mode 100644 inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/config.cpp create mode 100644 inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp create mode 100644 inference-engine/tests/functional/plugin/shared/include/behavior/config.hpp create mode 100644 inference-engine/tests/functional/plugin/shared/src/behavior/config.cpp delete mode 100644 inference-engine/tests_deprecated/behavior/cldnn/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp delete mode 100644 inference-engine/tests_deprecated/behavior/gna/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp delete mode 100644 inference-engine/tests_deprecated/behavior/mkldnn/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp delete mode 100644 inference-engine/tests_deprecated/behavior/shared_tests/plugin_tests/behavior_test_plugin_config.hpp delete mode 100644 inference-engine/tests_deprecated/behavior/vpu/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp diff --git a/docs/template_plugin/tests/functional/shared_tests_instances/behavior/config.cpp b/docs/template_plugin/tests/functional/shared_tests_instances/behavior/config.cpp new file mode 100644 index 0000000..2221bb2 --- /dev/null +++ b/docs/template_plugin/tests/functional/shared_tests_instances/behavior/config.cpp @@ -0,0 +1,51 @@ +// Copyright (C) 2018-2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "multi-device/multi_device_config.hpp" + +#include "behavior/config.hpp" + +using namespace LayerTestsDefinitions; + +namespace { + + const std::vector netPrecisions = { + InferenceEngine::Precision::FP32, + InferenceEngine::Precision::FP16 + }; + + const std::vector> configs = { + {} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values("TEMPLATE"), + ::testing::ValuesIn(configs)), + IncorrectConfigTests::getTestCaseName); + + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values("TEMPLATE"), + ::testing::ValuesIn(configs)), + IncorrectConfigAPITests::getTestCaseName); + + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values("TEMPLATE"), + ::testing::ValuesIn(configs)), + CorrectConfigAPITests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, CorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values("TEMPLATE"), + ::testing::ValuesIn(configs)), + CorrectConfigAPITests::getTestCaseName); +} // namespace \ No newline at end of file diff --git a/docs/template_plugin/tests_deprecated/behavior/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp b/docs/template_plugin/tests_deprecated/behavior/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp deleted file mode 100644 index 2df0b2b..0000000 --- a/docs/template_plugin/tests_deprecated/behavior/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2018-2019 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "behavior_test_plugin_config.hpp" -#include "template_test_data.hpp" - -INSTANTIATE_TEST_CASE_P(BehaviorTest, BehaviorPluginIncorrectConfigTest, ValuesIn(withIncorrectConfValues), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(BehaviorTest, BehaviorPluginIncorrectConfigTestInferRequestAPI, - ValuesIn(supportedValues), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(BehaviorTest, BehaviorPluginCorrectConfigTestInferRequestAPI, - ValuesIn(supportedValues), - getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/config.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/config.cpp new file mode 100644 index 0000000..a2eec29 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/config.cpp @@ -0,0 +1,124 @@ +// Copyright (C) 2018-2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "multi-device/multi_device_config.hpp" + +#include "behavior/config.hpp" + +using namespace LayerTestsDefinitions; + +namespace { + const std::vector netPrecisions = { + InferenceEngine::Precision::FP32, + InferenceEngine::Precision::FP16 + }; + + const std::vector> Configs = { + {}, + {{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}, + {{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_NUMA}}, + {{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "8"}}, + {{InferenceEngine::PluginConfigParams::KEY_CPU_BIND_THREAD, InferenceEngine::PluginConfigParams::NO}}, + {{InferenceEngine::PluginConfigParams::KEY_CPU_BIND_THREAD, InferenceEngine::PluginConfigParams::YES}}, + {{InferenceEngine::PluginConfigParams::KEY_DYN_BATCH_LIMIT, "10"}} + }; + + const std::vector> MultiConfigs = { + {}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, + InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, + InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_NUMA}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "8"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_CPU_BIND_THREAD, InferenceEngine::PluginConfigParams::NO}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_CPU_BIND_THREAD, InferenceEngine::PluginConfigParams::YES}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_DYN_BATCH_LIMIT, "10"}} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::ValuesIn(Configs)), + CorrectConfigTests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, CorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(MultiConfigs)), + CorrectConfigTests::getTestCaseName); + + const std::vector> inconfigs = { + {{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "OFF"}}, + {{InferenceEngine::PluginConfigParams::KEY_CPU_BIND_THREAD, "OFF"}}, + {{InferenceEngine::PluginConfigParams::KEY_DYN_BATCH_LIMIT, "NAN"}} + }; + + const std::vector> multiinconfigs = { + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "OFF"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_CPU_BIND_THREAD, "OFF"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_DYN_BATCH_LIMIT, "NAN"}} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::ValuesIn(inconfigs)), + IncorrectConfigTests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, IncorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(multiinconfigs)), + IncorrectConfigTests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::ValuesIn(inconfigs)), + IncorrectConfigAPITests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, IncorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(multiinconfigs)), + IncorrectConfigAPITests::getTestCaseName); + + + const std::vector> conf = { + {} + }; + + const std::vector> multiconf = { + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::ValuesIn(conf)), + CorrectConfigAPITests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, CorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(multiconf)), + CorrectConfigAPITests::getTestCaseName); +} // namespace \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/config.cpp b/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/config.cpp new file mode 100644 index 0000000..040c369 --- /dev/null +++ b/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/config.cpp @@ -0,0 +1,64 @@ +// Copyright (C) 2018-2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "multi-device/multi_device_config.hpp" +#include "gna/gna_config.hpp" +#include "behavior/config.hpp" + +using namespace LayerTestsDefinitions; + +namespace { + + const std::vector netPrecisions = { + InferenceEngine::Precision::FP32, + InferenceEngine::Precision::FP16 + }; + + + const std::vector> inconfigs = { + {{InferenceEngine::GNAConfigParams::KEY_GNA_DEVICE_MODE, InferenceEngine::GNAConfigParams::GNA_SW_FP32}, + {InferenceEngine::GNAConfigParams::KEY_GNA_LIB_N_THREADS, "2"}}, + {{InferenceEngine::GNAConfigParams::KEY_GNA_SCALE_FACTOR, "NAN"}}, + {{InferenceEngine::GNAConfigParams::KEY_GNA_PRECISION, "FP8"}}, + {{InferenceEngine::GNAConfigParams::KEY_GNA_DEVICE_MODE, "AUTO"}}, + {{InferenceEngine::GNAConfigParams::KEY_GNA_COMPACT_MODE, "ON"}} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_GNA), + ::testing::ValuesIn(inconfigs)), + IncorrectConfigTests::getTestCaseName); + + + const std::vector> Inconfigs = { + {{"KEY_KEY_GNA_DEVICE_MODE", InferenceEngine::GNAConfigParams::GNA_SW}}, + {{"GNA_DEVICE_MODE_XYZ", InferenceEngine::GNAConfigParams::GNA_SW}}, + {{"KEY_GNA_DEVICE_MODE_XYZ", InferenceEngine::GNAConfigParams::GNA_SW}}, + {{"KEY_GNA_SCALE_FACTOR_1", InferenceEngine::GNAConfigParams::GNA_SW}} + }; + + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_GNA), + ::testing::ValuesIn(Inconfigs)), + IncorrectConfigAPITests::getTestCaseName); + + + + const std::vector> conf = { + {} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_GNA), + ::testing::ValuesIn(conf)), + CorrectConfigAPITests::getTestCaseName); + +} // namespace \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/config.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/config.cpp new file mode 100644 index 0000000..bdf2812 --- /dev/null +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/config.cpp @@ -0,0 +1,90 @@ +// Copyright (C) 2018-2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "multi-device/multi_device_config.hpp" + +#include "behavior/config.hpp" + +using namespace LayerTestsDefinitions; + +namespace { + const std::vector netPrecisions = { + InferenceEngine::Precision::FP32, + InferenceEngine::Precision::FP16 + }; + + const std::vector> inconfigs = { + {{InferenceEngine::PluginConfigParams::KEY_GPU_THROUGHPUT_STREAMS, "OFF"}}, + {{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, "ON"}}, + {{InferenceEngine::PluginConfigParams::KEY_CONFIG_FILE, "unknown_file"}}, + {{InferenceEngine::PluginConfigParams::KEY_DUMP_KERNELS, "ON"}}, + {{InferenceEngine::PluginConfigParams::KEY_TUNING_MODE, "TUNING_UNKNOWN_MODE"}}, + {{InferenceEngine::PluginConfigParams::KEY_DEVICE_ID, "DEVICE_UNKNOWN"}} + }; + + const std::vector> multiinconfigs = { + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_GPU}, + {InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, "ON"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_GPU}, + {InferenceEngine::PluginConfigParams::KEY_CONFIG_FILE, "unknown_file"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_GPU}, + {InferenceEngine::PluginConfigParams::KEY_DUMP_KERNELS, "ON"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_GPU}, + {InferenceEngine::PluginConfigParams::KEY_TUNING_MODE, "TUNING_UNKNOWN_MODE"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_GPU}, + {InferenceEngine::PluginConfigParams::KEY_DEVICE_ID, "DEVICE_UNKNOWN"}} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_GPU), + ::testing::ValuesIn(inconfigs)), + IncorrectConfigTests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, IncorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(multiinconfigs)), + IncorrectConfigTests::getTestCaseName); + + + const std::vector> conf = { + {} + }; + + const std::vector> multiconf = { + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_GPU}} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_GPU), + ::testing::ValuesIn(conf)), + CorrectConfigAPITests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, CorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(multiconf)), + CorrectConfigAPITests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_GPU), + ::testing::ValuesIn(conf)), + IncorrectConfigAPITests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, IncorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(multiconf)), + IncorrectConfigAPITests::getTestCaseName); + +} // namespace \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp new file mode 100644 index 0000000..e740e3a --- /dev/null +++ b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp @@ -0,0 +1,167 @@ +// Copyright (C) 2018-2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "multi-device/multi_device_config.hpp" +#include "vpu/vpu_plugin_config.hpp" +#include "behavior/config.hpp" + +using namespace LayerTestsDefinitions; + +namespace { + + const std::vector netPrecisions = { + InferenceEngine::Precision::FP32, + InferenceEngine::Precision::FP16 + }; + + const std::vector> Configs = { + {{VPU_CONFIG_KEY(IGNORE_IR_STATISTIC), CONFIG_VALUE(YES)}}, + {{VPU_CONFIG_KEY(IGNORE_IR_STATISTIC), CONFIG_VALUE(NO)}}, + + {{VPU_MYRIAD_CONFIG_KEY(FORCE_RESET), CONFIG_VALUE(YES)}}, + {{VPU_MYRIAD_CONFIG_KEY(FORCE_RESET), CONFIG_VALUE(NO)}}, + + {{CONFIG_KEY(LOG_LEVEL), CONFIG_VALUE(LOG_NONE)}}, + {{CONFIG_KEY(LOG_LEVEL), CONFIG_VALUE(LOG_ERROR)}}, + {{CONFIG_KEY(LOG_LEVEL), CONFIG_VALUE(LOG_WARNING)}}, + {{CONFIG_KEY(LOG_LEVEL), CONFIG_VALUE(LOG_INFO)}}, + {{CONFIG_KEY(LOG_LEVEL), CONFIG_VALUE(LOG_DEBUG)}}, + {{CONFIG_KEY(LOG_LEVEL), CONFIG_VALUE(LOG_TRACE)}}, + + {{VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), CONFIG_VALUE(YES)}}, + {{VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), CONFIG_VALUE(NO)}}, + + {{VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME), CONFIG_VALUE(YES)}}, + {{VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME), CONFIG_VALUE(NO)}}, + {{VPU_MYRIAD_CONFIG_KEY(PROTOCOL), VPU_MYRIAD_CONFIG_VALUE(USB)}}, + {{VPU_MYRIAD_CONFIG_KEY(PROTOCOL), VPU_MYRIAD_CONFIG_VALUE(PCIE)}}, + + {{VPU_MYRIAD_CONFIG_KEY(PLATFORM), VPU_MYRIAD_CONFIG_VALUE(2450)}}, + {{VPU_MYRIAD_CONFIG_KEY(PLATFORM), VPU_MYRIAD_CONFIG_VALUE(2480)}} + }; + + const std::vector> MultiConfigs = { + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {CONFIG_KEY(LOG_LEVEL), CONFIG_VALUE(LOG_DEBUG)}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), CONFIG_VALUE(YES)}} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MYRIAD), + ::testing::ValuesIn(Configs)), + CorrectConfigTests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, CorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(MultiConfigs)), + CorrectConfigTests::getTestCaseName); + + const std::vector> inconfigs = { + {{VPU_MYRIAD_CONFIG_KEY(PROTOCOL), "BLUETOOTH"}}, + {{VPU_MYRIAD_CONFIG_KEY(PROTOCOL), "LAN"}}, + + {{VPU_CONFIG_KEY(IGNORE_IR_STATISTIC), "ON"}}, + {{VPU_CONFIG_KEY(IGNORE_IR_STATISTIC), "OFF"}}, + + {{VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), "ON"}}, + {{VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), "OFF"}}, + + {{VPU_MYRIAD_CONFIG_KEY(FORCE_RESET), "ON"}}, + {{VPU_MYRIAD_CONFIG_KEY(FORCE_RESET), "OFF"}}, + + {{CONFIG_KEY(LOG_LEVEL), "VERBOSE"}}, + + {{VPU_MYRIAD_CONFIG_KEY(PLATFORM), "-1"}}, + {{VPU_MYRIAD_CONFIG_KEY(PLATFORM), "0"}}, + {{VPU_MYRIAD_CONFIG_KEY(PLATFORM), "1"}}, + + {{VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME), "ON"}}, + {{VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME), "OFF"}} + }; + + const std::vector> multiinconfigs = { + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), "ON"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {CONFIG_KEY(LOG_LEVEL), "VERBOSE"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {VPU_CONFIG_KEY(IGNORE_IR_STATISTIC), "ON"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {VPU_MYRIAD_CONFIG_KEY(PLATFORM), "-1"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {VPU_MYRIAD_CONFIG_KEY(PLATFORM), "0"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {VPU_MYRIAD_CONFIG_KEY(PLATFORM), "1"}} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MYRIAD), + ::testing::ValuesIn(inconfigs)), + IncorrectConfigTests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, IncorrectConfigTests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(multiinconfigs)), + IncorrectConfigTests::getTestCaseName); + + + + const std::vector> Inconf = { + {{"some_nonexistent_key", "some_unknown_value"}} + }; + + const std::vector> multiInconf = { + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_MYRIAD}, + {"some_nonexistent_key", "some_unknown_value"}} + }; + + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MYRIAD), + ::testing::ValuesIn(Inconf)), + IncorrectConfigAPITests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, IncorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(multiInconf)), + IncorrectConfigAPITests::getTestCaseName); + + + + + const std::vector> conf = { + {} + }; + + const std::vector> multiconf = { + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_MYRIAD}} + }; + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MYRIAD), + ::testing::ValuesIn(conf)), + CorrectConfigAPITests::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, CorrectConfigAPITests, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(multiconf)), + CorrectConfigAPITests::getTestCaseName); +} // namespace \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/shared/CMakeLists.txt b/inference-engine/tests/functional/plugin/shared/CMakeLists.txt index 070735a..c3b3608 100644 --- a/inference-engine/tests/functional/plugin/shared/CMakeLists.txt +++ b/inference-engine/tests/functional/plugin/shared/CMakeLists.txt @@ -29,6 +29,7 @@ addIeTarget( target_include_directories(${TARGET_NAME} PUBLIC ${PUBLIC_HEADERS_DIR} + ${IE_MAIN_SOURCE_DIR}/src/vpu/graph_transformer/include ) target_link_libraries(${TARGET_NAME} diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/config.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/config.hpp new file mode 100644 index 0000000..f0c9800 --- /dev/null +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/config.hpp @@ -0,0 +1,69 @@ +// Copyright (C) 2018-2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include +#include +#include "ie_extension.h" +#include +#include "functional_test_utils/layer_test_utils.hpp" +#include "ngraph_functions/utils/ngraph_helpers.hpp" +#include "ngraph_functions/builders.hpp" +#include +#include +#include +#include +#include + +namespace LayerTestsDefinitions { +typedef std::tuple< + InferenceEngine::Precision, // Network precision + std::string, // Device name + std::map // Config +> ConfigParams; + +class CorrectConfigTests : public testing::WithParamInterface, + public LayerTestsUtils::LayerTestsCommon { +public: + static std::string getTestCaseName(testing::TestParamInfo obj); + +protected: + void SetUp() override; + void TearDown() override; +}; + +class IncorrectConfigTests : public testing::WithParamInterface, + public LayerTestsUtils::LayerTestsCommon { +public: + static std::string getTestCaseName(testing::TestParamInfo obj); + +protected: + void SetUp() override; + void TearDown() override; +}; + +class CorrectConfigAPITests : public testing::WithParamInterface, + public LayerTestsUtils::LayerTestsCommon { +public: + static std::string getTestCaseName(testing::TestParamInfo obj); + +protected: + void SetUp() override; + void TearDown() override; +}; + +class IncorrectConfigAPITests : public testing::WithParamInterface, + public LayerTestsUtils::LayerTestsCommon { +public: + static std::string getTestCaseName(testing::TestParamInfo obj); + +protected: + void SetUp() override; + void TearDown() override; +}; + +} // namespace LayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/shared/src/behavior/config.cpp b/inference-engine/tests/functional/plugin/shared/src/behavior/config.cpp new file mode 100644 index 0000000..51c86cc --- /dev/null +++ b/inference-engine/tests/functional/plugin/shared/src/behavior/config.cpp @@ -0,0 +1,307 @@ +// Copyright (C) 2018-2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include +#include +#include +#include + +#include +#include "ie_common.h" +#include "common_test_utils/common_utils.hpp" +#include "functional_test_utils/plugin_cache.hpp" +#include "functional_test_utils/layer_test_utils.hpp" +#include "functional_test_utils/blob_utils.hpp" +#include +#include "ngraph_functions/pass/convert_prc.hpp" +#include "ngraph_functions/subgraph_builders.hpp" +#include "behavior/config.hpp" + + +namespace LayerTestsDefinitions { +std::string CorrectConfigTests::getTestCaseName(testing::TestParamInfo obj) { + InferenceEngine::Precision netPrecision; + std::string targetDevice; + std::map configuration; + std::tie(netPrecision, targetDevice, configuration) = obj.param; + std::ostringstream result; + result << "netPRC=" << netPrecision.name() << "_"; + result << "targetDevice=" << targetDevice; + if (!configuration.empty()) { + result << "configItem=" << configuration.begin()->first << "_" << configuration.begin()->second; + } + return result.str(); +} + +void CorrectConfigTests::SetUp() { + InferenceEngine::Precision netPrecision; + std::tie(netPrecision, targetDevice, configuration) = this->GetParam(); + function = ngraph::builder::subgraph::makeConvPoolRelu(); +} + +void CorrectConfigTests::TearDown() { + if (targetDevice.find(CommonTestUtils::DEVICE_GPU) != std::string::npos) { + PluginCache::get().reset(); + } +} + +// Setting empty config doesn't throw +TEST_P(CorrectConfigTests, SetEmptyConfig) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + // Create CNNNetwork from ngrpah::Function + InferenceEngine::CNNNetwork cnnNet(function); + // Get Core from cache + auto ie = PluginCache::get().ie(); + std::map config; + ASSERT_NO_THROW(ie->GetMetric(targetDevice, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); + ASSERT_NO_THROW(ie->SetConfig(config, targetDevice)); + function.reset(); +} + +// Setting correct config doesn't throw +TEST_P(CorrectConfigTests, SetCorrectConfig) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + // Create CNNNetwork from ngrpah::Function + InferenceEngine::CNNNetwork cnnNet(function); + // Get Core from cache + auto ie = PluginCache::get().ie(); + ASSERT_NO_THROW(ie->GetMetric(targetDevice, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); + ASSERT_NO_THROW(ie->SetConfig(configuration, targetDevice)); + function.reset(); +} + + std::string IncorrectConfigTests::getTestCaseName(testing::TestParamInfo obj) { + InferenceEngine::Precision netPrecision; + std::string targetDevice; + std::map configuration; + std::tie(netPrecision, targetDevice, configuration) = obj.param; + std::ostringstream result; + result << "netPRC=" << netPrecision.name() << "_"; + result << "targetDevice=" << targetDevice; + if (!configuration.empty()) { + for (auto& configItem : configuration) { + result << "configItem=" << configItem.first << "_" << configItem.second << "_"; + } + } + return result.str(); + } + + void IncorrectConfigTests::SetUp() { + InferenceEngine::Precision netPrecision; + std::tie(netPrecision, targetDevice, configuration) = this->GetParam(); + function = ngraph::builder::subgraph::makeConvPoolRelu(); + } + + void IncorrectConfigTests::TearDown() { + if (targetDevice.find(CommonTestUtils::DEVICE_GPU) != std::string::npos) { + PluginCache::get().reset(); + } + } + +TEST_P(IncorrectConfigTests, SetConfigWithIncorrectKey) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + // Create CNNNetwork from ngrpah::Function + InferenceEngine::CNNNetwork cnnNet(function); + // Get Core from cache + auto ie = PluginCache::get().ie(); + if (targetDevice.find(CommonTestUtils::DEVICE_MULTI) == std::string::npos && + targetDevice.find(CommonTestUtils::DEVICE_HETERO) == std::string::npos) { + ASSERT_NO_THROW(ie->GetMetric(targetDevice, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); + ASSERT_THROW(ie->SetConfig(configuration, targetDevice), + InferenceEngine::details::InferenceEngineException); + } else { + ASSERT_NO_THROW(ie->GetMetric(targetDevice, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); + ASSERT_NO_THROW(ie->SetConfig(configuration, targetDevice)); + } + function.reset(); +} + +TEST_P(IncorrectConfigTests, canNotLoadNetworkWithIncorrectConfig) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + // Create CNNNetwork from ngrpah::Function + InferenceEngine::CNNNetwork cnnNet(function); + // Get Core from cache + auto ie = PluginCache::get().ie(); + ASSERT_THROW(auto execNet = ie->LoadNetwork(cnnNet, targetDevice, configuration), + InferenceEngine::details::InferenceEngineException); + function.reset(); + } + + std::string IncorrectConfigAPITests::getTestCaseName(testing::TestParamInfo obj) { + InferenceEngine::Precision netPrecision; + std::string targetDevice; + std::map configuration; + std::tie(netPrecision, targetDevice, configuration) = obj.param; + std::ostringstream result; + result << "netPRC=" << netPrecision.name() << "_"; + result << "targetDevice=" << targetDevice; + if (!configuration.empty()) { + result << "configItem=" << configuration.begin()->first << "_" << configuration.begin()->second; + } + return result.str(); + } + + void IncorrectConfigAPITests::SetUp() { + InferenceEngine::Precision netPrecision; + std::tie(netPrecision, targetDevice, configuration) = this->GetParam(); + function = ngraph::builder::subgraph::makeConvPoolRelu(); + } + + void IncorrectConfigAPITests::TearDown() { + if (targetDevice.find(CommonTestUtils::DEVICE_GPU) != std::string::npos) { + PluginCache::get().reset(); + } + } + +TEST_P(IncorrectConfigAPITests, SetConfigWithNoExistingKey) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + // Create CNNNetwork from ngrpah::Function + InferenceEngine::CNNNetwork cnnNet(function); + // Get Core from cache + auto ie = PluginCache::get().ie(); + ASSERT_NO_THROW(ie->GetMetric(targetDevice, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); + if (targetDevice.find(CommonTestUtils::DEVICE_GNA) != std::string::npos) { + ASSERT_THROW(ie->SetConfig(configuration, targetDevice), InferenceEngine::NotFound); + } else { + try { + ie->SetConfig(configuration, targetDevice); + } catch (InferenceEngine::details::InferenceEngineException ex) {} + } + function.reset(); + } + + + std::string CorrectConfigAPITests::getTestCaseName(testing::TestParamInfo obj) { + InferenceEngine::Precision netPrecision; + std::string targetDevice; + std::map configuration; + std::tie(netPrecision, targetDevice, configuration) = obj.param; + std::ostringstream result; + result << "netPRC=" << netPrecision.name() << "_"; + result << "targetDevice=" << targetDevice; + if (!configuration.empty()) { + result << "configItem=" << configuration.begin()->first << "_" << configuration.begin()->second; + } + return result.str(); + } + + void CorrectConfigAPITests::SetUp() { + InferenceEngine::Precision netPrecision; + std::tie(netPrecision, targetDevice, configuration) = this->GetParam(); + function = ngraph::builder::subgraph::makeConvPoolRelu(); + } + + void CorrectConfigAPITests::TearDown() { + if (targetDevice.find(CommonTestUtils::DEVICE_GPU) != std::string::npos) { + PluginCache::get().reset(); + } + } + +TEST_P(CorrectConfigAPITests, canSetExclusiveAsyncRequests) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + // Create CNNNetwork from ngrpah::Function + InferenceEngine::CNNNetwork cnnNet(function); + // Get Core from cache + auto ie = PluginCache::get().ie(); + // Load config + std::map config = {{CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS), CONFIG_VALUE(YES)}}; + config.insert(configuration.begin(), configuration.end()); + if (targetDevice.find(CommonTestUtils::DEVICE_MULTI) == std::string::npos && + targetDevice.find(CommonTestUtils::DEVICE_HETERO) == std::string::npos) { + ASSERT_NO_THROW(ie->SetConfig(configuration, targetDevice)); + } + // Load CNNNetwork to target plugins + auto execNet = ie->LoadNetwork(cnnNet, targetDevice, configuration); + execNet.CreateInferRequest(); + + if ((targetDevice == CommonTestUtils::DEVICE_HDDL) || (targetDevice == CommonTestUtils::DEVICE_GNA) || + (targetDevice == CommonTestUtils::DEVICE_CPU) || (targetDevice == CommonTestUtils::DEVICE_GPU)) { + ASSERT_EQ(0u, InferenceEngine::ExecutorManager::getInstance()->getExecutorsNumber()); + } else if ((targetDevice == CommonTestUtils::DEVICE_FPGA) || + (targetDevice == CommonTestUtils::DEVICE_KEEMBAY)) { + ASSERT_EQ(2u, InferenceEngine::ExecutorManager::getInstance()->getExecutorsNumber()); + } else if (targetDevice == CommonTestUtils::DEVICE_MULTI) { + } else { + ASSERT_EQ(1u, InferenceEngine::ExecutorManager::getInstance()->getExecutorsNumber()); + } + + function.reset(); +} + +TEST_P(CorrectConfigAPITests, withoutExclusiveAsyncRequests) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + // Create CNNNetwork from ngrpah::Function + InferenceEngine::CNNNetwork cnnNet(function); + // Get Core from cache + auto ie = PluginCache::get().ie(); + // Load config + std::map config = {{CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS), CONFIG_VALUE(NO)}}; + config.insert(configuration.begin(), configuration.end()); + if (targetDevice.find(CommonTestUtils::DEVICE_MULTI) == std::string::npos && + targetDevice.find(CommonTestUtils::DEVICE_HETERO) == std::string::npos) { + ASSERT_NO_THROW(ie->SetConfig(configuration, targetDevice)); + } + // Load CNNNetwork to target plugins + auto execNet = ie->LoadNetwork(cnnNet, targetDevice, configuration); + execNet.CreateInferRequest(); + + if ((targetDevice == CommonTestUtils::DEVICE_FPGA) || (targetDevice == CommonTestUtils::DEVICE_MYRIAD) || + (targetDevice == CommonTestUtils::DEVICE_KEEMBAY)) { + ASSERT_EQ(1u, InferenceEngine::ExecutorManager::getInstance()->getExecutorsNumber()); + } else if (targetDevice == CommonTestUtils::DEVICE_MULTI) { + } else { + ASSERT_EQ(0u, InferenceEngine::ExecutorManager::getInstance()->getExecutorsNumber()); + } + function.reset(); +} + +TEST_P(CorrectConfigAPITests, reusableCPUStreamsExecutor) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + + ASSERT_EQ(0u, InferenceEngine::ExecutorManager::getInstance()->getExecutorsNumber()); + ASSERT_EQ(0u, InferenceEngine::ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); + + // Create CNNNetwork from ngrpah::Function + InferenceEngine::CNNNetwork cnnNet(function); + // Get Core from cache + auto ie = PluginCache::get().ie(); + { + // Load config + std::map config = {{CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS), CONFIG_VALUE(NO)}}; + config.insert(configuration.begin(), configuration.end()); + if (targetDevice.find(CommonTestUtils::DEVICE_MULTI) == std::string::npos && + targetDevice.find(CommonTestUtils::DEVICE_HETERO) == std::string::npos) { + ASSERT_NO_THROW(ie->SetConfig(configuration, targetDevice)); + } + // Load CNNNetwork to target plugins + auto execNet = ie->LoadNetwork(cnnNet, targetDevice, configuration); + execNet.CreateInferRequest(); + + if ((targetDevice == CommonTestUtils::DEVICE_FPGA) || (targetDevice == CommonTestUtils::DEVICE_MYRIAD) || + (targetDevice == CommonTestUtils::DEVICE_KEEMBAY)) { + ASSERT_EQ(1u, InferenceEngine::ExecutorManager::getInstance()->getExecutorsNumber()); + ASSERT_EQ(0u, InferenceEngine::ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); + } else if (targetDevice == CommonTestUtils::DEVICE_MULTI) { + } else { + ASSERT_EQ(0u, InferenceEngine::ExecutorManager::getInstance()->getExecutorsNumber()); + ASSERT_GE(2u, InferenceEngine::ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); + } + } + if (targetDevice == CommonTestUtils::DEVICE_CPU) { + ASSERT_NE(0u, InferenceEngine::ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); + ASSERT_NO_THROW(ie->UnregisterPlugin("CPU")); + ASSERT_EQ(0u, InferenceEngine::ExecutorManager::getInstance()->getExecutorsNumber()); + ASSERT_EQ(0u, InferenceEngine::ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); + } + function.reset(); +} +} // namespace LayerTestsDefinitions \ No newline at end of file diff --git a/inference-engine/tests_deprecated/behavior/cldnn/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp b/inference-engine/tests_deprecated/behavior/cldnn/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp deleted file mode 100644 index 718d099..0000000 --- a/inference-engine/tests_deprecated/behavior/cldnn/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2018-2020 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "behavior_test_plugin_config.hpp" -#include "cldnn_test_data.hpp" - - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginIncorrectConfigTest, ValuesIn(withIncorrectConfValues), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginIncorrectConfigTestInferRequestAPI, - ValuesIn(supportedValues), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginCorrectConfigTestInferRequestAPI, - ValuesIn(supportedValues), - getTestCaseName); diff --git a/inference-engine/tests_deprecated/behavior/gna/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp b/inference-engine/tests_deprecated/behavior/gna/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp deleted file mode 100644 index bff01fb..0000000 --- a/inference-engine/tests_deprecated/behavior/gna/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2018-2020 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "behavior_test_plugin_config.hpp" -#include "gna_test_data.hpp" - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginIncorrectConfigTest, ValuesIn(withIncorrectConfValues), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginIncorrectConfigTestInferRequestAPI, - ValuesIn(withIncorrectConfKeys), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginCorrectConfigTestInferRequestAPI, - ValuesIn(supportedValues), - getTestCaseName); diff --git a/inference-engine/tests_deprecated/behavior/mkldnn/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp b/inference-engine/tests_deprecated/behavior/mkldnn/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp deleted file mode 100644 index bdabdb8..0000000 --- a/inference-engine/tests_deprecated/behavior/mkldnn/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2018-2020 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "behavior_test_plugin_config.hpp" -#include "mkldnn_test_data.hpp" - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginCorrectConfigTest, - ValuesIn(BehTestParams::concat(withCorrectConfValues, withCorrectConfValuesPluginOnly)), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginIncorrectConfigTest, ValuesIn(withIncorrectConfValues), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginIncorrectConfigTestInferRequestAPI, - ValuesIn(withIncorrectConfKeys), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginCorrectConfigTestInferRequestAPI, - ValuesIn(supportedValues), - getTestCaseName); diff --git a/inference-engine/tests_deprecated/behavior/shared_tests/plugin_tests/behavior_test_plugin_config.hpp b/inference-engine/tests_deprecated/behavior/shared_tests/plugin_tests/behavior_test_plugin_config.hpp deleted file mode 100644 index c6f07cb..0000000 --- a/inference-engine/tests_deprecated/behavior/shared_tests/plugin_tests/behavior_test_plugin_config.hpp +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (C) 2018-2020 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "behavior_test_plugin.h" -#include -#include - -using namespace std; -using namespace ::testing; -using namespace InferenceEngine; -using namespace InferenceEngine::details; - -namespace { - std::ostream &operator<<(std::ostream &os, const BehTestParams &p) { - return os << "#"; - } - - std::string getTestCaseName(testing::TestParamInfo obj) { - std::string config_str = ""; - for (auto it = obj.param.config.cbegin(); it != obj.param.config.cend(); it++) { - std::string v = it->second; - std::replace(v.begin(), v.end(), '.', '_'); - config_str += it->first + "_" + v + "_"; - } - return obj.param.device + "_" + config_str; - } -} - -// Setting empty config doesn't throw -TEST_P(BehaviorPluginCorrectConfigTest, SetEmptyConfig) { - InferenceEngine::Core core; - std::map config; - const std::string device = GetParam().device; - ASSERT_NO_THROW(core.GetMetric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); - ASSERT_NO_THROW(core.SetConfig(config, GetParam().device)); -} - -// Setting correct config doesn't throw -TEST_P(BehaviorPluginCorrectConfigTest, SetCorrectConfig) { - InferenceEngine::Core core; - std::map config = GetParam().config; - const std::string device = GetParam().device; - ASSERT_NO_THROW(core.GetMetric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); - ASSERT_NO_THROW(core.SetConfig(config, GetParam().device)); -} - -TEST_P(BehaviorPluginIncorrectConfigTest, SetConfigWithIncorrectKey) { - InferenceEngine::Core core; - std::map config = GetParam().config; - const std::string device = GetParam().device; - if (device.find(CommonTestUtils::DEVICE_MULTI) == std::string::npos && - device.find(CommonTestUtils::DEVICE_HETERO) == std::string::npos) { - ASSERT_NO_THROW(core.GetMetric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); - ASSERT_THROW(core.SetConfig(config, GetParam().device), InferenceEngineException); - } else { - ASSERT_NO_THROW(core.GetMetric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); - ASSERT_NO_THROW(core.SetConfig(config, GetParam().device)); - } -} - -TEST_P(BehaviorPluginIncorrectConfigTest, canNotLoadNetworkWithIncorrectConfig) { - auto param = GetParam(); - std::map config = param.config; - InferenceEngine::Core core; - IExecutableNetwork::Ptr exeNetwork; - CNNNetwork cnnNetwork = core.ReadNetwork(GetParam().model_xml_str, GetParam().weights_blob); - - ASSERT_THROW(exeNetwork = core.LoadNetwork(cnnNetwork, param.device, config), InferenceEngineException); -} - -TEST_P(BehaviorPluginIncorrectConfigTestInferRequestAPI, SetConfigWithNoExistingKey) { - std::string refError = NOT_FOUND_str; - InferenceEngine::Core core; - std::map config = GetParam().config; - const std::string device = GetParam().device; - ASSERT_NO_THROW(core.GetMetric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); - if (device.find(CommonTestUtils::DEVICE_GNA) != std::string::npos) { - ASSERT_THROW(core.SetConfig(config, GetParam().device), NotFound); - } else { - try { - core.SetConfig(config, GetParam().device); - } catch (InferenceEngineException ex) { - ASSERT_STR_CONTAINS(ex.what(), refError); - } - } -} - -TEST_P(BehaviorPluginCorrectConfigTestInferRequestAPI, canSetExclusiveAsyncRequests) { - ASSERT_EQ(0u, ExecutorManager::getInstance()->getExecutorsNumber()); - auto param = GetParam(); - InferenceEngine::Core core; - std::map config = {{KEY_EXCLUSIVE_ASYNC_REQUESTS, YES}}; - config.insert(param.config.begin(), param.config.end()); - - const std::string device = GetParam().device; - if (device.find(CommonTestUtils::DEVICE_MULTI) == std::string::npos && - device.find(CommonTestUtils::DEVICE_HETERO) == std::string::npos) { - ASSERT_NO_THROW(core.SetConfig(config, GetParam().device)); - } - - CNNNetwork cnnNetwork = core.ReadNetwork(GetParam().model_xml_str, GetParam().weights_blob); - - ExecutableNetwork exeNetwork = core.LoadNetwork(cnnNetwork, GetParam().device, config); - exeNetwork.CreateInferRequest(); - - // TODO: there is no executors to sync. should it be supported natively in HDDL API? - if (GetParam().device == CommonTestUtils::DEVICE_HDDL) { - ASSERT_EQ(0u, ExecutorManager::getInstance()->getExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_FPGA) { - ASSERT_EQ(2u, ExecutorManager::getInstance()->getExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_MYRIAD) { - ASSERT_EQ(2u, ExecutorManager::getInstance()->getExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_KEEMBAY) { - ASSERT_EQ(2u, ExecutorManager::getInstance()->getExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_GNA) { - ASSERT_EQ(0u, ExecutorManager::getInstance()->getExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_MULTI) { - // for multi-device the number of Executors is not known (defined by the devices configuration) - } else { - ASSERT_EQ(1u, ExecutorManager::getInstance()->getExecutorsNumber()); - } -} - -TEST_P(BehaviorPluginCorrectConfigTestInferRequestAPI, withoutExclusiveAsyncRequests) { - ASSERT_EQ(0u, ExecutorManager::getInstance()->getExecutorsNumber()); - - auto param = GetParam(); - InferenceEngine::Core core; - - std::map config = {{KEY_EXCLUSIVE_ASYNC_REQUESTS, NO}}; - config.insert(param.config.begin(), param.config.end()); - - const std::string device = GetParam().device; - if (device.find(CommonTestUtils::DEVICE_MULTI) == std::string::npos && - device.find(CommonTestUtils::DEVICE_HETERO) == std::string::npos) { - ASSERT_NO_THROW(core.SetConfig(config, param.device)); - } - - CNNNetwork cnnNetwork = core.ReadNetwork(param.model_xml_str, param.weights_blob); - - ExecutableNetwork exeNetwork = core.LoadNetwork(cnnNetwork, param.device, config); - exeNetwork.CreateInferRequest(); - - - if (GetParam().device == CommonTestUtils::DEVICE_FPGA) { - ASSERT_EQ(1u, ExecutorManager::getInstance()->getExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_MYRIAD) { - ASSERT_EQ(1u, ExecutorManager::getInstance()->getExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_KEEMBAY) { - ASSERT_EQ(1u, ExecutorManager::getInstance()->getExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_MULTI) { - // for multi-device the number of Executors is not known (defined by the devices configuration) - } else { - ASSERT_EQ(0u, ExecutorManager::getInstance()->getExecutorsNumber()); - } -} - -TEST_P(BehaviorPluginCorrectConfigTestInferRequestAPI, reusableCPUStreamsExecutor) { - ASSERT_EQ(0u, ExecutorManager::getInstance()->getExecutorsNumber()); - ASSERT_EQ(0u, ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); - - auto param = GetParam(); - InferenceEngine::Core core; - { - std::map config = {{KEY_EXCLUSIVE_ASYNC_REQUESTS, NO}}; - config.insert(param.config.begin(), param.config.end()); - - const std::string device = GetParam().device; - if (device.find(CommonTestUtils::DEVICE_MULTI) == std::string::npos && - device.find(CommonTestUtils::DEVICE_HETERO) == std::string::npos) { - ASSERT_NO_THROW(core.SetConfig(config, param.device)); - } - - CNNNetwork cnnNetwork = core.ReadNetwork(param.model_xml_str, param.weights_blob); - - ExecutableNetwork exeNetwork = core.LoadNetwork(cnnNetwork, param.device, config); - exeNetwork.CreateInferRequest(); - - - if (GetParam().device == CommonTestUtils::DEVICE_FPGA) { - ASSERT_EQ(1u, ExecutorManager::getInstance()->getExecutorsNumber()); - ASSERT_EQ(0u, ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_MYRIAD) { - ASSERT_EQ(1u, ExecutorManager::getInstance()->getExecutorsNumber()); - ASSERT_EQ(0u, ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_KEEMBAY) { - ASSERT_EQ(1u, ExecutorManager::getInstance()->getExecutorsNumber()); - ASSERT_EQ(0u, ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); - } else if (GetParam().device == CommonTestUtils::DEVICE_MULTI) { - // for multi-device the number of Executors is not known (defined by the devices configuration) - } else { - ASSERT_EQ(0u, ExecutorManager::getInstance()->getExecutorsNumber()); - ASSERT_GE(2u, ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); - } - } - if (GetParam().device == CommonTestUtils::DEVICE_CPU) { - ASSERT_NE(0u, ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); - ASSERT_NO_THROW(core.UnregisterPlugin("CPU")); - ASSERT_EQ(0u, ExecutorManager::getInstance()->getExecutorsNumber()); - ASSERT_EQ(0u, ExecutorManager::getInstance()->getIdleCPUStreamsExecutorsNumber()); - } -} diff --git a/inference-engine/tests_deprecated/behavior/vpu/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp b/inference-engine/tests_deprecated/behavior/vpu/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp deleted file mode 100644 index f704546..0000000 --- a/inference-engine/tests_deprecated/behavior/vpu/shared_tests_instances/plugin_tests/behavior_test_plugin_config.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2018-2020 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "behavior_test_plugin_config.hpp" -#include "vpu_test_data.hpp" - -INSTANTIATE_TEST_CASE_P( - smoke_BehaviorTest, BehaviorPluginCorrectConfigTest, - ValuesIn( - BehTestParams::concat( - BehTestParams::concat(deviceSpecificConfigurations, deviceAgnosticConfigurations), - withCorrectConfValuesPluginOnly - ) - ), - getTestCaseName -); - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginIncorrectConfigTest, ValuesIn(withIncorrectConfValues), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginIncorrectConfigTestInferRequestAPI, - ValuesIn(withIncorrectConfKeys), - getTestCaseName); - -INSTANTIATE_TEST_CASE_P(smoke_BehaviorTest, BehaviorPluginCorrectConfigTestInferRequestAPI, - ValuesIn(supportedValues), - getTestCaseName); -- 2.7.4