|
12 | 12 | #include "openvino/runtime/system_conf.hpp"
|
13 | 13 | #include "utils/properties_test.hpp"
|
14 | 14 |
|
| 15 | +#if defined(_WIN32) |
| 16 | +# include <windows.h> |
| 17 | +#endif |
| 18 | + |
15 | 19 | namespace {
|
16 | 20 |
|
17 | 21 | TEST_F(OVClassConfigTestCPU, smoke_CpuExecNetworkSupportedPropertiesAreAvailable) {
|
@@ -159,6 +163,47 @@ TEST_F(OVClassConfigTestCPU, smoke_CpuExecNetworkCheckModelZeroStreams) {
|
159 | 163 | ASSERT_EQ(streams, value);
|
160 | 164 | }
|
161 | 165 |
|
| 166 | +TEST_F(OVClassConfigTestCPU, smoke_CpuExecNetworkCheckCpuReservation) { |
| 167 | + ov::Core ie; |
| 168 | + int32_t threads = 1; |
| 169 | + int32_t res_threads = -1; |
| 170 | + bool cpu_reservation = true; |
| 171 | + bool res_cpu_reservation = false; |
| 172 | + bool cpu_pinning = false; |
| 173 | + bool res_cpu_pinning = false; |
| 174 | + |
| 175 | +#if defined(__APPLE__) |
| 176 | + cpu_reservation = false; |
| 177 | + cpu_pinning = false; |
| 178 | +#elif defined(__linux__) |
| 179 | + cpu_pinning = true; |
| 180 | +#elif defined(_WIN32) |
| 181 | + ULONG highestNodeNumber = 0; |
| 182 | + if (!GetNumaHighestNodeNumber(&highestNodeNumber)) { |
| 183 | + std::cout << "Error getting highest NUMA node number: " << GetLastError() << std::endl; |
| 184 | + return; |
| 185 | + } |
| 186 | + if (highestNodeNumber > 0) { |
| 187 | + cpu_pinning = false; |
| 188 | + } else { |
| 189 | + cpu_pinning = true; |
| 190 | + } |
| 191 | +#endif |
| 192 | + |
| 193 | + OV_ASSERT_NO_THROW(ie.set_property(deviceName, ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))); |
| 194 | + |
| 195 | + ov::AnyMap config = {{ov::inference_num_threads.name(), threads}, {ov::hint::enable_cpu_reservation.name(), true}}; |
| 196 | + ov::CompiledModel compiledModel = ie.compile_model(model, deviceName, config); |
| 197 | + |
| 198 | + OV_ASSERT_NO_THROW(res_threads = compiledModel.get_property(ov::inference_num_threads)); |
| 199 | + OV_ASSERT_NO_THROW(res_cpu_reservation = compiledModel.get_property(ov::hint::enable_cpu_reservation)); |
| 200 | + OV_ASSERT_NO_THROW(res_cpu_pinning = compiledModel.get_property(ov::hint::enable_cpu_pinning)); |
| 201 | + |
| 202 | + ASSERT_EQ(res_threads, threads); |
| 203 | + ASSERT_EQ(res_cpu_reservation, cpu_reservation); |
| 204 | + ASSERT_EQ(res_cpu_pinning, cpu_pinning); |
| 205 | +} |
| 206 | + |
162 | 207 | TEST_F(OVClassConfigTestCPU, smoke_CpuExecNetworkCheckSparseWeigthsDecompressionRate) {
|
163 | 208 | ov::Core core;
|
164 | 209 |
|
|
0 commit comments