RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
ForICount.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_policy_simd_kernel_ForICount_HPP
21 #define RAJA_policy_simd_kernel_ForICount_HPP
22 
23 #include "RAJA/config.hpp"
24 
25 #include <iostream>
26 #include <type_traits>
27 
32 
33 namespace RAJA
34 {
35 
36 namespace internal
37 {
38 
39 
47 template<camp::idx_t ArgumentId,
48  typename ParamId,
49  typename... EnclosedStmts,
50  typename Types>
52  statement::
53  ForICount<ArgumentId, ParamId, RAJA::simd_exec, EnclosedStmts...>,
54  Types>
55 {
56 
57  template<typename Data>
58  static RAJA_INLINE void exec(Data&& data)
59  {
60 
61  // Set the argument type for this loop
63 
64  auto iter = get<ArgumentId>(data.segment_tuple);
65  auto begin = std::begin(iter);
66  auto end = std::end(iter);
67  auto distance = std::distance(begin, end);
68 
69  RAJA_SIMD
70  for (decltype(distance) i = 0; i < distance; ++i)
71  {
72 
73  // Offsets and parameters need to be privatized
74  data.template assign_offset<ArgumentId>(i);
75  data.template assign_param<ParamId>(i);
76 
77  // Privatize data for SIMD correctness reasons
79  auto privatizer = thread_privatize(data);
80  auto& private_data = privatizer.get_priv();
81 
83  private_data);
84  }
85  }
86 };
87 
88 } // namespace internal
89 } // end namespace RAJA
90 
91 
92 #endif
value_type::device_call &[i_loop] iter
Definition: WorkRunner.hpp:216
setSegmentType< Types, Segment, camp::at_v< typename camp::decay< Data >::index_types_t, Segment > > setSegmentTypeFromData
Definition: LoopTypes.hpp:95
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
Definition: AlignedRangeIndexSetBuilders.cpp:35
auto privatizer
Definition: launch.hpp:176
Header file for kernel lambda executor.
Header file for loop kernel internals.
Header file for statement wrappers and executors.
Header file containing RAJA simd policy definitions.
Definition: For.hpp:63
Definition: Statement.hpp:48