Enable THROUGHPUT by default for all the devices. (#9107)

* Set THROUGHPUT as the default configration for all the plugin and display the config of the plugin.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* updated format.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* Update benchmark python API.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* Replace str 'THROUGHPUT' with CONFIG_VALUE(THROUGHPUT).

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* Using CONFIG_VALUE(THROUGHPUT) replace 'THROUGHPUT' string.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* update code style.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* Move the setting output code into the try block.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>
This commit is contained in:
Wang, Yang 2022-01-12 16:09:54 +08:00 committed by GitHub
parent 26a78fcb5d
commit 4546df5091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 20 deletions

View File

@ -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<std::string> 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<std::string> 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<std::string>();
} catch (...) {
};
// output of the actual settings that the device selected
for (const auto& device : devices) {
std::vector<std::string> 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<std::string>();
slog::info << " }" << slog::endl;
}
} catch (...) {
};
}
}

View File

@ -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

View File

@ -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():