From 910d43e45b04fb0e7d155233f7069cab0aeefc79 Mon Sep 17 00:00:00 2001 From: Rahulkumar Gayatri Date: Tue, 17 Jan 2023 11:28:36 -0800 Subject: [PATCH] OpenMP: Adding an ifdef around chunksize for static schedule for GCC compiler. --- core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp b/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp index 8e3e97b7a2..50d995a061 100644 --- a/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp +++ b/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp @@ -101,8 +101,15 @@ class ParallelFor, Kokkos::OpenMP> { std::enable_if_t::value> execute_parallel() const { +// Specifying an chunksize with GCC compiler leads to performance regression +// with static schedule. +#ifdef KOKKOS_COMPILER_GNU +#pragma omp parallel for schedule(static) \ + num_threads(m_instance->thread_pool_size()) +#else #pragma omp parallel for schedule(static KOKKOS_OPENMP_OPTIONAL_CHUNK_SIZE) \ num_threads(m_instance->thread_pool_size()) +#endif KOKKOS_PRAGMA_IVDEP_IF_ENABLED for (auto iwork = m_policy.begin(); iwork < m_policy.end(); ++iwork) { exec_work(m_functor, iwork);