hddl_config.hpp
Go to the documentation of this file.
1 // Copyright (C) 2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @brief A header that defines advanced related properties for HDDL plugin.
7  * These properties should be used in SetConfig() and LoadNetwork() methods of plugins
8  *
9  * @file hddl_config.hpp
10  */
11 
12 #pragma once
13 
14 #include "vpu_config.hpp"
15 
16 namespace InferenceEngine {
17 
18 namespace Metrics {
19 
20 /**
21 * @brief Metric to get a int of the device number, String value is METRIC_HDDL_DEVICE_NUM
22 */
23 DECLARE_METRIC_KEY(HDDL_DEVICE_NUM, int);
24 
25 /**
26 * @brief Metric to get a std::vector<std::string> of device names, String value is METRIC_HDDL_DEVICE_NAME
27 */
28 DECLARE_METRIC_KEY(HDDL_DEVICE_NAME, std::vector<std::string>);
29 
30 /**
31 * @brief Metric to get a std::vector<float> of device thermal, String value is METRIC_HDDL_DEVICE_THERMAL
32 */
33 DECLARE_METRIC_KEY(HDDL_DEVICE_THERMAL, std::vector<float>);
34 
35 /**
36 * @brief Metric to get a std::vector<uint32> of device ids, String value is METRIC_HDDL_DEVICE_ID
37 */
38 DECLARE_METRIC_KEY(HDDL_DEVICE_ID, std::vector<unsigned int>);
39 
40 /**
41 * @brief Metric to get a std::vector<int> of device subclasses, String value is METRIC_HDDL_DEVICE_SUBCLASS
42 */
43 DECLARE_METRIC_KEY(HDDL_DEVICE_SUBCLASS, std::vector<int>);
44 
45 /**
46 * @brief Metric to get a std::vector<uint32> of device total memory, String value is METRIC_HDDL_MEMORY_TOTAL
47 */
48 DECLARE_METRIC_KEY(HDDL_DEVICE_MEMORY_TOTAL, std::vector<unsigned int>);
49 
50 /**
51 * @brief Metric to get a std::vector<uint32> of device used memory, String value is METRIC_HDDL_DEVICE_MEMORY_USED
52 */
53 DECLARE_METRIC_KEY(HDDL_DEVICE_MEMORY_USED, std::vector<unsigned int>);
54 
55 /**
56 * @brief Metric to get a std::vector<float> of device utilization, String value is METRIC_HDDL_DEVICE_UTILIZATION
57 */
58 DECLARE_METRIC_KEY(HDDL_DEVICE_UTILIZATION, std::vector<float>);
59 
60 /**
61 * @brief Metric to get a std::vector<std::string> of stream ids, String value is METRIC_HDDL_DEVICE_STREAM_ID
62 */
63 DECLARE_METRIC_KEY(HDDL_STREAM_ID, std::vector<std::string>);
64 
65 /**
66 * @brief Metric to get a std::vector<std::string> of device tags, String value is METRIC_HDDL_DEVICE_TAG
67 */
68 DECLARE_METRIC_KEY(HDDL_DEVICE_TAG, std::vector<std::string>);
69 
70 /**
71 * @brief Metric to get a std::vector<int> of group ids, String value is METRIC_HDDL_GROUP_ID
72 */
73 DECLARE_METRIC_KEY(HDDL_GROUP_ID, std::vector<int>);
74 
75 /**
76 * @brief Metric to get a int number of device be using for group, String value is METRIC_HDDL_DEVICE_GROUP_USING_NUM
77 */
78 DECLARE_METRIC_KEY(HDDL_DEVICE_GROUP_USING_NUM, int);
79 
80 /**
81 * @brief Metric to get a int number of total device, String value is METRIC_HDDL_DEVICE_TOTAL_NUM
82 */
83 DECLARE_METRIC_KEY(HDDL_DEVICE_TOTAL_NUM, int);
84 
85 } // namespace Metrics
86 
87 /**
88  * @brief [Only for HDDLPlugin]
89  * Type: Arbitrary non-empty string. If empty (""), equals no set, default: "";
90  * This option allows to specify the number of MYX devices used for inference a specific Executable network.
91  * Note: Only one network would be allocated to one device.
92  * The number of devices for the tag is specified in the hddl_service.config file.
93  * Example:
94  * "service_settings":
95  * {
96  * "graph_tag_map":
97  * {
98  * "tagA":3
99  * }
100  * }
101  * It means that an executable network marked with tagA will be executed on 3 devices
102  */
103 DECLARE_VPU_CONFIG(HDDL_GRAPH_TAG);
104 
105 /**
106  * @brief [Only for HDDLPlugin]
107  * Type: Arbitrary non-empty string. If empty (""), equals no set, default: "";
108  * This config makes the executable networks to be allocated on one certain device (instead of multiple devices).
109  * And all inference through this executable network, will be done on this device.
110  * Note: Only one network would be allocated to one device.
111  * The number of devices which will be used for stream-affinity must be specified in hddl_service.config file.
112  * Example:
113  * "service_settings":
114  * {
115  * "stream_device_number":5
116  * }
117  * It means that 5 device will be used for stream-affinity
118  */
119 DECLARE_VPU_CONFIG(HDDL_STREAM_ID);
120 
121 /**
122  * @brief [Only for HDDLPlugin]
123  * Type: Arbitrary non-empty string. If empty (""), equals no set, default: "";
124  * This config allows user to control device flexibly. This config gives a "tag" for a certain device while
125  * allocating a network to it. Afterward, user can allocating/deallocating networks to this device with this "tag".
126  * Devices used for such use case is controlled by a so-called "Bypass Scheduler" in HDDL backend, and the number
127  * of such device need to be specified in hddl_service.config file.
128  * Example:
129  * "service_settings":
130  * {
131  * "bypass_device_number": 5
132  * }
133  * It means that 5 device will be used for Bypass scheduler.
134  */
135 DECLARE_VPU_CONFIG(HDDL_DEVICE_TAG);
136 
137 /**
138  * @brief [Only for HDDLPlugin]
139  * Type: "YES/NO", default is "NO".
140  * This config is a sub-config of DEVICE_TAG, and only available when "DEVICE_TAG" is set. After a user load a
141  * network, the user got a handle for the network.
142  * If "YES", the network allocated is bind to the device (with the specified "DEVICE_TAG"), which means all afterwards
143  * inference through this network handle will be executed on this device only.
144  * If "NO", the network allocated is not bind to the device (with the specified "DEVICE_TAG"). If the same network
145  * is allocated on multiple other devices (also set BIND_DEVICE to "False"), then inference through any handle of these
146  * networks may be executed on any of these devices those have the network loaded.
147  */
148 DECLARE_VPU_CONFIG(HDDL_BIND_DEVICE);
149 
150 /**
151  * @brief [Only for HDDLPlugin]
152  * Type: A signed int wrapped in a string, default is "0".
153  * This config is a sub-config of DEVICE_TAG, and only available when "DEVICE_TAG" is set and "BIND_DEVICE" is "False".
154  * When there are multiple devices running a certain network (a same network running on multiple devices in Bypass Scheduler),
155  * the device with a larger number has a higher priority, and more inference tasks will be fed to it with priority.
156  */
157 DECLARE_VPU_CONFIG(HDDL_RUNTIME_PRIORITY);
158 
159 /**
160  * @brief [Only for HDDLPlugin]
161  * Type: "YES/NO", default is "NO".
162  * SGAD is short for "Single Graph All Device". With this scheduler, once application allocates 1 network, all devices
163  * (managed by SGAD scheduler) will be loaded with this graph. The number of network that can be loaded to one device
164  * can exceed one. Once application deallocates 1 network from device, all devices will unload the network from them.
165  */
166 DECLARE_VPU_CONFIG(HDDL_USE_SGAD);
167 
168 /**
169  * @brief [Only for HDDLPlugin]
170  * Type: A signed int wrapped in a string, default is "0".
171  * This config gives a "group id" for a certain device when this device has been reserved for certain client, client
172  * can use this device grouped by calling this group id while other client can't use this device
173  * Each device has their own group id. Device in one group shares same group id.
174  */
175 DECLARE_VPU_CONFIG(HDDL_GROUP_DEVICE);
176 
177 } // namespace InferenceEngine
Inference Engine C++ API.
Definition: cldnn_config.hpp:15
static constexpr auto HDDL_RUNTIME_PRIORITY
[Only for HDDLPlugin] Type: A signed int wrapped in a string, default is "0". This config is a sub-co...
Definition: hddl_config.hpp:157
static constexpr auto HDDL_STREAM_ID
[Only for HDDLPlugin] Type: Arbitrary non-empty string. If empty (""), equals no set,...
Definition: hddl_config.hpp:119
static constexpr auto HDDL_DEVICE_TAG
[Only for HDDLPlugin] Type: Arbitrary non-empty string. If empty (""), equals no set,...
Definition: hddl_config.hpp:135
static constexpr auto HDDL_USE_SGAD
[Only for HDDLPlugin] Type: "YES/NO", default is "NO". SGAD is short for "Single Graph All Device"....
Definition: hddl_config.hpp:166
static constexpr auto HDDL_GROUP_DEVICE
[Only for HDDLPlugin] Type: A signed int wrapped in a string, default is "0". This config gives a "gr...
Definition: hddl_config.hpp:175
static constexpr auto HDDL_GRAPH_TAG
[Only for HDDLPlugin] Type: Arbitrary non-empty string. If empty (""), equals no set,...
Definition: hddl_config.hpp:103
static constexpr auto HDDL_BIND_DEVICE
[Only for HDDLPlugin] Type: "YES/NO", default is "NO". This config is a sub-config of DEVICE_TAG,...
Definition: hddl_config.hpp:148
A header that defines common config subset for VPU plugins. Include myriad_config....