RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
launch.hpp
Go to the documentation of this file.
1 
11 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
12 // Copyright (c) Lawrence Livermore National Security, LLC and other
13 // RAJA Project Developers. See top-level LICENSE and COPYRIGHT
14 // files for dates and other details. No copyright assignment is required
15 // to contribute to RAJA.
16 //
17 // SPDX-License-Identifier: (BSD-3-Clause)
18 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
19 
20 #ifndef RAJA_pattern_launch_simd_HPP
21 #define RAJA_pattern_launch_simd_HPP
22 
25 
26 namespace RAJA
27 {
28 
29 template<typename SEGMENT>
30 struct LoopExecute<simd_exec, SEGMENT>
31 {
32 
33  template<typename BODY>
34  static RAJA_INLINE RAJA_HOST_DEVICE void exec(SEGMENT const& segment,
35  BODY const& body)
36  {
37 
38  const int len = segment.end() - segment.begin();
39  RAJA_SIMD
40  for (int i = 0; i < len; i++)
41  {
42  body(*(segment.begin() + i));
43  }
44  }
45 
46  template<typename LaunchContextPolicy, typename BODY>
47  static RAJA_INLINE RAJA_HOST_DEVICE void exec(
49  SEGMENT const& segment,
50  BODY const& body)
51  {
52 
53  const int len = segment.end() - segment.begin();
54  RAJA_SIMD
55  for (int i = 0; i < len; i++)
56  {
57  body(*(segment.begin() + i));
58  }
59  }
60 };
61 
62 template<typename SEGMENT>
63 struct LoopICountExecute<simd_exec, SEGMENT>
64 {
65 
66  template<typename BODY>
67  static RAJA_INLINE RAJA_HOST_DEVICE void exec(SEGMENT const& segment,
68  BODY const& body)
69  {
70 
71  const int len = segment.end() - segment.begin();
72  RAJA_SIMD
73  for (int i = 0; i < len; i++)
74  {
75  body(*(segment.begin() + i), i);
76  }
77  }
78 
79  template<typename LaunchContextPolicy, typename BODY>
80  static RAJA_INLINE RAJA_HOST_DEVICE void exec(
82  SEGMENT const& segment,
83  BODY const& body)
84  {
85 
86  const int len = segment.end() - segment.begin();
87  RAJA_SIMD
88  for (int i = 0; i < len; i++)
89  {
90  body(*(segment.begin() + i), i);
91  }
92  }
93 };
94 
95 } // namespace RAJA
96 #endif
Definition: launch_context_policy.hpp:30
RAJA header file containing the core components of RAJA::launch.
#define RAJA_HOST_DEVICE
Definition: macros.hpp:65
#define RAJA_UNUSED_ARG(x)
Definition: macros.hpp:97
Definition: AlignedRangeIndexSetBuilders.cpp:35
LaunchContextType ctx
Definition: launch.hpp:185
auto & body
Definition: launch.hpp:177
Header file containing RAJA simd policy definitions.
static RAJA_INLINE RAJA_HOST_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const RAJA_UNUSED_ARG(&ctx), SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:47
static RAJA_INLINE RAJA_HOST_DEVICE void exec(SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:34
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:80
static RAJA_INLINE RAJA_HOST_DEVICE void exec(SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:67
Definition: launch_core.hpp:483
Definition: policy.hpp:47