RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
Conditional.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_cuda_kernel_Conditional_HPP
21 #define RAJA_policy_cuda_kernel_Conditional_HPP
22 
23 #include "RAJA/config.hpp"
24 
25 #include <iostream>
26 #include <type_traits>
27 
28 #include "RAJA/util/macros.hpp"
29 #include "RAJA/util/types.hpp"
30 
32 
34 
35 namespace RAJA
36 {
37 namespace internal
38 {
39 
40 
41 template<typename Data,
42  typename Conditional,
43  typename... EnclosedStmts,
44  typename Types>
45 struct CudaStatementExecutor<Data,
46  statement::If<Conditional, EnclosedStmts...>,
47  Types>
48 {
49 
50  using stmt_list_t = StatementList<EnclosedStmts...>;
51  using enclosed_stmts_t = CudaStatementListExecutor<Data, stmt_list_t, Types>;
52 
53  static inline RAJA_DEVICE void exec(Data& data, bool thread_active)
54  {
55  if (Conditional::eval(data))
56  {
57 
58  // execute enclosed statements
59  enclosed_stmts_t::exec(data, thread_active);
60  }
61  }
62 
63  static inline LaunchDims calculateDimensions(Data const& data)
64  {
65  return enclosed_stmts_t::calculateDimensions(data);
66  }
67 };
68 
69 
70 } // namespace internal
71 } // end namespace RAJA
72 
73 
74 #endif
Header file for common RAJA internal macro definitions.
#define RAJA_DEVICE
Definition: macros.hpp:66
camp::list< Stmts... > StatementList
Definition: StatementList.hpp:41
Definition: AlignedRangeIndexSetBuilders.cpp:35
Header file for kernel conditional templates.
RAJA header file containing constructs used to run kernel traversals on GPU with CUDA.
static RAJA_DEVICE void exec(Data &data, bool thread_active)
Definition: Conditional.hpp:53
CudaStatementListExecutor< Data, stmt_list_t, Types > enclosed_stmts_t
Definition: Conditional.hpp:51
static LaunchDims calculateDimensions(Data const &data)
Definition: Conditional.hpp:63
Header file for RAJA type definitions.