kokkos-utils 0.0.1
 
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
8
10{
11
13template <Kokkos::utils::concepts::ExecutionSpace Exec>
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 }
25
27 template <Event EventType>
28 void stop(const EventType&) {
29 timer.stop(exec);
30 }
31
32 template <typename Duration = Kokkos::utils::timer::milliseconds>
33 Duration duration() { return timer.template duration<Duration>(); }
34
35 Exec exec;
36 uint32_t dev_id = Kokkos::Tools::Experimental::device_id(exec);
38};
39
40} // namespace Kokkos::utils::callbacks
41
42#endif // KOKKOS_UTILS_CALLBACKS_ENQUEUEDEVENTTIMER_HPP
Measure elapsed time between events.
Definition Timer.hpp:18
Timer for events that are enqueued on exec.
void stop(const EventType &)
Stop the timer.
void start(const EventType &event)
Start the timer. The event must be on exec.
Kokkos::utils::timer::Timer< Exec > timer