kokkos-utils
0.0.5
Toggle main menu visibility
Loading...
Searching...
No Matches
Listener.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_UTILS_CALLBACKS_LISTENER_HPP
2
#define KOKKOS_UTILS_CALLBACKS_LISTENER_HPP
3
4
#include "
kokkos-utils/callbacks/Events.hpp
"
5
6
namespace
Kokkos::utils::callbacks
7
{
8
9
namespace
impl
10
{
11
17
template
<
typename
Callable>
18
struct
IsListenerFor
19
{
20
template
<Event EventType>
21
using
type
= std::is_invocable_r<void, Callable, const EventType&>;
22
};
23
24
template
<
typename
T>
25
concept
has_event_type_list
=
requires
{
typename
T::event_type_list_t; };
26
27
template
<
typename
Callable>
28
struct
ListenerEventTypeList
29
{
30
using
type
= Kokkos::Impl::filter_type_list_t<
31
impl::IsListenerFor<Callable>::template
type
,
EventTypeList
>;
32
};
33
34
template
<has_event_type_list Callable>
35
struct
ListenerEventTypeList
<Callable>
36
{
37
using
type
=
typename
Callable::event_type_list_t;
38
};
39
44
template
<
typename
Callable>
45
concept
ImplicitListener
=
Kokkos::utils::impl::type_list_any_v<impl::IsListenerFor<Callable>::template
type,
EventTypeList
>;
46
51
template
<
typename
Callable>
52
concept
ExplicitListener
=
has_event_type_list<Callable>
&&
53
Kokkos::utils::impl::type_list_all_v
<
54
impl::IsListenerFor<Callable>::template
type,
55
typename
Callable::event_type_list_t
56
>;
57
}
// namespace impl
58
63
template
<
typename
Callable>
64
concept
Listener
=
impl::ExplicitListener<Callable>
||
impl::ImplicitListener<Callable>
;
65
67
template
<
typename
Callable,
typename
... EventTypes>
68
concept
ListenerFor
=
Kokkos::utils::impl::type_list_all_v<impl::IsListenerFor<Callable>::template
type, EventTypes...>;
69
71
template
<
typename
Callable>
72
using
listener_event_type_list_t
=
typename
impl::ListenerEventTypeList<Callable>::type
;
73
74
}
// namespace Kokkos::utils::callbacks
75
76
#endif
// KOKKOS_UTILS_CALLBACKS_LISTENER_HPP
Events.hpp
Kokkos::utils::callbacks::ListenerFor
Check that Callable is a listener for each event in EventTypes.
Definition
Listener.hpp:68
Kokkos::utils::callbacks::Listener
Definition
Listener.hpp:64
Kokkos::utils::callbacks::impl::ExplicitListener
Definition
Listener.hpp:52
Kokkos::utils::callbacks::impl::ImplicitListener
Definition
Listener.hpp:45
Kokkos::utils::callbacks::impl::has_event_type_list
Definition
Listener.hpp:25
Kokkos::utils::callbacks::impl
Definition
Helpers.hpp:68
Kokkos::utils::callbacks
Definition
BeginEndTimerListener.hpp:12
Kokkos::utils::callbacks::listener_event_type_list_t
typename impl::ListenerEventTypeList< Callable >::type listener_event_type_list_t
Type list holding the event types that Callable can be a listener for.
Definition
Listener.hpp:72
Kokkos::utils::callbacks::EventTypeList
Kokkos::Impl::type_list< BeginParallelForEvent, EndParallelForEvent, BeginParallelReduceEvent, EndParallelReduceEvent, BeginParallelScanEvent, EndParallelScanEvent, BeginFenceEvent, EndFenceEvent, AllocateDataEvent, DeallocateDataEvent, BeginDeepCopyEvent, EndDeepCopyEvent, CreateProfileSectionEvent, DestroyProfileSectionEvent, StartProfileSectionEvent, StopProfileSectionEvent, PushRegionEvent, PopRegionEvent, ProfileEvent > EventTypeList
Type list holding all event types.
Definition
Events.hpp:206
Kokkos::utils::impl::type_list_all_v
constexpr bool type_list_all_v
Definition
type_list.hpp:158
Kokkos::utils::impl::type_list_any_v
constexpr bool type_list_any_v
Definition
type_list.hpp:208
Kokkos::utils::callbacks::impl::IsListenerFor
Definition
Listener.hpp:19
Kokkos::utils::callbacks::impl::IsListenerFor::type
std::is_invocable_r< void, Callable, const EventType & > type
Definition
Listener.hpp:21
Kokkos::utils::callbacks::impl::ListenerEventTypeList< Callable >::type
typename Callable::event_type_list_t type
Definition
Listener.hpp:37
Kokkos::utils::callbacks::impl::ListenerEventTypeList
Definition
Listener.hpp:29
Kokkos::utils::callbacks::impl::ListenerEventTypeList::type
Kokkos::Impl::filter_type_list_t< impl::IsListenerFor< Callable >::template type, EventTypeList > type
Definition
Listener.hpp:30
include
kokkos-utils
callbacks
Listener.hpp
Generated on
for kokkos-utils by
1.18.0