1#ifndef KOKKOS_EXECUTION_IMPL_CUDA_EVENT_HPP
2#define KOKKOS_EXECUTION_IMPL_CUDA_EVENT_HPP
4#include "Kokkos_Core.hpp"
30 KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventDestroy(
m_event));
33 void record(
const Kokkos::Cuda& exec) {
35 KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventCreateWithFlags(&
m_event, cudaEventDisableTiming));
37 KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventRecord(
m_event, exec.cuda_stream()));
41 if (cudaEventQuery(
m_event) != cudaSuccess) {
42 KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventSynchronize(
m_event));
52template <Kokkos::ExecutionSpace... ExecFrom>
53requires(std::same_as<ExecFrom, Kokkos::Cuda> && ...)
55 auto do_impl_wait = [&exec](
const auto&
event) {
56 KOKKOS_EXPECTS(
bool(
event.cuda_event()));
57 KOKKOS_IMPL_CUDA_SAFE_CALL(cudaStreamWaitEvent(exec.cuda_stream(),
event.cuda_event()));
59 (do_impl_wait(events), ...);
Constrain an EventType type to be a valid event type for Exec execution space type.
static constexpr auto invalid_event_id
void impl_wait(const Kokkos::Cuda &exec, const Event< ExecFrom > &... events)
constexpr cudaEvent_t cuda_event() const noexcept
Event & operator=(const Event &)=delete
Event(Event &&) noexcept=delete
Event(const Event &)=delete
void record(const Kokkos::Cuda &exec)
An event that can be recorded on an execution space instance.
Determine if the Kokkos backend has non-blocking dispatch.