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