-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TEST] Skip parallel tests on machines having a single CPU #3303
Conversation
Documentation preview available at https://docs.seqan.de/preview/seqan/seqan3/3303 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3303 +/- ##
=======================================
Coverage 98.13% 98.13%
=======================================
Files 271 271
Lines 11948 11948
Branches 104 104
=======================================
Hits 11725 11725
Misses 223 223 ☔ View full report in Codecov by Sentry. |
Hey @sanvilla, thanks for the PR! As this bug results from dividing the thread count by two in
I would suggest adapting the test instead diff --git a/test/unit/contrib/parallel/buffer_queue_parallel_test.cpp b/test/unit/contrib/parallel/buffer_queue_parallel_test.cpp
index 6bf5b553e..34c8def1a 100644
--- a/test/unit/contrib/parallel/buffer_queue_parallel_test.cpp
+++ b/test/unit/contrib/parallel/buffer_queue_parallel_test.cpp
@@ -15,11 +15,8 @@
template <typename sequential_push_t, typename sequential_pop_t>
void test_buffer_queue_wait_status()
{
- size_t thread_count = std::thread::hardware_concurrency();
-
- // limit thread count as virtualbox (used by Travis) seems to have problems with thread congestion
- if (thread_count > 4)
- thread_count = 4;
+ // At least two threads (one producer and one consumer), at most 4 threads (avoid congestion).
+ size_t thread_count = std::clamp<size_t>(std::thread::hardware_concurrency(), 2u, 4u);
size_t writer_count = thread_count / 2;
if constexpr (sequential_push_t::value)
@@ -129,11 +126,9 @@ void test_buffer_queue_wait_throw(size_t initialCapacity)
}
volatile std::atomic<size_t> chk_sum2 = 0;
- size_t thread_count = std::thread::hardware_concurrency();
- // limit thread count as virtualbox (used by Travis) seems to have problems with thread congestion
- if (thread_count > 4)
- thread_count = 4;
+ // At least two threads (one producer and one consumer), at most 4 threads (avoid congestion).
+ size_t thread_count = std::clamp<size_t>(std::thread::hardware_concurrency(), 2u, 4u);
size_t writer_count = thread_count / 2;
if constexpr (sequential_push_t::value) Do you want to adapt your PR or should we push the changes? |
@sanvila : What you have found, is definitely a bug in our tests. But, I am curious, under which circumstances do you actually have only one core? |
Feel free to reject the PR and fix the issue as you see fit, as long as it works on single-CPU systems. Thanks a lot! |
Otherwise this is what happens: The following tests FAILED: 5762 - contrib/parallel/buffer_queue_parallel_test::buffer_queue.spmc_sum (Failed) 5763 - contrib/parallel/buffer_queue_parallel_test::buffer_queue.mpsc_sum (Failed) 5764 - contrib/parallel/buffer_queue_parallel_test::buffer_queue.mpmc_sum (Failed) 5767 - contrib/parallel/buffer_queue_parallel_test::buffer_queue.spmc_dynamicsize (Failed) 5768 - contrib/parallel/buffer_queue_parallel_test::buffer_queue.spmc_fixedsize (Failed) 5769 - contrib/parallel/buffer_queue_parallel_test::buffer_queue.mpsc_dynamicsize (Failed) 5770 - contrib/parallel/buffer_queue_parallel_test::buffer_queue.mpsc_fixedsize (Failed) 5771 - contrib/parallel/buffer_queue_parallel_test::buffer_queue.mpmc_dynamicsize (Failed) 5772 - contrib/parallel/buffer_queue_parallel_test::buffer_queue.mpmc_fixedsize (Failed) Errors while running CTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx!
Good question! I'm doing QA work for Debian, using virtual machines in the cloud, to ensure that all packages may be built from source. The official Debian autobuilders are physical machines with four or more CPUs, and as a result, that’s the most tested configuration. So, to compensate, I’m using systems with one and two CPUs for my QA work. After all, Debian aims to be the universal operating system, suitable for both desktops and servers. |
Otherwise this is what happens: