RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
reduce.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_reduce_HPP
21 #define RAJA_reduce_HPP
22 
23 #include "RAJA/config.hpp"
24 
25 #include "RAJA/util/Operators.hpp"
26 #include "RAJA/util/macros.hpp"
27 
28 namespace RAJA
29 {
30 
34 #define RAJA_MIN(a, b) (((b) < (a)) ? (b) : (a))
36 #define RAJA_MAX(a, b) (((b) > (a)) ? (b) : (a))
37 
40 #define RAJA_MINLOC_UNSTRUCTURED(set_val, set_idx, a_val, a_idx, b_val, b_idx) \
41  set_idx = ((b_val) < (a_val) ? (b_idx) : (a_idx)); \
42  set_val = ((b_val) < (a_val) ? (b_val) : (a_val));
44 #define RAJA_MAXLOC_UNSTRUCTURED(set_val, set_idx, a_val, a_idx, b_val, b_idx) \
45  set_idx = ((b_val) > (a_val) ? (b_idx) : (a_idx)); \
46  set_val = ((b_val) > (a_val) ? (b_val) : (a_val));
47 
48 //
49 // Forward declarations for reduction templates.
50 // Actual classes appear in forall_*.hxx header files.
51 //
52 // IMPORTANT: reduction policy parameter must be consistent with loop
53 // execution policy type.
54 //
55 // Also, mutliple reductions using different reduction operations may be
56 // combined in a single RAJA forall() construct.
57 //
58 
81 template<typename REDUCE_POLICY_T, typename T>
82 class ReduceMin;
83 
107 template<typename REDUCE_POLICY_T, typename T, typename IndexType = Index_type>
109 
132 template<typename REDUCE_POLICY_T, typename T>
133 class ReduceMax;
134 
158 template<typename REDUCE_POLICY_T, typename T, typename IndexType = Index_type>
160 
183 template<typename REDUCE_POLICY_T, typename T>
184 class ReduceSum;
185 
208 template<typename REDUCE_POLICY_T, typename T>
210 
211 
234 template<typename REDUCE_POLICY_T, typename T>
236 } // namespace RAJA
237 
238 
239 #endif // closing endif for header file include guard
Header file for RAJA operator definitions.
Bitwise AND reducer class template.
Definition: reduce.hpp:235
Bitwise OR reducer class template.
Definition: reduce.hpp:209
Max-loc reducer class template.
Definition: reduce.hpp:159
Max reducer class template.
Definition: reduce.hpp:133
Min-loc reducer class template.
Definition: reduce.hpp:108
Min reducer class template.
Definition: reduce.hpp:82
Sum reducer class template.
Definition: reduce.hpp:184
Header file for common RAJA internal macro definitions.
Definition: AlignedRangeIndexSetBuilders.cpp:35