RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
policy.hpp
Go to the documentation of this file.
1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
2 // Copyright (c) Lawrence Livermore National Security, LLC and other
3 // RAJA Project Developers. See top-level LICENSE and COPYRIGHT
4 // files for dates and other details. No copyright assignment is required
5 // to contribute to RAJA.
6 //
7 // SPDX-License-Identifier: (BSD-3-Clause)
8 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
9 
10 #ifndef RAJA_policy_openmp_target_HPP
11 #define RAJA_policy_openmp_target_HPP
12 
14 
15 namespace RAJA
16 {
17 
18 namespace policy
19 {
20 namespace omp
21 {
22 
23 // Max number of CUDA reduction threads per block possible.
24 // Required for allocating omp target data before execution policy.
25 // Used in target_parallel_for, aliased in target_reduce.
26 static constexpr int MAXNUMTHREADS = 1024;
27 
28 template<unsigned int TeamSize>
29 struct Teams : std::integral_constant<unsigned int, TeamSize>
30 {};
31 
32 struct Target
33 {};
34 
35 struct Distribute
36 {};
37 
38 struct Collapse
39 {};
40 
41 template<size_t ThreadsPerTeam>
43  : make_policy_pattern_platform_t<Policy::target_openmp,
44  Pattern::forall,
45  Platform::omp_target,
46  omp::Target,
47  omp::Teams<ThreadsPerTeam>,
48  omp::Distribute>
49 {};
50 
52  : make_policy_pattern_platform_t<Policy::target_openmp,
53  Pattern::forall,
54  Platform::omp_target,
55  omp::Target,
56  omp::Distribute>
57 {};
58 
60  : make_policy_pattern_platform_t<Policy::target_openmp,
61  Pattern::forall,
62  Platform::omp_target,
63  omp::Target,
64  omp::Collapse>
65 {};
66 
67 struct omp_target_reduce : make_policy_pattern_platform_t<Policy::target_openmp,
68  Pattern::reduce,
69  Platform::omp_target>
70 {};
71 
76  : make_policy_pattern_launch_platform_t<Policy::target_openmp,
77  Pattern::workgroup_exec,
78  Launch::sync,
79  Platform::omp_target>
80 {};
81 
82 
83 } // namespace omp
84 } // namespace policy
85 
86 #if defined(RAJA_ENABLE_TARGET_OPENMP)
92 #endif
93 
94 } // namespace RAJA
95 
96 #endif // RAJA_policy_openmp_target_HPP
Header file for basic RAJA policy mechanics.
Definition: AlignedRangeIndexSetBuilders.cpp:35
Definition: PolicyBase.hpp:75
Definition: policy.hpp:39
Definition: policy.hpp:36
Definition: policy.hpp:33
Definition: policy.hpp:30
Definition: policy.hpp:70
Definition: policy.hpp:80