RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
forall.hpp
Go to the documentation of this file.
1 
19 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
20 // Copyright (c) Lawrence Livermore National Security, LLC and other
21 // RAJA Project Developers. See top-level LICENSE and COPYRIGHT
22 // files for dates and other details. No copyright assignment is required
23 // to contribute to RAJA.
24 //
25 // SPDX-License-Identifier: (BSD-3-Clause)
26 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
27 
28 #ifndef RAJA_forall_simd_HPP
29 #define RAJA_forall_simd_HPP
30 
31 #include "RAJA/config.hpp"
32 
33 #include <iterator>
34 #include <type_traits>
35 
36 #include "RAJA/util/types.hpp"
37 
39 
41 
42 namespace RAJA
43 {
44 namespace policy
45 {
46 namespace simd
47 {
48 
49 
50 template<typename Iterable, typename Func, typename ForallParam>
51 RAJA_INLINE concepts::enable_if_t<
52  resources::EventProxy<resources::Host>,
54  concepts::negate<expt::type_traits::is_ForallParamPack_empty<ForallParam>>>
55 forall_impl(resources::Host host_res,
56  const simd_exec& pol,
57  Iterable&& iter,
58  Func&& body,
59  ForallParam f_params)
60 {
62 
64 
65  RAJA_SIMD
66  for (decltype(distance_it) i = 0; i < distance_it; ++i)
67  {
68  expt::invoke_body(f_params, body, *(begin_it + i));
69  }
70 
72 
73  return resources::EventProxy<resources::Host>(host_res);
74 }
75 
76 template<typename Iterable, typename Func, typename ForallParam>
77 RAJA_INLINE concepts::enable_if_t<
78  resources::EventProxy<resources::Host>,
81 forall_impl(resources::Host host_res,
82  const simd_exec&,
83  Iterable&& iter,
84  Func&& body,
85  ForallParam)
86 {
88 
89  RAJA_SIMD
90  for (decltype(distance_it) i = 0; i < distance_it; ++i)
91  {
92  body(*(begin_it + i));
93  }
94 
95  return resources::EventProxy<resources::Host>(host_res);
96 }
97 
98 } // namespace simd
99 
100 } // namespace policy
101 
102 } // namespace RAJA
103 
104 #endif // closing endif for header file include guard
value_type::device_call &[i_loop] iter
Definition: WorkRunner.hpp:216
constexpr RAJA_HOST_DEVICE auto invoke_body(Params &&params, Fn &&f, Ts &&... extra)
Definition: forall.hpp:598
RAJA_INLINE concepts::enable_if_t< resources::EventProxy< resources::Host >, expt::type_traits::is_ForallParamPack< ForallParam >, concepts::negate< expt::type_traits::is_ForallParamPack_empty< ForallParam > > > forall_impl(resources::Host host_res, const simd_exec &pol, Iterable &&iter, Func &&body, ForallParam f_params)
Definition: forall.hpp:55
Definition: AlignedRangeIndexSetBuilders.cpp:35
auto & body
Definition: launch.hpp:177
#define RAJA_EXTRACT_BED_IT(CONTAINER)
Definition: forall.hpp:32
Header file containing RAJA simd policy definitions.
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:59
Definition: policy.hpp:47
Header file for RAJA type definitions.