RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
Region.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_region_HPP
21 #define RAJA_pattern_kernel_region_HPP
22 
23 #include "RAJA/config.hpp"
24 #include "RAJA/pattern/region.hpp"
25 
26 #include <iostream>
27 #include <type_traits>
28 
29 namespace RAJA
30 {
31 
32 namespace statement
33 {
34 
35 template<typename RegionPolicy, typename... EnclosedStmts>
36 struct Region : public internal::Statement<camp::nil>
37 {};
38 
39 
40 } // end namespace statement
41 
42 namespace internal
43 {
44 
45 // Statement executor to create a region within kernel
46 
47 // Note: RAJA region's lambda must capture by reference otherwise
48 // internal function calls are undefined.
49 template<typename RegionPolicy, typename... EnclosedStmts, typename Types>
50 struct StatementExecutor<statement::Region<RegionPolicy, EnclosedStmts...>,
51  Types>
52 {
53 
54  template<typename Data>
55  static RAJA_INLINE void exec(Data&& data)
56  {
57 
58  RAJA::region<RegionPolicy>([&]() {
59  using data_t = camp::decay<Data>;
60  execute_statement_list<camp::list<EnclosedStmts...>, Types>(data_t(data));
61  });
62  }
63 };
64 
65 
66 } // namespace internal
67 } // end namespace RAJA
68 
69 #endif /* RAJA_pattern_kernel_HPP */
RAJA_INLINE void execute_statement_list(Data &&data)
Definition: StatementList.hpp:84
Definition: AlignedRangeIndexSetBuilders.cpp:35
Header file containing the RAJA Region API call.
Definition: Statement.hpp:48
Definition: Statement.hpp:35
Definition: Region.hpp:37