Skip to content

Commit

Permalink
OpenMP: Adding an ifdef around chunksize for static schedule for GCC …
Browse files Browse the repository at this point in the history
…compiler.
  • Loading branch information
Rahulkumar Gayatri committed Jan 17, 2023
1 parent 728e3d3 commit 910d43e
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 910d43e

Please sign in to comment.