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
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 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);
45};
46
47} // namespace Kokkos::utils::callbacks
48
49#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.