10 #ifndef RAJA_forall_param_openmp_HPP
11 #define RAJA_forall_param_openmp_HPP
28 template<
typename ExecPol,
32 RAJA_INLINE concepts::enable_if<std::is_same<ExecPol, RAJA::policy::omp::Auto>>
36 ForallParam&& f_params)
38 using EXEC_POL = camp::decay<decltype(p)>;
41 RAJA_OMP_DECLARE_REDUCTION_COMBINE;
50 #pragma omp for reduction(combine : f_params)
51 for (decltype(distance_it) i = 0; i < distance_it; ++i)
63 template<
template<
int>
class ExecPol,
68 RAJA_INLINE concepts::enable_if<
73 ForallParam&& f_params)
75 using EXEC_POL = camp::decay<decltype(p)>;
78 RAJA_OMP_DECLARE_REDUCTION_COMBINE;
87 if constexpr (ChunkSize > 0)
89 #pragma omp for schedule(static, ChunkSize) reduction(combine : f_params)
90 for (decltype(distance_it) i = 0; i < distance_it; ++i)
97 #pragma omp for schedule(static) reduction(combine : f_params)
98 for (decltype(distance_it) i = 0; i < distance_it; ++i)
111 template<
typename Iterable,
typename Func,
typename ForallParam>
112 RAJA_INLINE
void forall_impl(const ::RAJA::policy::omp::Runtime& p,
115 ForallParam&& f_params)
117 using EXEC_POL = camp::decay<decltype(p)>;
120 RAJA_OMP_DECLARE_REDUCTION_COMBINE;
129 #pragma omp for schedule(runtime) reduction(combine : f_params)
130 for (decltype(distance_it) i = 0; i < distance_it; ++i)
142 template<
typename Iterable,
typename Func,
typename ForallParam>
146 ForallParam&& f_params)
148 using EXEC_POL = camp::decay<decltype(p)>;
151 RAJA_OMP_DECLARE_REDUCTION_COMBINE;
160 #pragma omp for nowait reduction(combine : f_params)
161 for (decltype(distance_it) i = 0; i < distance_it; ++i)
173 template<
typename Iterable,
typename Func,
int ChunkSize,
typename ForallParam>
174 RAJA_INLINE
void forall_impl(const ::RAJA::policy::omp::Dynamic<ChunkSize>& p,
177 ForallParam&& f_params)
179 using EXEC_POL = camp::decay<decltype(p)>;
182 RAJA_OMP_DECLARE_REDUCTION_COMBINE;
190 if constexpr (ChunkSize > 0)
192 #pragma omp for schedule(dynamic, ChunkSize) reduction(combine : f_params)
193 for (decltype(distance_it) i = 0; i < distance_it; ++i)
200 #pragma omp for schedule(dynamic) reduction(combine : f_params)
201 for (decltype(distance_it) i = 0; i < distance_it; ++i)
215 template<
typename Iterable,
typename Func,
int ChunkSize,
typename ForallParam>
216 RAJA_INLINE
void forall_impl(const ::RAJA::policy::omp::Guided<ChunkSize>& p,
219 ForallParam&& f_params)
221 using EXEC_POL = camp::decay<decltype(p)>;
224 RAJA_OMP_DECLARE_REDUCTION_COMBINE;
232 if constexpr (ChunkSize <= 0)
234 #pragma omp for schedule(guided) reduction(combine : f_params)
235 for (decltype(distance_it) i = 0; i < distance_it; ++i)
242 #pragma omp for schedule(guided, ChunkSize) reduction(combine : f_params)
243 for (decltype(distance_it) i = 0; i < distance_it; ++i)
256 template<
typename Iterable,
typename Func,
int ChunkSize,
typename ForallParam>
258 const ::RAJA::policy::omp::Static<ChunkSize>& p,
261 ForallParam&& f_params)
263 using EXEC_POL = camp::decay<decltype(p)>;
266 RAJA_OMP_DECLARE_REDUCTION_COMBINE;
274 if constexpr (ChunkSize <= 0)
276 #pragma omp for schedule(static) nowait reduction(combine : f_params)
277 for (decltype(distance_it) i = 0; i < distance_it; ++i)
284 #pragma omp for schedule(static, ChunkSize) nowait reduction(combine : f_params)
285 for (decltype(distance_it) i = 0; i < distance_it; ++i)
295 template<
typename Schedule,
298 typename ForallParam>
300 resources::Host host_res,
304 ForallParam f_params)
307 std::forward<Func>(loop_body),
308 std::forward<ForallParam>(f_params));
309 return resources::EventProxy<resources::Host>(host_res);
316 template<
typename Iterable,
318 typename InnerPolicy,
319 typename ForallParam>
320 RAJA_INLINE concepts::enable_if_t<
321 resources::EventProxy<resources::Host>,
329 ForallParam f_params)
332 return resources::EventProxy<resources::Host>(host_res);
value_type::device_call &[i_loop] iter
Definition: WorkRunner.hpp:216
constexpr RAJA_HOST_DEVICE auto invoke_body(Params &¶ms, Fn &&f, Ts &&... extra)
Definition: forall.hpp:598
RAJA_HOST_DEVICE auto thread_privatize(const T &item) -> Privatizer< T >
Create a private copy of the argument to be stored on the current thread's stack in a class of the Pr...
Definition: privatizer.hpp:88
RAJA_INLINE concepts::enable_if< std::is_same< ExecPol, RAJA::policy::omp::Auto > > forall_impl(const ExecPol &p, Iterable &&iter, Func &&loop_body, ForallParam &&f_params)
Definition: forall.hpp:33
RAJA_INLINE void forall_impl_nowait(const ::RAJA::policy::omp::Auto &p, Iterable &&iter, Func &&loop_body, ForallParam &&f_params)
Definition: forall.hpp:143
RAJA_INLINE resources::EventProxy< resources::Host > forall_impl(resources::Host host_res, const omp_for_schedule_exec< Schedule > &, Iterable &&iter, Func &&loop_body, ForallParam f_params)
Definition: forall.hpp:299
RAJA_INLINE concepts::enable_if_t< resources::EventProxy< resources::Host >, RAJA::expt::type_traits::is_ForallParamPack< ForallParam >, concepts::negate< RAJA::expt::type_traits::is_ForallParamPack_empty< ForallParam > > > forall_impl(resources::Host host_res, const omp_parallel_exec< InnerPolicy > &, Iterable &&iter, Func &&loop_body, ForallParam f_params)
Definition: forall.hpp:325
Definition: AlignedRangeIndexSetBuilders.cpp:35
auto & body
Definition: launch.hpp:177
#define RAJA_EXTRACT_BED_IT(CONTAINER)
Definition: forall.hpp:32
Definition: PolicyBase.hpp:75
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: policy.hpp:109
Definition: policy.hpp:177