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
7
9{
10
12template <Kokkos::ExecutionSpace Exec>
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);
37};
38
39} // namespace Kokkos::utils::callbacks
40
41#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