RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
Lambda.hpp
Go to the documentation of this file.
1 
12 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
13 // Copyright (c) Lawrence Livermore National Security, LLC and other
14 // RAJA Project Developers. See top-level LICENSE and COPYRIGHT
15 // files for dates and other details. No copyright assignment is required
16 // to contribute to RAJA.
17 //
18 // SPDX-License-Identifier: (BSD-3-Clause)
19 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
20 
21 #ifndef RAJA_policy_cuda_kernel_Lambda_HPP
22 #define RAJA_policy_cuda_kernel_Lambda_HPP
23 
24 #include "RAJA/config.hpp"
25 
26 #if defined(RAJA_ENABLE_CUDA)
27 
28 #include <cassert>
29 #include <climits>
30 
31 #include "camp/camp.hpp"
32 
33 #include "RAJA/util/macros.hpp"
34 #include "RAJA/util/types.hpp"
35 
36 #include "RAJA/pattern/kernel.hpp"
38 
39 namespace RAJA
40 {
41 namespace internal
42 {
43 
44 template<typename Data,
45  camp::idx_t LambdaIndex,
46  typename... Args,
47  typename Types>
48 struct CudaStatementExecutor<Data,
49  statement::Lambda<LambdaIndex, Args...>,
50  Types>
51 {
52 
53  static inline RAJA_DEVICE void exec(Data& data, bool thread_active)
54  {
55  // Only execute the lambda if it hasn't been masked off
56  if (thread_active)
57  {
58  StatementExecutor<statement::Lambda<LambdaIndex, Args...>, Types>::exec(
59  data);
60  }
61  }
62 
63  static inline LaunchDims calculateDimensions(
64  Data const& RAJA_UNUSED_ARG(data))
65  {
66  return LaunchDims();
67  }
68 };
69 
70 
71 } // namespace internal
72 } // namespace RAJA
73 
74 #endif // closing endif for RAJA_ENABLE_CUDA guard
75 
76 #endif // closing endif for header file include guard
Header file for common RAJA internal macro definitions.
#define RAJA_UNUSED_ARG(x)
Definition: macros.hpp:97
#define RAJA_DEVICE
Definition: macros.hpp:66
Definition: AlignedRangeIndexSetBuilders.cpp:35
Header file for kernel lambda executor.
RAJA header file containing user interface for RAJA::kernel.
Header file for RAJA type definitions.