Skip to content

Commit

Permalink
Merge pull request #5742 from rgayatri23/OpenMP_regression_fix
Browse files Browse the repository at this point in the history
OpenMP: Don't use chunk size for static scheduling on GNU compiler
  • Loading branch information
dalg24 committed Jan 30, 2023
2 parents 8103d82 + 910d43e commit 333157f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,15 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> {
std::enable_if_t<!std::is_same<typename Policy::schedule_type::type,
Kokkos::Dynamic>::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);
Expand Down

0 comments on commit 333157f

Please sign in to comment.