kokkos-utils
0.0.5
Toggle main menu visibility
Loading...
Searching...
No Matches
EventRegionMatcher.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_UTILS_CALLBACKS_EVENTREGIONMATCHER_HPP
2
#define KOKKOS_UTILS_CALLBACKS_EVENTREGIONMATCHER_HPP
3
4
#include "
kokkos-utils/callbacks/Events.hpp
"
5
#include "
kokkos-utils/callbacks/Matcher.hpp
"
6
7
namespace
Kokkos::utils::callbacks
8
{
9
21
template
<
typename
MatcherType,
bool
TrueOnBoundary = false>
requires
MatcherFor<MatcherType, PushRegionEvent>
22
struct
EventRegionMatcher
23
{
24
static
constexpr
uint32_t
invalid_nested_level
= Kokkos::Experimental::finite_max_v<uint32_t>;
25
27
bool
operator()
(
const
PushRegionEvent
& event)
28
{
29
if
(this->
matching
)
30
{
31
++this->
nested_level
;
32
return
! TrueOnBoundary;
33
}
34
else
if
(
matcher
(event))
35
{
36
this->
nested_level
= 1;
37
this->
matching
=
true
;
38
return
TrueOnBoundary;
39
}
40
41
return
TrueOnBoundary ? false : this->
matching
;
42
}
43
45
bool
operator()
(
const
PopRegionEvent
&)
46
{
47
if
(this->
matching
)
48
{
49
--this->
nested_level
;
50
51
if
(this->
nested_level
== 0)
52
{
53
this->
matching
=
false
;
54
return
TrueOnBoundary;
55
}
56
}
57
58
return
TrueOnBoundary ? false : this->
matching
;
59
}
60
61
template
<Event EventType>
62
bool
operator()
(
const
EventType&)
const
{
63
return
TrueOnBoundary ? false : this->
matching
;
64
}
65
67
#if defined(KOKKOS_ENABLE_CUDA) && (defined(KOKKOS_COMPILER_GNU) && KOKKOS_COMPILER_GNU == 1420) && (defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC == 1280)
68
MatcherType
matcher
;
69
#else
70
MatcherType
matcher
{};
71
#endif
72
bool
matching
=
false
;
73
uint32_t
nested_level
=
invalid_nested_level
;
74
};
75
76
}
// namespace Kokkos::utils::callbacks
77
78
#endif
// KOKKOS_UTILS_CALLBACKS_EVENTREGIONMATCHER_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::EventRegionMatcher
Matcher to select events that occur within a region.
Definition
EventRegionMatcher.hpp:23
Kokkos::utils::callbacks::EventRegionMatcher::operator()
bool operator()(const PushRegionEvent &event)
If the event matches matcher, matching is set to true.
Definition
EventRegionMatcher.hpp:27
Kokkos::utils::callbacks::EventRegionMatcher::operator()
bool operator()(const PopRegionEvent &)
Decrement nested_level if we are still matching.
Definition
EventRegionMatcher.hpp:45
Kokkos::utils::callbacks::EventRegionMatcher::operator()
bool operator()(const EventType &) const
Definition
EventRegionMatcher.hpp:62
Kokkos::utils::callbacks::EventRegionMatcher< MatcherType, true >::invalid_nested_level
static constexpr uint32_t invalid_nested_level
Definition
EventRegionMatcher.hpp:24
Kokkos::utils::callbacks::EventRegionMatcher< MatcherType, true >::nested_level
uint32_t nested_level
Definition
EventRegionMatcher.hpp:73
Kokkos::utils::callbacks::EventRegionMatcher< MatcherType, true >::matching
bool matching
Definition
EventRegionMatcher.hpp:72
Kokkos::utils::callbacks::EventRegionMatcher< MatcherType, true >::matcher
MatcherType matcher
Definition
EventRegionMatcher.hpp:70
Kokkos::utils::callbacks::PopRegionEvent
Pop-region event associated with Kokkos::Tools::Experimental::EventSet::pop_region.
Definition
Events.hpp:192
Kokkos::utils::callbacks::PushRegionEvent
Push-region event associated with Kokkos::Tools::Experimental::EventSet::push_region.
Definition
Events.hpp:184
include
kokkos-utils
callbacks
EventRegionMatcher.hpp
Generated on
for kokkos-utils by
1.18.0