1#ifndef KOKKOS_UTILS_CUDA_TIMER_EVENT_HPP
2#define KOKKOS_UTILS_CUDA_TIMER_EVENT_HPP
4#include "Kokkos_Core.hpp"
21 KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventDestroy(ptr));
28 static_assert(std::same_as<typename event_storage_t::pointer, impl_event_t>);
34 KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventCreate(&tmp));
39 void record(
const Kokkos::Cuda& exec) { KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventRecord(
event.get(), exec.cuda_stream())); }
41 template <
typename Duration = milliseconds>
43 return std::chrono::duration_cast<Duration>(std::chrono::duration<float, std::milli>(
elapsed(other)));
54 KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventSynchronize(other.
event.get()));
55 KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventSynchronize(
event.get()));
58 KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventElapsedTime(&elapsed_time,
event.get(), other.
event.get()));
To be used for the custom deleter of event.
void operator()(CUevent_st *ptr) const
float elapsed(Event &other)
Measure the elapsed time in milliseconds.
void record(const Kokkos::Cuda &exec)
Record this event in the execution space instance exec.
Duration duration(Event &other)
std::unique_ptr< CUevent_st, EventDeleter > event_storage_t