-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathhello_query_device.py
More file actions
executable file
·44 lines (34 loc) · 1.54 KB
/
Copy pathhello_query_device.py
File metadata and controls
executable file
·44 lines (34 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import sys
import openvino as ov
def param_to_string(parameters) -> str:
"""Convert a list / tuple of parameters returned from OV to a string."""
if isinstance(parameters, (list, tuple)):
return ', '.join([str(x) for x in parameters])
else:
return str(parameters)
def main():
log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.INFO, stream=sys.stdout)
# --------------------------- Step 1. Initialize OpenVINO Runtime Core --------------------------------------------
core = ov.Core()
# --------------------------- Step 2. Get metrics of available devices --------------------------------------------
log.info('Available devices:')
for device in core.available_devices:
log.info(f'{device} :')
log.info('\tSUPPORTED_PROPERTIES:')
for property_key in core.get_property(device, 'SUPPORTED_PROPERTIES'):
if property_key not in ('SUPPORTED_PROPERTIES'):
try:
property_val = core.get_property(device, property_key)
except TypeError:
property_val = 'UNSUPPORTED TYPE'
log.info(f'\t\t{property_key}: {param_to_string(property_val)}')
log.info('')
# -----------------------------------------------------------------------------------------------------------------
return 0
if __name__ == '__main__':
sys.exit(main())