25#include <Kokkos_Core.hpp>
33 using View = std::remove_cvref_t<
decltype(
view)>;
34 if constexpr (Kokkos::SpaceAccessibility<
35 Kokkos::DefaultHostExecutionSpace,
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));
50template <
class ExecutionSpace = Kokkos::DefaultHostExecutionSpace>
54 if (Kokkos::num_threads() > 1) {
55 Kokkos::RangePolicy<ExecutionSpace> policy(start, end);
56 Kokkos::parallel_for(name, policy, kernel);
#define ESPRESSO_ATTR_ALWAYS_INLINE
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
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.