RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
StatementList.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_kernel_internal_StatementList_HPP
21 #define RAJA_pattern_kernel_internal_StatementList_HPP
22 
23 #include "RAJA/config.hpp"
24 #include "RAJA/util/macros.hpp"
25 #include "camp/camp.hpp"
26 
27 #include <type_traits>
28 
29 namespace RAJA
30 {
31 namespace internal
32 {
33 
34 
35 // forward decl
36 template<typename Policy, typename Types>
37 struct StatementExecutor;
38 
39 
40 template<typename... Stmts>
41 using StatementList = camp::list<Stmts...>;
42 
43 
44 template<camp::idx_t idx, camp::idx_t N, typename StmtList, typename Types>
46 
47 template<camp::idx_t statement_index,
48  camp::idx_t num_statements,
49  typename StmtList,
50  typename Types>
52 {
53 
54  template<typename Data>
55  static RAJA_INLINE void exec(Data&& data)
56  {
57 
58  // Get the statement we're going to execute
59  using statement = camp::at_v<StmtList, statement_index>;
60 
61  // Execute this statement
62  StatementExecutor<statement, Types>::exec(std::forward<Data>(data));
63 
64  // call our next statement
65  StatementListExecutor<statement_index + 1, num_statements, StmtList,
66  Types>::exec(std::forward<Data>(data));
67  }
68 };
69 
70 /*
71  * termination case, a NOP.
72  */
73 
74 template<camp::idx_t num_statements, typename StmtList, typename Types>
75 struct StatementListExecutor<num_statements, num_statements, StmtList, Types>
76 {
77 
78  template<typename Data>
79  static RAJA_INLINE void exec(Data&&)
80  {}
81 };
82 
83 template<typename StmtList, typename Types, typename Data>
84 RAJA_INLINE void execute_statement_list(Data&& data)
85 {
87  std::forward<Data>(data));
88 }
89 
90 
91 } // end namespace internal
92 } // end namespace RAJA
93 
94 
95 #endif /* RAJA_pattern_kernel_internal_HPP */
Header file for common RAJA internal macro definitions.
camp::list< Stmts... > StatementList
Definition: StatementList.hpp:41
RAJA_INLINE void execute_statement_list(Data &&data)
Definition: StatementList.hpp:84
Definition: AlignedRangeIndexSetBuilders.cpp:35
Definition: Statement.hpp:48
static RAJA_INLINE void exec(Data &&)
Definition: StatementList.hpp:79
Definition: StatementList.hpp:52
static RAJA_INLINE void exec(Data &&data)
Definition: StatementList.hpp:55