30 lines
1.3 KiB
Diff
30 lines
1.3 KiB
Diff
From 8c968ef74bb804200cd25fa6e078d5aabed7a5e6 Mon Sep 17 00:00:00 2001
|
|
From: Petter Reinholdtsen <pere@debian.org>
|
|
Date: Tue, 31 Mar 2026 10:07:49 +0200
|
|
Subject: [PATCH] Adjusted test_lightweight to avoid zero threads in test.
|
|
|
|
When the hardware only support one core, hardware_concurrency() return 1,
|
|
which when deviced by 2 using integer division end up as 0, a useless
|
|
number of threads. Instead, ensure it end up as 1, while the other
|
|
return values still end up with a sensible number by changing
|
|
(i/2) to ((i+1)/2).
|
|
|
|
This fix is related to #2027.
|
|
---
|
|
test/common/graph_utils.h | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/test/common/graph_utils.h b/test/common/graph_utils.h
|
|
index 26a0c0ada0..714a27f79b 100644
|
|
--- a/test/common/graph_utils.h
|
|
+++ b/test/common/graph_utils.h
|
|
@@ -953,7 +953,7 @@ template<typename NodeType>
|
|
void test_lightweight(unsigned N) {
|
|
test_unlimited_lightweight_execution<NodeType>(N);
|
|
test_limited_lightweight_execution<NodeType>(N, tbb::flow::serial);
|
|
- test_limited_lightweight_execution<NodeType>(N, (std::min)(std::thread::hardware_concurrency() / 2, N/2));
|
|
+ test_limited_lightweight_execution<NodeType>(N, (std::min)((std::thread::hardware_concurrency()+1) / 2, N/2));
|
|
|
|
test_limited_lightweight_execution_with_throwing_body<NodeType>(N, tbb::flow::serial);
|
|
}
|