Skip to content

Commit

Permalink
[test] Limit the number of launched threads in `shift_left_right.pass…
Browse files Browse the repository at this point in the history
…` with the OMP backend to avoid timeouts (#1928)

Signed-off-by: Matthew Michel <[email protected]>
  • Loading branch information
mmichel11 authored Nov 1, 2024
1 parent c376768 commit bdc037b
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#include "support/sycl_alloc_utils.h"
#endif

#if ONEDPL_USE_OPENMP_BACKEND
#include <omp.h> // omp_get_max_threads, omp_set_num_threads
#endif

template<typename Name>
struct USM;

Expand Down Expand Up @@ -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
// 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);
#endif
using ValueType = ::std::int32_t;

const ::std::size_t N = 100000;
Expand Down

0 comments on commit bdc037b

Please sign in to comment.