kokkos-utils
0.0.5
Toggle main menu visibility
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
6
#include "
kokkos-utils/callbacks/Events.hpp
"
7
#include "
kokkos-utils/callbacks/Matcher.hpp
"
8
9
namespace
Kokkos::utils::callbacks
10
{
11
17
template
<
typename
MatcherType>
requires
MatcherFor<MatcherType, CreateProfileSectionEvent>
18
struct
EventInProfileSectionMatcher
19
{
20
static
constexpr
uint32_t
invalid_section_id
= Kokkos::Experimental::finite_max_v<uint32_t>;
21
22
bool
operator()
(
const
CreateProfileSectionEvent
& event)
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
32
bool
operator()
(
const
StartProfileSectionEvent
& event)
33
{
34
if
(event.
section_id
==
section_id
)
recording
=
true
;
35
return
false
;
36
}
37
38
bool
operator()
(
const
StopProfileSectionEvent
& event)
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
{};
50
uint32_t
section_id
=
invalid_section_id
;
51
bool
recording
=
false
;
52
};
53
54
}
// namespace Kokkos::utils::callbacks
55
56
#endif
// KOKKOS_UTILS_CALLBACKS_EVENTINPROFILESECTIONMATCHER_HPP
Events.hpp
Matcher.hpp
Kokkos::utils::callbacks::MatcherFor
Check that Callable is a matcher for each event in EventTypes.
Definition
Matcher.hpp:35
Kokkos::utils::callbacks
Definition
BeginEndTimerListener.hpp:12
Kokkos::utils::callbacks::CreateProfileSectionEvent
Create-profile-section event associated with Kokkos::Tools::Experimental::EventSet::create_profile_se...
Definition
Events.hpp:151
Kokkos::utils::callbacks::EventInProfileSectionMatcher
Matcher to select events that occur within a profile section.
Definition
EventInProfileSectionMatcher.hpp:19
Kokkos::utils::callbacks::EventInProfileSectionMatcher::invalid_section_id
static constexpr uint32_t invalid_section_id
Definition
EventInProfileSectionMatcher.hpp:20
Kokkos::utils::callbacks::EventInProfileSectionMatcher::operator()
bool operator()(const StopProfileSectionEvent &event)
Definition
EventInProfileSectionMatcher.hpp:38
Kokkos::utils::callbacks::EventInProfileSectionMatcher::operator()
bool operator()(const CreateProfileSectionEvent &event)
Definition
EventInProfileSectionMatcher.hpp:22
Kokkos::utils::callbacks::EventInProfileSectionMatcher::operator()
bool operator()(const StartProfileSectionEvent &event)
Definition
EventInProfileSectionMatcher.hpp:32
Kokkos::utils::callbacks::EventInProfileSectionMatcher::recording
bool recording
Definition
EventInProfileSectionMatcher.hpp:51
Kokkos::utils::callbacks::EventInProfileSectionMatcher::section_id
uint32_t section_id
Definition
EventInProfileSectionMatcher.hpp:50
Kokkos::utils::callbacks::EventInProfileSectionMatcher::operator()
bool operator()(const EventType &) const
Definition
EventInProfileSectionMatcher.hpp:45
Kokkos::utils::callbacks::EventInProfileSectionMatcher::matcher
MatcherType matcher
Definition
EventInProfileSectionMatcher.hpp:49
Kokkos::utils::callbacks::StartProfileSectionEvent
Start-profile-section event associated with Kokkos::Tools::Experimental::EventSet::start_profile_sect...
Definition
Events.hpp:160
Kokkos::utils::callbacks::StartProfileSectionEvent::section_id
uint32_t section_id
Definition
Events.hpp:161
Kokkos::utils::callbacks::StopProfileSectionEvent
Stop-profile-section event associated with Kokkos::Tools::Experimental::EventSet::stop_profile_sectio...
Definition
Events.hpp:168
Kokkos::utils::callbacks::StopProfileSectionEvent::section_id
uint32_t section_id
Definition
Events.hpp:169
include
kokkos-utils
callbacks
EventInProfileSectionMatcher.hpp
Generated on
for kokkos-utils by
1.18.0