diff --git a/samples/cpp/benchmark_app/main.cpp b/samples/cpp/benchmark_app/main.cpp index 7e32df4320f..55c10c8f867 100644 --- a/samples/cpp/benchmark_app/main.cpp +++ b/samples/cpp/benchmark_app/main.cpp @@ -193,6 +193,21 @@ int main(int argc, char* argv[]) { slog::info << "GPU extensions is loaded " << ext << slog::endl; } + if (FLAGS_hint.empty()) { + for (auto& device : devices) { + std::vector supported_config_keys = + core.get_metric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS)); + if (std::find(supported_config_keys.begin(), + supported_config_keys.end(), + CONFIG_KEY(PERFORMANCE_HINT)) != supported_config_keys.end()) { + slog::warn << "-hint default value is determined as" << CONFIG_VALUE(THROUGHPUT) + << " automatically for " << device + << " device. For more detailed information look at README." << slog::endl; + FLAGS_hint = CONFIG_VALUE(THROUGHPUT); + } + } + } + slog::info << "OpenVINO: " << ov::get_openvino_version() << slog::endl; slog::info << "Device info: " << slog::endl; slog::info << core.get_versions(device_name) << slog::endl; @@ -562,19 +577,16 @@ int main(int argc, char* argv[]) { // ----------------- 8. Querying optimal runtime parameters // ----------------------------------------------------- next_step(); - // output of the actual settings that the device selected based on the hint - if (!ov_perf_hint.empty()) { - for (const auto& device : devices) { - std::vector supported_config_keys = - core.get_metric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS)); - slog::info << "Device: " << device << slog::endl; - for (const auto& cfg : supported_config_keys) { - try { - slog::info << " {" << cfg << " , " << compiledModel.get_config(cfg).as(); - } catch (...) { - }; + // output of the actual settings that the device selected + for (const auto& device : devices) { + std::vector supported_config_keys = core.get_metric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS)); + slog::info << "Device: " << device << slog::endl; + for (const auto& cfg : supported_config_keys) { + try { + slog::info << " {" << cfg << " , " << compiledModel.get_config(cfg).as(); slog::info << " }" << slog::endl; - } + } catch (...) { + }; } } diff --git a/src/inference/include/ie/ie_core.hpp b/src/inference/include/ie/ie_core.hpp index d41e85b8e2d..87de21937d7 100644 --- a/src/inference/include/ie/ie_core.hpp +++ b/src/inference/include/ie/ie_core.hpp @@ -79,6 +79,7 @@ public: * @return CNNNetwork */ CNNNetwork ReadNetwork(const std::string& modelPath, const std::string& binPath = {}) const; + /** * @brief Reads models from IR and ONNX formats * @param model string with model in IR or ONNX format diff --git a/tools/benchmark_tool/openvino/tools/benchmark/main.py b/tools/benchmark_tool/openvino/tools/benchmark/main.py index 88100871012..7b33621a029 100644 --- a/tools/benchmark_tool/openvino/tools/benchmark/main.py +++ b/tools/benchmark_tool/openvino/tools/benchmark/main.py @@ -80,6 +80,14 @@ def run(args): cldnn_config = config[GPU_DEVICE_NAME]['CONFIG_FILE'] benchmark.add_extension(path_to_cldnn_config=cldnn_config) + if not args.perf_hint: + for device in devices: + supported_config_keys = benchmark.core.get_metric(device, 'SUPPORTED_CONFIG_KEYS') + if 'PERFORMANCE_HINT' in supported_config_keys: + logger.warning(f"-hint default value is determined as 'THROUGHPUT' automatically for {device} device" + + "For more detailed information look at README.") + args.perf_hint = "throughput" + version = benchmark.get_version_info() logger.info(version) @@ -128,7 +136,7 @@ def run(args): perf_counts = True if config[device]['PERF_COUNT'] == 'YES' else perf_counts ## high-level performance hints - if is_flag_set_in_command_line('hint'): + if is_flag_set_in_command_line('hint') or args.perf_hint: config[device]['PERFORMANCE_HINT'] = args.perf_hint.upper() if is_flag_set_in_command_line('nireq'): config[device]['PERFORMANCE_HINT_NUM_REQUESTS'] = str(args.number_infer_requests) @@ -308,13 +316,16 @@ def run(args): # --------------------- 8. Querying optimal runtime parameters -------------------------------------------------- next_step() - if is_flag_set_in_command_line('hint'): - ## actual device-deduced settings for the hint - for device in devices: - keys = benchmark.core.get_metric(device, 'SUPPORTED_CONFIG_KEYS') - logger.info(f'DEVICE: {device}') - for k in keys: - logger.info(f' {k} , {compiled_model.get_config(k)}') + ## actual device-deduced settings + for device in devices: + keys = benchmark.core.get_metric(device, 'SUPPORTED_CONFIG_KEYS') + logger.info(f'DEVICE: {device}') + for k in keys: + try: + logger.info(f' {k} , {benchmark.core.get_config(device, k)}') + except: + pass + # Update number of streams for device in device_number_streams.keys():