forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ie_system_conf.h
231 lines (202 loc) · 8.17 KB
/
ie_system_conf.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief Abstraction over platform specific implementations
* @file ie_system_conf.h
*/
#pragma once
#include <exception>
#include <vector>
#include "openvino/runtime/system_conf.hpp"
namespace InferenceEngine {
/**
* @brief Checks whether OpenMP environment variables are defined
* @ingroup ie_dev_api_system_conf
*
* @param[in] includeOMPNumThreads Indicates if the omp number threads is included
* @return `True` if any OpenMP environment variable is defined, `false` otherwise
*/
inline bool checkOpenMpEnvVars(bool includeOMPNumThreads = true) {
return ov::check_open_mp_env_vars(includeOMPNumThreads);
}
/**
* @brief Returns available CPU NUMA nodes (on Linux, and Windows [only with TBB], single node is assumed on all
* other OSes)
* @ingroup ie_dev_api_system_conf
* @return NUMA nodes
*/
inline std::vector<int> getAvailableNUMANodes() {
return ov::get_available_numa_nodes();
}
/**
* @brief Returns available CPU cores types (on Linux, and Windows) and ONLY with TBB, single core type is assumed
* otherwise
* @ingroup ie_dev_api_system_conf
* @return Vector of core types
*/
inline std::vector<int> getAvailableCoresTypes() {
return ov::get_available_cores_types();
}
/**
* @brief Returns number of CPU physical cores on Linux/Windows (which is considered to be more performance
* friendly for servers) (on other OSes it simply relies on the original parallel API of choice, which usually uses the
* logical cores). call function with 'false' to get #phys cores of all types call function with 'true' to get #phys
* 'Big' cores number of 'Little' = 'all' - 'Big'
* @ingroup ie_dev_api_system_conf
* @param[in] bigCoresOnly Additionally limits the number of reported cores to the 'Big' cores only.
* @return Number of physical CPU cores.
*/
inline int getNumberOfCPUCores(bool bigCoresOnly = false) {
return ov::get_number_of_cpu_cores(bigCoresOnly);
}
/**
* @brief Returns number of CPU logical cores on Linux/Windows (on other OSes it simply relies on the original
* parallel API of choice, which uses the 'all' logical cores). call function with 'false' to get #logical cores of
* all types call function with 'true' to get #logical 'Big' cores number of 'Little' = 'all' - 'Big'
* @ingroup ie_dev_api_system_conf
* @param[in] bigCoresOnly Additionally limits the number of reported cores to the 'Big' cores only.
* @return Number of logical CPU cores.
*/
inline int getNumberOfLogicalCPUCores(bool bigCoresOnly = false) {
return ov::get_number_of_logical_cpu_cores(bigCoresOnly);
}
/**
* @brief Checks whether CPU supports SSE 4.2 capability
* @ingroup ie_dev_api_system_conf
* @return `True` is SSE 4.2 instructions are available, `false` otherwise
*/
using ov::with_cpu_x86_sse42;
/**
* @brief Checks whether CPU supports AVX capability
* @ingroup ie_dev_api_system_conf
* @return `True` is AVX instructions are available, `false` otherwise
*/
using ov::with_cpu_x86_avx;
/**
* @brief Checks whether CPU supports AVX2 capability
* @ingroup ie_dev_api_system_conf
* @return `True` is AVX2 instructions are available, `false` otherwise
*/
using ov::with_cpu_x86_avx2;
/**
* @brief Checks whether CPU supports AVX 512 capability
* @ingroup ie_dev_api_system_conf
* @return `True` is AVX512F (foundation) instructions are available, `false` otherwise
*/
using ov::with_cpu_x86_avx512f;
/**
* @brief Checks whether CPU supports AVX 512 capability
* @ingroup ie_dev_api_system_conf
* @return `True` is AVX512F, AVX512BW, AVX512DQ instructions are available, `false` otherwise
*/
using ov::with_cpu_x86_avx512_core;
/**
* @brief Checks whether CPU supports AVX 512 VNNI capability
* @ingroup ie_dev_api_system_conf
* @return `True` is AVX512F, AVX512BW, AVX512DQ, AVX512_VNNI instructions are available, `false` otherwise
*/
using ov::with_cpu_x86_avx512_core_vnni;
/**
* @brief Checks whether CPU supports BFloat16 capability
* @ingroup ie_dev_api_system_conf
* @return `True` is tAVX512_BF16 instructions are available, `false` otherwise
*/
using ov::with_cpu_x86_bfloat16;
/**
* @brief Checks whether CPU supports AMX int8 capability
* @ingroup ie_dev_api_system_conf
* @return `True` is tAMX_INT8 instructions are available, `false` otherwise
*/
using ov::with_cpu_x86_avx512_core_amx_int8;
/**
* @brief Checks whether CPU supports AMX bf16 capability
* @ingroup ie_dev_api_system_conf
* @return `True` is tAMX_BF16 instructions are available, `false` otherwise
*/
using ov::with_cpu_x86_avx512_core_amx_bf16;
/**
* @brief Checks whether CPU supports AMX capability
* @ingroup ie_dev_api_system_conf
* @return `True` is tAMX_INT8 or tAMX_BF16 instructions are available, `false` otherwise
*/
using ov::with_cpu_x86_avx512_core_amx;
/**
* @brief Checks whether CPU mapping Available
* @ingroup ie_dev_api_system_conf
* @return `True` is CPU mapping is available, `false` otherwise
*/
using ov::is_cpu_map_available;
/**
* @brief Get number of numa nodes
* @ingroup ie_dev_api_system_conf
* @return Number of numa nodes
*/
using ov::get_num_numa_nodes;
/**
* @brief Set flag bit 'Used' of CPU
* @ingroup ie_dev_api_system_conf
* @param[in] cpu_ids cpus in cup_mapping.
* @param[in] used flag bit
*/
using ov::set_cpu_used;
/**
* @brief Returns number of CPU cores on Linux/Windows
* @ingroup ie_dev_api_system_conf
* @param[in] plugin_task plugin task.
* @return Number of CPU cores with core_type.
*/
using ov::get_proc_type_table;
/**
* @brief Get and reserve available cpu ids
* @ingroup ie_dev_api_system_conf
* @param[in] streams_info_table streams information table.
* @return Array of available cpu ids.
*/
using ov::reserve_available_cpus;
/**
* @brief This enum contains definition of each columns in processor type table which bases on cpu core types. Will
* extend to support other CPU core type like ARM.
*
* The following are two example of processor type table.
* 1. Processor table of two socket CPUs XEON server
*
* ALL_PROC | MAIN_CORE_PROC | EFFICIENT_CORE_PROC | HYPER_THREADING_PROC
* 96 48 0 48 // Total number of two sockets
* 48 24 0 24 // Number of socket one
* 48 24 0 24 // Number of socket two
*
* 2. Processor table of one socket CPU desktop
*
* ALL_PROC | MAIN_CORE_PROC | EFFICIENT_CORE_PROC | HYPER_THREADING_PROC
* 32 8 16 8 // Total number of one socket
*/
using ov::ColumnOfProcessorTypeTable;
/**
* @brief This enum contains definition of each columns in CPU mapping table which use processor id as index.
*
* GROUP_ID is generated according to the following rules.
* 1. If one MAIN_CORE_PROC and one HYPER_THREADING_PROC are based on same Performance-cores, they are in one group.
* 2. If some EFFICIENT_CORE_PROC share one L2 cachle, they are in one group.
* 3. There are no duplicate group IDs in the system
*
* The following is the example of CPU mapping table.
* 1. Four processors of two Pcore
* 2. Four processors of four Ecores shared L2 cache
*
* PROCESSOR_ID | SOCKET_ID | CORE_ID | CORE_TYPE | GROUP_ID | Used
* 0 0 0 3 0 0
* 1 0 0 1 0 0
* 2 0 1 3 1 0
* 3 0 1 1 1 0
* 4 0 2 2 2 0
* 5 0 3 2 2 0
* 6 0 4 2 2 0
* 7 0 5 2 2 0
*/
using ov::ColumnOfCPUMappingTable;
/**
* @brief definition of CPU_MAP_USED_FLAG column in CPU mapping table.
*/
using ov::ProcessorUseStatus;
} // namespace InferenceEngine