kokkos-utils 0.0.1
 
Loading...
Searching...
No Matches
EventBeginEndEventIdMatcher.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_UTILS_CALLBACKS_EVENTBEGINENDEVENTIDMATCHER_HPP
2#define KOKKOS_UTILS_CALLBACKS_EVENTBEGINENDEVENTIDMATCHER_HPP
3
6
8{
9
15template <Matcher MatcherBeginEventType, BeginEvent BeginEventType, EndEvent EndEventType> requires MatcherFor<MatcherBeginEventType, BeginEventType>
17{
18 static constexpr auto invalid_event_id = Kokkos::Experimental::finite_max_v<uint64_t>;
19
20 bool operator()(const BeginEventType& event)
21 {
22 if(matcher(event))
23 {
24 if (event_id != invalid_event_id) Kokkos::abort("EventBeginEndEventIdMatcher cannot match a begin event twice.");
25 event_id = event.event_id;
26 return true;
27 }
28 return false;
29 }
30
31 bool operator()(const EndEventType& event) const {
32 return event.event_id == event_id;
33 }
34
35 MatcherBeginEventType matcher;
37};
38
39} // namespace Kokkos::utils::callbacks
40
41#endif // KOKKOS_UTILS_CALLBACKS_EVENTBEGINENDEVENTIDMATCHER_HPP
Check that Callable is a matcher for each event in EventTypes.
Definition Matcher.hpp:35
Match a begin event and its corresponding end event based on their event ID.