kokkos-utils
0.0.2
Loading...
Searching...
No Matches
EnqueuedEventTimer.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_UTILS_CALLBACKS_ENQUEUEDEVENTTIMER_HPP
2
#define KOKKOS_UTILS_CALLBACKS_ENQUEUEDEVENTTIMER_HPP
3
4
#include "
kokkos-utils/callbacks/Events.hpp
"
5
#include "
kokkos-utils/timer/Duration.hpp
"
6
#include "
kokkos-utils/timer/Timer.hpp
"
7
8
namespace
Kokkos::utils::callbacks
9
{
10
12
template
<Kokkos::ExecutionSpace Exec>
13
struct
EnqueuedEventTimer
14
{
16
template
<EnqueuedEvent EventType>
17
void
start
(
const
EventType& event)
18
{
19
if
(event.dev_id !=
dev_id
)
20
Kokkos::abort(
"EnqueuedEventTimer cannot be started for a wrongly enqueued event."
);
21
22
timer
.start(
exec
);
23
}
24
26
template
<Event EventType>
27
void
stop
(
const
EventType&) {
28
timer
.stop(
exec
);
29
}
30
31
template
<
typename
Duration = Kokkos::utils::timer::milliseconds>
32
Duration
duration
() {
return
timer
.template
duration<Duration>
(); }
33
34
Exec
exec
;
35
uint32_t
dev_id
= Kokkos::Tools::Experimental::device_id(
exec
);
36
Kokkos::utils::timer::Timer<Exec>
timer
{};
37
};
38
39
}
// namespace Kokkos::utils::callbacks
40
41
#endif
// KOKKOS_UTILS_CALLBACKS_ENQUEUEDEVENTTIMER_HPP
Duration.hpp
Events.hpp
Timer.hpp
Kokkos::utils::timer::Timer
Measure elapsed time between events.
Definition
Timer.hpp:18
Kokkos::utils::callbacks
Definition
BeginEndTimerListener.hpp:12
Kokkos::utils::callbacks::EnqueuedEventTimer
Timer for events that are enqueued on exec.
Definition
EnqueuedEventTimer.hpp:14
Kokkos::utils::callbacks::EnqueuedEventTimer::duration
Duration duration()
Definition
EnqueuedEventTimer.hpp:32
Kokkos::utils::callbacks::EnqueuedEventTimer::exec
Exec exec
Definition
EnqueuedEventTimer.hpp:34
Kokkos::utils::callbacks::EnqueuedEventTimer::stop
void stop(const EventType &)
Stop the timer.
Definition
EnqueuedEventTimer.hpp:27
Kokkos::utils::callbacks::EnqueuedEventTimer::start
void start(const EventType &event)
Start the timer. The event must be on exec.
Definition
EnqueuedEventTimer.hpp:17
Kokkos::utils::callbacks::EnqueuedEventTimer::timer
Kokkos::utils::timer::Timer< Exec > timer
Definition
EnqueuedEventTimer.hpp:36
Kokkos::utils::callbacks::EnqueuedEventTimer::dev_id
uint32_t dev_id
Definition
EnqueuedEventTimer.hpp:35
include
kokkos-utils
callbacks
EnqueuedEventTimer.hpp
Generated on Wed Jan 28 2026 05:49:34 for kokkos-utils by
1.13.2