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