kokkos-utils 0.0.2
 
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
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 timer_launch.start();
24 }
25
27 template <Event EventType>
28 void stop(const EventType&)
29 {
30 timer_launch.stop();
31 timer.stop(exec);
32 }
33
34 template <typename Duration = Kokkos::utils::timer::milliseconds>
35 Duration duration() { return timer.template duration<Duration>(); }
36
37 template <typename Duration = Kokkos::utils::timer::milliseconds>
38 Duration launch() { return timer_launch.template duration<Duration>(); }
39
40 Exec exec;
41 uint32_t dev_id = Kokkos::Tools::Experimental::device_id(exec);
44};
45
46} // namespace Kokkos::utils::callbacks
47
48#endif // KOKKOS_UTILS_CALLBACKS_ENQUEUEDEVENTWITHLAUNCHTIMER_HPP
Measure elapsed time between events.
Definition Timer.hpp:18
Timer for events that are enqueued on exec. This timer also measures the launch time.
void start(const EventType &event)
Start the timer. The event must be on exec.