20 #ifndef RAJA_pattern_launch_sequential_HPP
21 #define RAJA_pattern_launch_sequential_HPP
33 template<
typename BODY>
44 template<
typename BODY,
typename ReduceParams>
45 static concepts::enable_if_t<
46 resources::EventProxy<resources::Resource>,
48 exec(RAJA::resources::Resource res,
51 ReduceParams& launch_reducers)
53 constexpr
bool is_parampack_empty =
55 if constexpr (!is_parampack_empty)
67 ctx.shared_mem_ptr = kernel_local_mem;
69 if constexpr (!is_parampack_empty)
78 delete[] kernel_local_mem;
79 ctx.shared_mem_ptr =
nullptr;
80 if constexpr (!is_parampack_empty)
87 return resources::EventProxy<resources::Resource>(res);
91 template<
typename SEGMENT>
96 template<
typename BODY>
101 const int len = segment.end() - segment.begin();
102 for (
int i = 0; i < len; i++)
105 body(*(segment.begin() + i));
109 template<
typename LaunchContextPolicy,
typename BODY>
112 SEGMENT
const& segment,
116 const int len = segment.end() - segment.begin();
117 for (
int i = 0; i < len; i++)
119 body(*(segment.begin() + i));
123 template<
typename LaunchContextPolicy,
typename BODY>
126 SEGMENT
const& segment0,
127 SEGMENT
const& segment1,
132 const int len1 = segment1.end() - segment1.begin();
133 const int len0 = segment0.end() - segment0.begin();
135 for (
int j = 0; j < len1; j++)
137 for (
int i = 0; i < len0; i++)
140 body(*(segment0.begin() + i), *(segment1.begin() + j));
145 template<
typename LaunchContextPolicy,
typename BODY>
148 SEGMENT
const& segment0,
149 SEGMENT
const& segment1,
150 SEGMENT
const& segment2,
155 const int len2 = segment2.end() - segment2.begin();
156 const int len1 = segment1.end() - segment1.begin();
157 const int len0 = segment0.end() - segment0.begin();
159 for (
int k = 0; k < len2; k++)
161 for (
int j = 0; j < len1; j++)
163 for (
int i = 0; i < len0; i++)
165 body(*(segment0.begin() + i), *(segment1.begin() + j),
166 *(segment2.begin() + k));
173 template<
typename SEGMENT>
177 template<
typename LaunchContextPolicy,
typename BODY>
180 SEGMENT
const& segment,
183 const int len = segment.end() - segment.begin();
184 for (
int i = 0; i < len; i++)
186 body(*(segment.begin() + i), i);
190 template<
typename LaunchContextPolicy,
typename BODY>
193 SEGMENT
const& segment0,
194 SEGMENT
const& segment1,
199 const int len1 = segment1.end() - segment1.begin();
200 const int len0 = segment0.end() - segment0.begin();
202 for (
int j = 0; j < len1; j++)
204 for (
int i = 0; i < len0; i++)
207 body(*(segment0.begin() + i), *(segment1.begin() + j), i, j);
212 template<
typename LaunchContextPolicy,
typename BODY>
215 SEGMENT
const& segment0,
216 SEGMENT
const& segment1,
217 SEGMENT
const& segment2,
222 const int len2 = segment2.end() - segment2.begin();
223 const int len1 = segment1.end() - segment1.begin();
224 const int len0 = segment0.end() - segment0.begin();
226 for (
int k = 0; k < len2; k++)
228 for (
int j = 0; j < len1; j++)
230 for (
int i = 0; i < len0; i++)
232 body(*(segment0.begin() + i), *(segment1.begin() + j),
233 *(segment2.begin() + k), i, j, k);
242 template<
typename SEGMENT>
246 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
250 SEGMENT
const& segment,
254 const int len = segment.end() - segment.begin();
256 for (
int tx = 0; tx < len; tx += tile_size)
258 body(segment.slice(tx, tile_size));
263 template<
typename SEGMENT>
267 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
271 SEGMENT
const& segment,
275 const int len = segment.end() - segment.begin();
277 for (
int tx = 0, bx = 0; tx < len; tx += tile_size, bx++)
279 body(segment.slice(tx, tile_size), bx);
Definition: launch_core.hpp:246
Definition: launch_context_policy.hpp:30
RAJA header file containing the core components of RAJA::launch.
RAJA_HOST_DEVICE void RAJA_ABORT_OR_THROW(const char *str)
Definition: macros.hpp:143
#define RAJA_HOST_DEVICE
Definition: macros.hpp:65
#define RAJA_SUPPRESS_HD_WARN
Definition: macros.hpp:68
#define RAJA_UNUSED_ARG(x)
Definition: macros.hpp:97
constexpr RAJA_HOST_DEVICE auto invoke_body(Params &¶ms, Fn &&f, Ts &&... extra)
Definition: forall.hpp:598
Definition: AlignedRangeIndexSetBuilders.cpp:35
LaunchContextType ctx
Definition: launch.hpp:185
auto & body
Definition: launch.hpp:177
typename RAJA::detail::launch_context_type< BODY >::type LaunchContextType
Definition: launch.hpp:183
Header file containing RAJA sequential policy definitions.
static void exec(LaunchContext const &RAJA_UNUSED_ARG(ctx), BODY const &RAJA_UNUSED_ARG(body))
Definition: launch.hpp:34
static concepts::enable_if_t< resources::EventProxy< resources::Resource >, RAJA::expt::type_traits::is_ForallParamPack< ReduceParams > > exec(RAJA::resources::Resource res, LaunchParams const &launch_params, BODY const &body, ReduceParams &launch_reducers)
Definition: launch.hpp:48
Definition: launch_core.hpp:263
Definition: launch_core.hpp:163
size_t shared_mem_size
Definition: launch_core.hpp:167
static RAJA_INLINE RAJA_HOST_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const RAJA_UNUSED_ARG(&ctx), SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:110
static RAJA_INLINE RAJA_HOST_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const RAJA_UNUSED_ARG(&ctx), SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:124
static RAJA_INLINE RAJA_HOST_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const RAJA_UNUSED_ARG(&ctx), SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:146
static RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE void exec(SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:97
Definition: launch_core.hpp:480
static RAJA_INLINE RAJA_HOST_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const RAJA_UNUSED_ARG(&ctx), SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:178
static RAJA_INLINE RAJA_HOST_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const RAJA_UNUSED_ARG(&ctx), SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:191
static RAJA_INLINE RAJA_HOST_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const RAJA_UNUSED_ARG(&ctx), SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:213
Definition: launch_core.hpp:483
static RAJA_HOST_DEVICE RAJA_INLINE void exec(LaunchContextT< LaunchContextPolicy > const RAJA_UNUSED_ARG(&ctx), TILE_T tile_size, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:247
Definition: launch_core.hpp:579
static RAJA_HOST_DEVICE RAJA_INLINE void exec(LaunchContextT< LaunchContextPolicy > const RAJA_UNUSED_ARG(&ctx), TILE_T tile_size, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:268
Definition: launch_core.hpp:582
static constexpr void parampack_resolve(EXEC_POL const &pol, ForallParamPack< Params... > &f_params, Args &&... args)
Definition: forall.hpp:304
static constexpr void parampack_init(EXEC_POL const &pol, ForallParamPack< Params... > &f_params, Args &&... args)
Definition: forall.hpp:269
Definition: TypeTraits.hpp:67
Definition: TypeTraits.hpp:59
Definition: launch_core.hpp:65
Definition: policy.hpp:78
Definition: policy.hpp:72