Skip to content

Commit

Permalink
OpenMP: No memset in viewfill (kokkos#6573)
Browse files Browse the repository at this point in the history
* OpenMP: Edit copyview implementation.

* OpenMP: Use memset for Serial backend.

* Update core/src/Kokkos_CopyViews.hpp

OpenMP: do not use memset for 0's only if execution space is OpenMP

Co-authored-by: Daniel Arndt <arndtd@ornl.gov>

* Fix incorrect code.

---------

Co-authored-by: Rahulkumar Gayatri <rgayatri@lbl.gov>
Co-authored-by: Daniel Arndt <arndtd@ornl.gov>
  • Loading branch information
3 people committed Nov 9, 2023
1 parent 0a83695 commit 3f773d0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/src/Kokkos_CopyViews.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1348,13 +1348,14 @@ inline std::enable_if_t<
contiguous_fill_or_memset(
const ExecutionSpace& exec_space, const View<DT, DP...>& dst,
typename ViewTraits<DT, DP...>::const_value_type& value) {
// On A64FX memset seems to do the wrong thing with regards to first touch
// leading to the significant performance issues
#ifndef KOKKOS_ARCH_A64FX
if (Impl::is_zero_byte(value))
// With OpenMP, using memset has significant performance issues.
if (Impl::is_zero_byte(value)
#ifdef KOKKOS_ENABLE_OPENMP
&& !std::is_same_v<ExecutionSpace, Kokkos::OpenMP>
#endif
)
ZeroMemset<ExecutionSpace, View<DT, DP...>>(exec_space, dst, value);
else
#endif
contiguous_fill(exec_space, dst, value);
}

Expand Down

0 comments on commit 3f773d0

Please sign in to comment.