kokkos-utils 0.0.1
 
Loading...
Searching...
No Matches
EventInProfileSectionMatcher.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_UTILS_CALLBACKS_EVENTINPROFILESECTIONMATCHER_HPP
2#define KOKKOS_UTILS_CALLBACKS_EVENTINPROFILESECTIONMATCHER_HPP
3
4#include "Kokkos_NumericTraits.hpp"
5
8
10{
11
17template <typename MatcherType> requires MatcherFor<MatcherType, CreateProfileSectionEvent>
19{
20 static constexpr uint32_t invalid_section_id = Kokkos::Experimental::finite_max_v<uint32_t>;
21
23 {
24 if (matcher(event))
25 {
26 if (section_id != invalid_section_id) Kokkos::abort("EventInProfileSectionMatcher cannot match a create event twice.");
27 section_id = event.section_id;
28 }
29 return false;
30 }
31
33 {
34 if (event.section_id == section_id) recording = true;
35 return false;
36 }
37
39 {
40 if (event.section_id == section_id) recording = false;
41 return false;
42 }
43
44 template <Event EventType>
45 bool operator()(const EventType& /* event */) const {
46 return recording;
47 }
48
49 MatcherType matcher {};
51 bool recording = false;
52};
53
54} // namespace Kokkos::utils::callbacks
55
56#endif // KOKKOS_UTILS_CALLBACKS_EVENTINPROFILESECTIONMATCHER_HPP
Check that Callable is a matcher for each event in EventTypes.
Definition Matcher.hpp:35
Create-profile-section event associated with Kokkos::Tools::Experimental::EventSet::create_profile_se...
Definition Events.hpp:144
Matcher to select events that occur within a profile section.
Start-profile-section event associated with Kokkos::Tools::Experimental::EventSet::start_profile_sect...
Definition Events.hpp:153
Stop-profile-section event associated with Kokkos::Tools::Experimental::EventSet::stop_profile_sectio...
Definition Events.hpp:161