kokkos-utils 0.0.1
 
Loading...
Searching...
No Matches
Event.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_UTILS_TIMER_EVENT_HPP
2#define KOKKOS_UTILS_TIMER_EVENT_HPP
3
4#include <chrono>
5
7
9{
10
27template <Kokkos::utils::concepts::ExecutionSpace Exec>
28struct Event
29{
30 using impl_event_t = std::chrono::steady_clock::time_point;
31
33
35 void record(const Exec& /* exec */) {
36 event = std::chrono::steady_clock::now();
37 }
38
40 template <typename Duration>
41 Duration duration(const Event& other) const {
42 return std::chrono::duration_cast<Duration>(other.event - event);
43 }
44};
45
46} // namespace Kokkos::utils::timer
47
48#ifdef KOKKOS_ENABLE_CUDA
50#endif // KOKKOS_ENABLE_CUDA
51
52#ifdef KOKKOS_ENABLE_HIP
54#endif // KOKKOS_ENABLE_HIP
55
56#endif // KOKKOS_UTILS_TIMER_EVENT_HPP
void record(const Exec &)
Record this event in the execution space exec.
Definition Event.hpp:35
Duration duration(const Event &other) const
Get a Duration object between this event and other.
Definition Event.hpp:41
std::chrono::steady_clock::time_point impl_event_t
Definition Event.hpp:30