RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
get_platform.hpp
Go to the documentation of this file.
1 #ifndef RAJA_get_platform_HPP
2 #define RAJA_get_platform_HPP
3 
7 
8 namespace RAJA
9 {
10 
11 namespace policy
12 {
13 namespace multi
14 {
15 template<typename Selector, typename... Policies>
16 class MultiPolicy;
17 
18 }
19 } // namespace policy
20 
21 namespace detail
22 {
23 
25 {
27 
28  RAJA_INLINE
29  constexpr RAJA::Platform operator()(const RAJA::Platform& l,
30  const RAJA::Platform& r) const
31  {
32  return (l > r) ? l : r;
33  }
34 };
35 
40 template<typename T, typename = void>
42 {
43  // catch-all: undefined platform
44  static constexpr Platform value = Platform::undefined;
45 };
46 
51 template<typename... Policies>
53 {
54  static constexpr Platform value =
56 };
57 
61 template<>
63 {
64  static constexpr Platform value = Platform::undefined;
65 };
66 
73 template<typename T>
74 struct get_platform<T,
75  typename std::enable_if<
76  std::is_base_of<RAJA::PolicyBase, T>::value &&
77  !RAJA::type_traits::is_indexset_policy<T>::value>::type>
78 {
79 
80  static constexpr Platform value = T::platform;
81 };
82 
88 template<typename SEG, typename EXEC>
89 struct get_platform<RAJA::ExecPolicy<SEG, EXEC>>
90  : public get_platform_from_list<SEG, EXEC>
91 {};
92 
93 template<typename T>
95 {
96  static constexpr Platform value =
97  get_platform_from_list<typename T::execution_policy_t,
98  typename T::enclosed_statements_t>::value;
99 };
100 
108 template<typename... Stmts>
110 {
111  static constexpr Platform value =
113 };
114 
118 template<>
120 {
121  static constexpr Platform value = Platform::undefined;
122 };
123 
124 // Top level MultiPolicy shouldn't select a platform
125 // Once a specific policy is selected, that policy will select the correct
126 // platform... see policy_invoker in MultiPolicy.hpp
127 template<typename SELECTOR, typename... POLICIES>
128 struct get_platform<RAJA::policy::multi::MultiPolicy<SELECTOR, POLICIES...>>
129 {
130  static constexpr Platform value = Platform::undefined;
131 };
132 
133 } // namespace detail
134 } // namespace RAJA
135 
136 #endif // RAJA_get_platform_HPP
Header file for RAJA operator definitions.
Definition: MultiPolicy.hpp:56
Header file with support for pre-C++14 compilers.
#define RAJA_HOST_DEVICE
Definition: macros.hpp:65
camp::list< Stmts... > StatementList
Definition: StatementList.hpp:41
Definition: AlignedRangeIndexSetBuilders.cpp:35
RAJA_HOST_DEVICE constexpr RAJA_INLINE auto foldl(Op &&RAJA_UNUSED_ARG(operation), Arg1 &&arg) -> typename detail::foldl_impl< Op, Arg1 >::Ret
Definition: foldl.hpp:104
Definition: ListSegment.hpp:416
Header file for loop kernel internals.
Definition: get_platform.hpp:53
static constexpr Platform value
Definition: get_platform.hpp:54
Definition: get_platform.hpp:42
static constexpr Platform value
Definition: get_platform.hpp:44
Definition: get_platform.hpp:95
static constexpr Platform value
Definition: get_platform.hpp:96
Definition: get_platform.hpp:25
RAJA_HOST_DEVICE constexpr RAJA_INLINE RAJA::Platform operator()(const RAJA::Platform &l, const RAJA::Platform &r) const
Definition: get_platform.hpp:29
Definition: IndexSet.hpp:70