33 using View = std::remove_cvref_t<
decltype(view)>;
34 if constexpr (Kokkos::SpaceAccessibility<
35 Kokkos::DefaultHostExecutionSpace,
36 typename View::memory_space>::accessible) {
37 if (Kokkos::num_threads() == 1 and view.span_is_contiguous()) {
38 std::fill_n(view.data(), view.span(),
39 static_cast<typename View::value_type
>(value));
43 Kokkos::deep_copy(exec_space, view, value);
54 if (Kokkos::num_threads() > 1) {
55 Kokkos::RangePolicy<ExecutionSpace> policy(start, end);
56 Kokkos::parallel_for(name, policy, kernel);
58 for (
auto p_index = start; p_index < end; ++p_index) {
ESPRESSO_ATTR_ALWAYS_INLINE void kokkos_parallel_range_for(auto const &name, auto start, auto end, auto const &kernel)
Wrapper for Kokkos::parallel_for that skips fork/join when the number of threads is 1.
ESPRESSO_ATTR_ALWAYS_INLINE void kokkos_deep_copy(auto const &exec_space, auto const &view, auto const &value)
Wrapper for Kokkos::deep_copy that skips fork/join when the number of threads is 1.