kokkos-utils
0.0.5
Toggle main menu visibility
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
6
namespace
Kokkos::utils::timer
7
{
8
28
template
<
typename
T>
29
requires
Kokkos::ExecutionSpace<T> || std::is_void_v<T>
30
struct
Event
31
{
33
using
impl_clock_t
= std::conditional_t<
34
std::chrono::high_resolution_clock::is_steady,
35
std::chrono::high_resolution_clock,
36
std::chrono::steady_clock
37
>;
38
39
using
impl_event_t
=
typename
impl_clock_t::time_point;
40
41
impl_event_t
event
;
42
44
template
<
typename
U = T>
45
requires
std::is_void_v<U>
46
void
record
() {
47
event
= std::chrono::steady_clock::now();
48
}
49
50
template
<
typename
Exec = T>
51
requires
Kokkos::ExecutionSpace<Exec>
52
void
record
(
const
Exec&) {
53
event
= std::chrono::steady_clock::now();
54
}
55
57
template
<
typename
Duration>
58
Duration
duration
(
const
Event
& other)
const
{
59
return
std::chrono::duration_cast<Duration>(other.
event
-
event
);
60
}
61
};
62
63
}
// namespace Kokkos::utils::timer
64
65
#ifdef KOKKOS_ENABLE_CUDA
66
#include "
kokkos-utils/timer/Cuda/Event.hpp
"
67
#endif
// KOKKOS_ENABLE_CUDA
68
69
#ifdef KOKKOS_ENABLE_HIP
70
#include "
kokkos-utils/timer/HIP/Event.hpp
"
71
#endif
// KOKKOS_ENABLE_HIP
72
73
#endif
// KOKKOS_UTILS_TIMER_EVENT_HPP
Event.hpp
Event.hpp
Kokkos::utils::timer
Definition
Duration.hpp:7
Kokkos::utils::timer::Event
Event.
Definition
Event.hpp:31
Kokkos::utils::timer::Event::record
void record(const Exec &)
Definition
Event.hpp:52
Kokkos::utils::timer::Event::impl_event_t
typename impl_clock_t::time_point impl_event_t
Definition
Event.hpp:39
Kokkos::utils::timer::Event::record
void record()
Record this event.
Definition
Event.hpp:46
Kokkos::utils::timer::Event::event
impl_event_t event
Definition
Event.hpp:41
Kokkos::utils::timer::Event::impl_clock_t
std::conditional_t< std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock > impl_clock_t
Let's choose a steady clock.
Definition
Event.hpp:33
Kokkos::utils::timer::Event::duration
Duration duration(const Event &other) const
Get a Duration object between this event and other.
Definition
Event.hpp:58
include
kokkos-utils
timer
Event.hpp
Generated on
for kokkos-utils by
1.18.0