-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Copy pathmake_default_multi_threaded_test.cpp
165 lines (144 loc) · 4.1 KB
/
make_default_multi_threaded_test.cpp
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
// Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <gtest/gtest.h>
#include <common_test_utils/test_common.hpp>
#include "openvino/runtime/threading/istreams_executor.hpp"
#include "os/cpu_map_info.hpp"
using namespace testing;
using namespace ov;
using namespace threading;
namespace {
#if defined(__linux__) || defined(_WIN32)
struct MakeDefaultMultiThreadsTestCase {
std::vector<std::vector<int>> _proc_type_table;
int _num_streams;
std::vector<std::vector<int>> _streams_info_table;
};
class MakeDefaultMultiThreadsTest : public ov::test::TestsCommon,
public testing::WithParamInterface<std::tuple<MakeDefaultMultiThreadsTestCase>> {
public:
void SetUp() override {
auto test_data = std::get<0>(GetParam());
CPU& cpu = cpu_info();
cpu._org_proc_type_table = test_data._proc_type_table;
cpu._proc_type_table = test_data._proc_type_table;
cpu._numa_nodes =
test_data._proc_type_table.size() > 1 ? static_cast<int>(test_data._proc_type_table.size()) - 1 : 1;
ov::threading::IStreamsExecutor::Config config{"make default multi threads test", test_data._num_streams};
auto streamsConfig = ov::threading::IStreamsExecutor::Config::make_default_multi_threaded(config);
ASSERT_EQ(streamsConfig.get_streams_info_table(), test_data._streams_info_table);
}
};
MakeDefaultMultiThreadsTestCase _1sockets_streams_1 = {
// param[in]: proc_type_table, {total processors, number of physical processors, number of Efficient processors,
// number of hyper threading processors}
{
{12, 6, 0, 6, 0, 0},
},
1, // param[in]: the number of streams
// param[out]: streams info table
{
{1, 0, 12, 0, 0},
{0, 1, 6, 0, 0},
{0, 3, 6, 0, 0},
},
};
MakeDefaultMultiThreadsTestCase _1sockets_streams_2 = {
{
{12, 6, 0, 6, 0, 0},
},
2,
{
{1, 1, 6, 0, 0},
{1, 3, 6, 0, 0},
},
};
MakeDefaultMultiThreadsTestCase _2sockets_streams_1 = {
{
{72, 36, 0, 36, -1, -1},
{36, 18, 0, 18, 0, 0},
{36, 18, 0, 18, 1, 1},
},
1,
{
{1, 0, 72, -1, -1},
{0, 1, 18, 0, 0},
{0, 1, 18, 1, 1},
{0, 3, 18, 0, 0},
{0, 3, 18, 1, 1},
},
};
MakeDefaultMultiThreadsTestCase _2sockets_streams_4 = {
{
{72, 36, 0, 36, -1, -1},
{36, 18, 0, 18, 0, 0},
{36, 18, 0, 18, 1, 1},
},
4,
{
{1, 1, 18, 0, 0},
{1, 1, 18, 1, 1},
{1, 3, 18, 0, 0},
{1, 3, 18, 1, 1},
},
};
MakeDefaultMultiThreadsTestCase _pecore24_streams_1 = {
{
{24, 8, 8, 8, 0, 0},
},
1,
{
{1, 0, 24, 0, 0},
{0, 1, 8, 0, 0},
{0, 2, 8, 0, 0},
{0, 3, 8, 0, 0},
},
};
MakeDefaultMultiThreadsTestCase _pecore24_streams_3 = {
{
{24, 8, 8, 8, 0, 0},
},
3,
{
{1, 1, 8, 0, 0},
{1, 2, 8, 0, 0},
{1, 3, 8, 0, 0},
},
};
MakeDefaultMultiThreadsTestCase _pecore32_streams_1 = {
{
{32, 8, 16, 8, 0, 0},
},
1,
{
{1, 0, 32, 0, 0},
{0, 1, 8, 0, 0},
{0, 2, 16, 0, 0},
{0, 3, 8, 0, 0},
},
};
MakeDefaultMultiThreadsTestCase _pecore32_streams_5 = {
{
{32, 8, 16, 8, 0, 0},
},
5,
{
{1, 1, 5, 0, 0},
{3, 2, 5, 0, 0},
{1, 3, 5, 0, 0},
},
};
TEST_P(MakeDefaultMultiThreadsTest, MakeDefaultMultiThreads) {}
INSTANTIATE_TEST_SUITE_P(smoke_MakeDefaultMultiThreads,
MakeDefaultMultiThreadsTest,
testing::Values(_1sockets_streams_1,
_1sockets_streams_2,
_2sockets_streams_1,
_2sockets_streams_4,
_pecore24_streams_1,
_pecore24_streams_3,
_pecore32_streams_1,
_pecore32_streams_5));
#endif
} // namespace