Skip to content

Commit ef6f9b5

Browse files
dnmokhovaleksei-fedotovisaevil
authored
Account for cgroups constraints in the NUMA task arena conformance test (#2014)
Co-authored-by: Aleksei Fedotov <fedotov.aleksei@gmail.com> Co-authored-by: Ilya Isaev <ilya.isaev@intel.com>
1 parent 5309534 commit ef6f9b5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/conformance/conformance_arena_constraints.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,16 @@ TEST_CASE("Test reserved slots argument in create_numa_task_arenas") {
157157
[](const index_info &lhs, const index_info &rhs) {
158158
return lhs.concurrency < rhs.concurrency;
159159
})->concurrency;
160-
160+
const int max_threads = int(utils::get_platform_max_threads()); // respects cgroup
161+
const int max_tbb_workers = max_threads - 1;
161162
for (int reserved_slots = 0; reserved_slots <= expected_numa_concurrency; ++reserved_slots) {
162163
auto numa_task_arenas = tbb::create_numa_task_arenas({}, reserved_slots);
163164
tbb::task_group tg{};
164165
// Having only NUMA node means that the default total number of workers is equal to
165166
// concurrnecy of the single NUMA - 1. This means that for task_arena with reserved_slots=0
166167
// worker threads won't be able to fully saturate the arena.
167168
// This flag is set to adjust test expectations accordingly.
168-
bool workers_cannot_fully_occupy_arena = numa_nodes_info.size() == 1 && reserved_slots == 0;
169+
bool workers_cannot_fully_occupy_arena = max_tbb_workers < expected_numa_concurrency && reserved_slots == 0;
169170
for (auto& ta : numa_task_arenas) {
170171
// For the case when task_arena is created with both max_concurrency and reserved_slots
171172
// equal to 1 oneTBB creates a special additional worker to execute an "enqueue" task.

0 commit comments

Comments
 (0)