From ec6fd50e203b276932a6e6f0d66cecdfe2687232 Mon Sep 17 00:00:00 2001 From: Matthew Michel Date: Fri, 1 Nov 2024 07:05:24 -0700 Subject: [PATCH 1/2] Limit the number of omp threads launched in shift_left_right.pass to resolve timeouts Signed-off-by: Matthew Michel --- .../shift_left_right.pass.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/parallel_api/algorithm/alg.modifying.operations/shift_left_right.pass.cpp b/test/parallel_api/algorithm/alg.modifying.operations/shift_left_right.pass.cpp index 317cbeb77d7..6f358c914f9 100644 --- a/test/parallel_api/algorithm/alg.modifying.operations/shift_left_right.pass.cpp +++ b/test/parallel_api/algorithm/alg.modifying.operations/shift_left_right.pass.cpp @@ -36,6 +36,10 @@ #include "support/sycl_alloc_utils.h" #endif +#if ONEDPL_USE_OPENMP_BACKEND +#include // omp_get_max_threads, omp_set_num_threads +#endif + template struct USM; @@ -214,6 +218,13 @@ test_shift_by_type(Size m, Size n) int main() { +#if ONEDPL_USE_OPENMP_BACKEND + // Due to small problem sizes in this test, runtime explodes on CPUs with large core counts due to + // very small grain sizes per thread. + const int max_threads = omp_get_max_threads(); + const int threads_to_use = std::min(max_threads, int(32)); + omp_set_num_threads(threads_to_use); +#endif using ValueType = ::std::int32_t; const ::std::size_t N = 100000; From 04916f0f755185d52aa2ee0e31099dabd9117d8a Mon Sep 17 00:00:00 2001 From: Matthew Michel Date: Fri, 1 Nov 2024 07:51:20 -0700 Subject: [PATCH 2/2] Update comment Signed-off-by: Matthew Michel --- .../alg.modifying.operations/shift_left_right.pass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel_api/algorithm/alg.modifying.operations/shift_left_right.pass.cpp b/test/parallel_api/algorithm/alg.modifying.operations/shift_left_right.pass.cpp index 6f358c914f9..c15a493a639 100644 --- a/test/parallel_api/algorithm/alg.modifying.operations/shift_left_right.pass.cpp +++ b/test/parallel_api/algorithm/alg.modifying.operations/shift_left_right.pass.cpp @@ -220,7 +220,7 @@ main() { #if ONEDPL_USE_OPENMP_BACKEND // Due to small problem sizes in this test, runtime explodes on CPUs with large core counts due to - // very small grain sizes per thread. + // small grain sizes per thread and cross-socket traffic. const int max_threads = omp_get_max_threads(); const int threads_to_use = std::min(max_threads, int(32)); omp_set_num_threads(threads_to_use);