20 #ifndef RAJA_PATTERN_WORKGROUP_WorkRunner_HPP
21 #define RAJA_PATTERN_WORKGROUP_WorkRunner_HPP
23 #include "RAJA/config.hpp"
26 #include <type_traits>
44 template<
typename LoopBody,
typename... Args>
49 template<
typename body_in,
50 typename =
typename std::enable_if<
51 std::is_same<LoopBody, camp::decay<body_in>>::value>::type>
66 template<
typename LoopBody,
typename index_type,
typename... Args>
74 invoke(i, camp::make_idx_seq_t<
sizeof...(Args)> {});
77 template<camp::idx_t... Is>
78 RAJA_INLINE
void invoke(index_type i, camp::idx_seq<Is...>)
const
88 template<
typename LoopBody,
typename index_type,
typename... Args>
96 invoke(i, camp::make_idx_seq_t<
sizeof...(Args)> {});
99 template<camp::idx_t... Is>
109 template<
typename ExecutionPolicy,
110 typename Segment_type,
122 template<
typename segment_in,
typename body_in>
124 : m_segment(
std::forward<segment_in>(segment)),
125 m_body(
std::forward<body_in>(
body))
135 Segment_type m_segment;
143 template<
typename EXEC_POLICY_T,
144 typename ORDER_POLICY_T,
145 typename DISPATCH_POLICY_T,
146 typename ALLOCATOR_T,
154 template<
typename FORALL_EXEC_POLICY,
155 typename EXEC_POLICY_T,
156 typename ORDER_POLICY_T,
157 typename DISPATCH_POLICY_T,
158 typename ALLOCATOR_T,
179 typename camp::at<T, camp::num<0>>
::type,
180 typename camp::at<T, camp::num<1>>
::type,
216 template<
typename WorkContainer,
typename segment_T,
typename loop_T>
217 inline void enqueue(WorkContainer& storage, segment_T&& seg, loop_T&&
loop)
222 storage.template emplace<holder>(
224 std::forward<segment_T>(seg), std::forward<loop_T>(
loop));
237 template<
typename FORALL_EXEC_POLICY,
238 typename EXEC_POLICY_T,
239 typename ORDER_POLICY_T,
240 typename DISPATCH_POLICY_T,
241 typename ALLOCATOR_T,
263 template<
typename WorkContainer>
268 using value_type =
typename WorkContainer::value_type;
272 auto end = storage.end();
275 value_type::host_call(&*
iter, r,
args...);
285 template<
typename FORALL_EXEC_POLICY,
286 typename EXEC_POLICY_T,
287 typename ORDER_POLICY_T,
288 typename DISPATCH_POLICY_T,
289 typename ALLOCATOR_T,
312 template<
typename WorkContainer>
317 using value_type =
typename WorkContainer::value_type;
321 auto begin = storage.begin();
324 value_type::host_call(&*(
iter - 1), r,
args...);
#define RAJA_DEVICE
Definition: macros.hpp:66
Args args
Definition: WorkRunner.hpp:212
value_type::device_call &[i_loop] iter
Definition: WorkRunner.hpp:216
typename dispatcher_transform_types< dispatch_policy, holder_type >::type dispatcher_transform_types_t
Definition: Dispatcher.hpp:72
RAJA_INLINE concepts::enable_if_t< RAJA::resources::EventProxy< Res >, concepts::negate< type_traits::is_indexset_policy< ExecutionPolicy > >, type_traits::is_range< Container > > forall(Res r, ExecutionPolicy &&p, Container &&c, LoopBody &&loop_body, ForallParams &&f_params)
Generic dispatch over containers with a value-based policy.
Definition: forall.hpp:186
Definition: AlignedRangeIndexSetBuilders.cpp:35
RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE RAJA_INLINE void loop(CONTEXT const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch_core.hpp:490
auto & body
Definition: launch.hpp:177
Definition: ListSegment.hpp:416
Header file providing RAJA Dispatcher for workgroup.
Header file containing RAJA index set and segment iteration template methods that take an execution p...
RAJA wrapper for "multi-policy" and dynamic policy selection.
Header file containing RAJA sequential policy definitions.
Definition: Dispatcher.hpp:85
Definition: WorkRunner.hpp:46
camp::tuple< Args... > m_arg_tuple
Definition: WorkRunner.hpp:59
LoopBody m_body
Definition: WorkRunner.hpp:58
HoldBodyArgs_base(body_in &&body, Args... args)
Definition: WorkRunner.hpp:52
Definition: WorkRunner.hpp:90
RAJA_DEVICE RAJA_INLINE void invoke(index_type i, camp::idx_seq< Is... >) const
Definition: WorkRunner.hpp:100
RAJA_DEVICE RAJA_INLINE void operator()(index_type i) const
Definition: WorkRunner.hpp:94
Definition: WorkRunner.hpp:68
RAJA_INLINE void operator()(index_type i) const
Definition: WorkRunner.hpp:72
RAJA_INLINE void invoke(index_type i, camp::idx_seq< Is... >) const
Definition: WorkRunner.hpp:78
Definition: WorkRunner.hpp:115
RAJA_INLINE void operator()(resource_type r, Args... args) const
Definition: WorkRunner.hpp:128
HoldForall(segment_in &&segment, body_in &&body)
Definition: WorkRunner.hpp:123
typename resources::get_resource< ExecutionPolicy >::type resource_type
Definition: WorkRunner.hpp:116
typename std::conditional< !type_traits::is_device_exec_policy< ExecutionPolicy >::value, HoldBodyArgs_host< LoopBody, index_type, Args... >, HoldBodyArgs_device< LoopBody, index_type, Args... > >::type HoldBodyArgs
Definition: WorkRunner.hpp:120
Definition: WorkRunner.hpp:175
HoldForall< forall_exec_policy, typename camp::at< T, camp::num< 0 > >::type, typename camp::at< T, camp::num< 1 > >::type, index_type, Args... > type
Definition: WorkRunner.hpp:182
Definition: WorkRunner.hpp:162
WorkRunnerForallOrdered_base & operator=(WorkRunnerForallOrdered_base const &)=delete
typename resources::get_resource< FORALL_EXEC_POLICY >::type resource_type
Definition: WorkRunner.hpp:169
ORDER_POLICY_T order_policy
Definition: WorkRunner.hpp:164
WorkRunnerForallOrdered_base(WorkRunnerForallOrdered_base const &)=delete
DISPATCH_POLICY_T dispatch_policy
Definition: WorkRunner.hpp:165
INDEX_T index_type
Definition: WorkRunner.hpp:167
EXEC_POLICY_T exec_policy
Definition: WorkRunner.hpp:163
typename holder_type::template type< T > holder_type_t
Definition: WorkRunner.hpp:187
void enqueue(WorkContainer &storage, segment_T &&seg, loop_T &&loop)
Definition: WorkRunner.hpp:217
WorkRunnerForallOrdered_base & operator=(WorkRunnerForallOrdered_base &&)=default
WorkRunnerForallOrdered_base()=default
WorkRunnerForallOrdered_base(WorkRunnerForallOrdered_base &&)=default
int per_run_storage
Definition: WorkRunner.hpp:231
FORALL_EXEC_POLICY forall_exec_policy
Definition: WorkRunner.hpp:171
dispatcher_transform_types_t< dispatch_policy, holder_type > dispatcher_holder_policy
Definition: WorkRunner.hpp:196
ALLOCATOR_T Allocator
Definition: WorkRunner.hpp:166
void clear()
Definition: WorkRunner.hpp:228
Definition: WorkRunner.hpp:252
base::per_run_storage run(WorkContainer const &storage, typename base::resource_type r, Args... args) const
Definition: WorkRunner.hpp:264
Definition: WorkRunner.hpp:300
base::per_run_storage run(WorkContainer const &storage, typename base::resource_type r, Args... args) const
Definition: WorkRunner.hpp:313
Definition: WorkRunner.hpp:149
Definition: policy.hpp:92
camp::resources::Host type
Definition: resource.hpp:49
Definition: PolicyBase.hpp:237