[CONFORMANCE] Add check devices in parallelization over devices (#16964)

* [CONFORMANCE] Add check devices in parallelization over devices

* Remove extra
This commit is contained in:
Irina Efode 2023-04-14 18:50:35 +04:00 committed by GitHub
parent 231569db16
commit ae34720818
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 9 deletions

View File

@ -62,13 +62,14 @@ def parse_arguments():
parser.add_argument("-c", "--ov_config_path", help=ov_config_path_helper, type=str, required=False, default="")
parser.add_argument("-s", "--dump_conformance", help=dump_conformance_help, type=int, required=False, default=0)
parser.add_argument("-sm", "--shape_mode", help=shape_mode_help, type=str, required=False, default="")
parser.add_argument("-p", "--parallel_devices", help=parallel_help, type=int, required=False, default=0)
parser.add_argument("-p", "--parallel_devices", help=parallel_help, type=bool, required=False, default=False)
return parser.parse_args()
class Conformance:
def __init__(self, device:str, model_path:os.path, ov_path:os.path, type:str, workers:int,
gtest_filter:str, working_dir:os.path, ov_config_path:os.path, shape_mode:str):
gtest_filter:str, working_dir:os.path, ov_config_path:os.path, shape_mode:str,
parallel_devices:bool):
self._device = device
self._model_path = model_path
self._ov_path = ov_path
@ -93,6 +94,7 @@ class Conformance:
else:
logger.error(f'Incorrect value to set shape mode: {shape_mode}. Please check to get possible values')
exit(-1)
self._is_parallel_over_devices = parallel_devices
def __download_models(self, url_to_download, path_to_save):
_, file_name = os.path.split(urlparse(url_to_download).path)
@ -170,7 +172,7 @@ class Conformance:
f"--report_unique_name", f'--output_folder="{parallel_report_dir}"',
f'--gtest_filter={self._gtest_filter}', f'--config_path="{self._ov_config_path}"',
f'--shape_mode={self._shape_mode}']
conformance = TestParallelRunner(f"{conformance_path}", command_line_args, self._workers, logs_dir, "", True)
conformance = TestParallelRunner(f"{conformance_path}", command_line_args, self._workers, logs_dir, "", self._is_parallel_over_devices)
conformance.run()
conformance.postprocess_logs()
@ -240,5 +242,5 @@ if __name__ == "__main__":
args.ov_path, args.type,
args.workers, args.gtest_filter,
args.working_dir, args.ov_config_path,
args.shape_mode)
args.shape_mode, args.parallel_devices)
conformance.run(args.dump_conformance)

View File

@ -202,7 +202,7 @@ class TaskManager:
return self._idx
class TestParallelRunner:
def __init__(self, exec_file_path: os.path, test_command_line: list, worker_num: int, working_dir: os.path, cache_path: os.path, is_parallel_devices: False):
def __init__(self, exec_file_path: os.path, test_command_line: list, worker_num: int, working_dir: os.path, cache_path: os.path, is_parallel_devices=False):
self._exec_file_path = exec_file_path
self._working_dir = working_dir
self._command = self.__init_basic_command_line_for_exec_file(test_command_line)

View File

@ -33,5 +33,10 @@ RELEASE_DIR = "Release"
OP_CONFORMANCE = "OP"
API_CONFORMANCE = "API"
REL_WEIGHTS_FILENAME = "rel_weights_REPLACE.lst"
DEVICE_ARCHITECTURE_PROPERTY = "DEVICE_ARCHITECTURE"
FULL_DEVICE_PROPERTY = "FULL_DEVICE_NAME"
SUPPORTED_PROPERTIES = "SUPPORTED_PROPERTIES"
REL_WEIGHTS_REPLACE_STR = "REPLACE"
REL_WEIGHTS_FILENAME = f"rel_weights_{REL_WEIGHTS_REPLACE_STR}.lst"

View File

@ -1,7 +1,10 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from utils.conformance_utils import get_logger
from utils.constants import FULL_DEVICE_PROPERTY, SUPPORTED_PROPERTIES, DEVICE_ARCHITECTURE_PROPERTY
logger = get_logger("get_available_device")
try:
from openvino.runtime import Core
@ -9,9 +12,7 @@ except:
from utils.file_utils import get_ov_path, find_latest_dir
import os
from utils.constants import PY_OPENVINO, LD_LIB_PATH_NAME
from utils.conformance_utils import get_logger, set_env_variable
logger = get_logger("get_available_device")
from utils.conformance_utils import set_env_variable
script_dir, _ = os.path.split(os.path.abspath(__file__))
ov_bin_path = get_ov_path(script_dir, None, True)
@ -39,5 +40,15 @@ def get_available_devices(target_device = None, exclude_device = None):
if target_device is None or target_device in device:
if exclude_device in device:
continue
supported_metrics = core.get_property(target_device, SUPPORTED_PROPERTIES)
if FULL_DEVICE_PROPERTY in supported_metrics:
if core.get_property(target_device, FULL_DEVICE_PROPERTY) != core.get_property(device, FULL_DEVICE_PROPERTY):
logger.warning(f'Device {device} is different {FULL_DEVICE_PROPERTY} with {target_device} ( : {core.get_property(device, FULL_DEVICE_PROPERTY)} : {core.get_property(target_device, FULL_DEVICE_PROPERTY)} )')
continue
if DEVICE_ARCHITECTURE_PROPERTY in supported_metrics:
if not core.get_property(target_device, DEVICE_ARCHITECTURE_PROPERTY) != core.get_property(device, DEVICE_ARCHITECTURE_PROPERTY):
logger.warning(f'Device {device} is different {DEVICE_ARCHITECTURE_PROPERTY} with {target_device} ( : {core.get_property(device, DEVICE_ARCHITECTURE_PROPERTY)} : {core.get_property(target_device, DEVICE_ARCHITECTURE_PROPERTY)} )')
continue
logger.info(f"{device} is added to device pool")
result.append(device)
return result