From 399d3b10a35d6a35574621700e4d73217187f94d Mon Sep 17 00:00:00 2001 From: Matthew Michel Date: Thu, 24 Oct 2024 13:19:16 -0500 Subject: [PATCH 1/4] Reduce test size to avoid timeouts in debug builds in transform_binary.pass Signed-off-by: Matthew Michel --- CMakeLists.txt | 1 + .../alg.modifying.operations/transform_binary.pass.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9742ae33a3f..ac6847f40b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -340,6 +340,7 @@ elseif(ONEDPL_BACKEND MATCHES "^(omp)$") target_link_libraries(oneDPL INTERFACE OpenMP::OpenMP_CXX) endif() target_compile_definitions(oneDPL INTERFACE + $<$:PSTL_USE_DEBUG> ONEDPL_USE_TBB_BACKEND=0 ONEDPL_USE_DPCPP_BACKEND=0 ONEDPL_USE_OPENMP_BACKEND=1 diff --git a/test/parallel_api/algorithm/alg.modifying.operations/transform_binary.pass.cpp b/test/parallel_api/algorithm/alg.modifying.operations/transform_binary.pass.cpp index d3777c536e5..60958e46e3c 100644 --- a/test/parallel_api/algorithm/alg.modifying.operations/transform_binary.pass.cpp +++ b/test/parallel_api/algorithm/alg.modifying.operations/transform_binary.pass.cpp @@ -98,7 +98,15 @@ template <::std::size_t CallNumber, typename In1, typename In2, typename Out, ty void test(Predicate pred, _IteratorAdapter adap = {}) { - for (size_t n = 0; n <= 100000; n = n <= 16 ? n + 1 : size_t(3.1415 * n)) + // Testing is restricted for debug build + OpenMp backend as without optimization the compiler generates + // very slow code leading to test timeouts. + size_t max_n = +#if PSTL_USE_DEBUG && ONEDPL_USE_OPENMP_BACKEND + 10000; +#else + 100000; +#endif + for (size_t n = 0; n <= max_n; n = n <= 16 ? n + 1 : size_t(3.1415 * n)) { Sequence in1(n, [](size_t k) { return k % 5 != 1 ? In1(3 * k + 7) : 0; }); Sequence in2(n, [](size_t k) { return k % 7 != 2 ? In2(5 * k + 5) : 0; }); From bb3313b0f6a8b9384c1d8a8812ae88741ddac1e4 Mon Sep 17 00:00:00 2001 From: Matthew Michel Date: Thu, 24 Oct 2024 13:34:25 -0500 Subject: [PATCH 2/4] Explicitly set PSTL_USE_DEBUG=1 (most compilers seems to do this by default) Signed-off-by: Matthew Michel --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac6847f40b1..c218e87d9b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,7 +180,7 @@ if (ONEDPL_BACKEND MATCHES "^(tbb|dpcpp|dpcpp_only)$") target_compile_definitions(oneDPL INTERFACE $<$:TBB_USE_DEBUG=1> - $<$:PSTL_USE_DEBUG> + $<$:PSTL_USE_DEBUG=1> $<$:ONEDPL_USE_TBB_BACKEND=0> $<$:ONEDPL_USE_DPCPP_BACKEND=0> ) @@ -340,7 +340,7 @@ elseif(ONEDPL_BACKEND MATCHES "^(omp)$") target_link_libraries(oneDPL INTERFACE OpenMP::OpenMP_CXX) endif() target_compile_definitions(oneDPL INTERFACE - $<$:PSTL_USE_DEBUG> + $<$:PSTL_USE_DEBUG=1> ONEDPL_USE_TBB_BACKEND=0 ONEDPL_USE_DPCPP_BACKEND=0 ONEDPL_USE_OPENMP_BACKEND=1 From 82628dd238edce442caeb6f760020c065386a7fb Mon Sep 17 00:00:00 2001 From: Matthew Michel Date: Fri, 1 Nov 2024 11:48:36 -0700 Subject: [PATCH 3/4] Set PSTL_USE_DEBUG=1 for all backends in Debug configurations Signed-off-by: Matthew Michel --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c218e87d9b4..3cb28a1693d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,6 +108,7 @@ endif() ############################################################################### add_library(oneDPL INTERFACE) target_compile_features(oneDPL INTERFACE cxx_std_17) +target_compile_definitions(oneDPL INTERFACE $<$:PSTL_USE_DEBUG=1>) if (CMAKE_BUILD_TYPE) message(STATUS "Build type is ${CMAKE_BUILD_TYPE}") @@ -180,7 +181,6 @@ if (ONEDPL_BACKEND MATCHES "^(tbb|dpcpp|dpcpp_only)$") target_compile_definitions(oneDPL INTERFACE $<$:TBB_USE_DEBUG=1> - $<$:PSTL_USE_DEBUG=1> $<$:ONEDPL_USE_TBB_BACKEND=0> $<$:ONEDPL_USE_DPCPP_BACKEND=0> ) @@ -340,7 +340,6 @@ elseif(ONEDPL_BACKEND MATCHES "^(omp)$") target_link_libraries(oneDPL INTERFACE OpenMP::OpenMP_CXX) endif() target_compile_definitions(oneDPL INTERFACE - $<$:PSTL_USE_DEBUG=1> ONEDPL_USE_TBB_BACKEND=0 ONEDPL_USE_DPCPP_BACKEND=0 ONEDPL_USE_OPENMP_BACKEND=1 From c1e293f431bd2dca36169513df75a743cf36b2cd Mon Sep 17 00:00:00 2001 From: Matthew Michel Date: Fri, 1 Nov 2024 11:50:32 -0700 Subject: [PATCH 4/4] Correct spelling of OpenMP Signed-off-by: Matthew Michel --- .../alg.modifying.operations/transform_binary.pass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel_api/algorithm/alg.modifying.operations/transform_binary.pass.cpp b/test/parallel_api/algorithm/alg.modifying.operations/transform_binary.pass.cpp index 60958e46e3c..113c24be7c8 100644 --- a/test/parallel_api/algorithm/alg.modifying.operations/transform_binary.pass.cpp +++ b/test/parallel_api/algorithm/alg.modifying.operations/transform_binary.pass.cpp @@ -98,7 +98,7 @@ template <::std::size_t CallNumber, typename In1, typename In2, typename Out, ty void test(Predicate pred, _IteratorAdapter adap = {}) { - // Testing is restricted for debug build + OpenMp backend as without optimization the compiler generates + // Testing is restricted for debug build + OpenMP backend as without optimization the compiler generates // very slow code leading to test timeouts. size_t max_n = #if PSTL_USE_DEBUG && ONEDPL_USE_OPENMP_BACKEND