45 #ifndef KOKKOS_EXECPOLICY_HPP
46 #define KOKKOS_EXECPOLICY_HPP
48 #include <Kokkos_Core_fwd.hpp>
49 #include <impl/Kokkos_Traits.hpp>
50 #include <impl/Kokkos_Error.hpp>
51 #include <impl/Kokkos_Tags.hpp>
52 #include <impl/Kokkos_AnalyzePolicy.hpp>
53 #include <Kokkos_Concepts.hpp>
55 #if defined(KOKKOS_ENABLE_PROFILING)
57 #endif // KOKKOS_ENABLE_PROFILING
63 struct ParallelForTag {};
64 struct ParallelScanTag {};
65 struct ParallelReduceTag {};
69 ChunkSize(
int value_) : value(value_) {}
93 template <
class... Properties>
94 class RangePolicy :
public Impl::PolicyTraits<Properties...> {
96 typedef Impl::PolicyTraits<Properties...> traits;
99 typename traits::execution_space m_space;
100 typename traits::index_type m_begin;
101 typename traits::index_type m_end;
102 typename traits::index_type m_granularity;
103 typename traits::index_type m_granularity_mask;
105 template <
class... OtherProperties>
111 typedef typename traits::index_type member_type;
112 typedef typename traits::index_type index_type;
114 KOKKOS_INLINE_FUNCTION
const typename traits::execution_space& space()
const {
117 KOKKOS_INLINE_FUNCTION member_type begin()
const {
return m_begin; }
118 KOKKOS_INLINE_FUNCTION member_type end()
const {
return m_end; }
125 void operator()(
const int&)
const {}
127 RangePolicy(
const RangePolicy&) =
default;
128 RangePolicy(RangePolicy&&) =
default;
130 template <
class... OtherProperties>
131 RangePolicy(
const RangePolicy<OtherProperties...> p) {
135 m_granularity = p.m_granularity;
136 m_granularity_mask = p.m_granularity_mask;
139 inline RangePolicy() : m_space(), m_begin(0), m_end(0) {}
142 inline RangePolicy(
const typename traits::execution_space& work_space,
143 const member_type work_begin,
const member_type work_end)
144 : m_space(work_space),
145 m_begin(work_begin < work_end ? work_begin : 0),
146 m_end(work_begin < work_end ? work_end : 0),
148 m_granularity_mask(0) {
149 set_auto_chunk_size();
153 inline RangePolicy(
const member_type work_begin,
const member_type work_end)
154 :
RangePolicy(typename traits::execution_space(), work_begin, work_end) {
155 set_auto_chunk_size();
159 template <
class... Args>
160 inline RangePolicy(
const typename traits::execution_space& work_space,
161 const member_type work_begin,
const member_type work_end,
163 : m_space(work_space),
164 m_begin(work_begin < work_end ? work_begin : 0),
165 m_end(work_begin < work_end ? work_end : 0),
167 m_granularity_mask(0) {
168 set_auto_chunk_size();
173 template <
class... Args>
174 inline RangePolicy(
const member_type work_begin,
const member_type work_end,
176 :
RangePolicy(typename traits::execution_space(), work_begin, work_end) {
177 set_auto_chunk_size();
185 template <
class... Args>
186 inline void set(Args...) {
188 0 ==
sizeof...(Args),
189 "Kokkos::RangePolicy: unhandled constructor arguments encountered.");
192 template <
class... Args>
193 inline void set(
const ChunkSize& chunksize, Args... args) {
194 m_granularity = chunksize.value;
195 m_granularity_mask = m_granularity - 1;
201 inline member_type
chunk_size()
const {
return m_granularity; }
206 p.m_granularity = chunk_size_;
207 p.m_granularity_mask = p.m_granularity - 1;
213 inline void set_auto_chunk_size() {
214 int64_t concurrency =
215 static_cast<int64_t
>(traits::execution_space::concurrency());
216 if (concurrency == 0) concurrency = 1;
218 if (m_granularity > 0) {
219 if (!Impl::is_integral_power_of_two(m_granularity))
220 Kokkos::abort(
"RangePolicy blocking granularity must be power of two");
223 int64_t new_chunk_size = 1;
224 while (new_chunk_size * 100 * concurrency <
225 static_cast<int64_t>(m_end - m_begin))
227 if (new_chunk_size < 128) {
229 while ((new_chunk_size * 40 * concurrency <
230 static_cast<int64_t>(m_end - m_begin)) &&
231 (new_chunk_size < 128))
234 m_granularity = new_chunk_size;
235 m_granularity_mask = m_granularity - 1;
244 typedef typename RangePolicy::work_tag work_tag;
245 typedef typename RangePolicy::member_type member_type;
247 KOKKOS_INLINE_FUNCTION member_type begin()
const {
return m_begin; }
248 KOKKOS_INLINE_FUNCTION member_type end()
const {
return m_end; }
254 KOKKOS_INLINE_FUNCTION
257 : m_begin(0), m_end(0) {
260 const member_type work_part =
261 ((((range.end() - range.begin()) + (part_size - 1)) / part_size) +
262 range.m_granularity_mask) &
263 ~member_type(range.m_granularity_mask);
265 m_begin = range.begin() + work_part * part_rank;
266 m_end = m_begin + work_part;
268 if (range.end() < m_begin) m_begin = range.end();
269 if (range.end() < m_end) m_end = range.end();
290 template <
class ExecSpace,
class... Properties>
291 class TeamPolicyInternal :
public Impl::PolicyTraits<Properties...> {
293 typedef Impl::PolicyTraits<Properties...> traits;
296 typedef typename traits::index_type index_type;
309 template <
class FunctorType>
310 static int team_size_max(
const FunctorType&);
322 template <
class FunctorType>
323 static int team_size_recommended(
const FunctorType&);
325 template <
class FunctorType>
326 static int team_size_recommended(
const FunctorType&,
const int&);
328 template <
class FunctorType>
329 int team_size_recommended(
const FunctorType& functor,
330 const int vector_length);
334 TeamPolicyInternal(
const typename traits::execution_space&,
335 int league_size_request,
int team_size_request,
336 int vector_length_request = 1);
338 TeamPolicyInternal(
const typename traits::execution_space&,
339 int league_size_request,
const Kokkos::AUTO_t&,
340 int vector_length_request = 1);
344 TeamPolicyInternal(
int league_size_request,
int team_size_request,
345 int vector_length_request = 1);
347 TeamPolicyInternal(
int league_size_request,
const Kokkos::AUTO_t&,
348 int vector_length_request = 1);
359 KOKKOS_INLINE_FUNCTION
int league_size()
const;
366 KOKKOS_INLINE_FUNCTION
int team_size()
const;
368 inline typename traits::index_type chunk_size()
const;
370 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
371 inline TeamPolicyInternal set_chunk_size(
int chunk_size)
const;
373 inline TeamPolicyInternal& set_chunk_size(
int chunk_size);
381 KOKKOS_INLINE_FUNCTION
382 typename traits::execution_space::scratch_memory_space
team_shmem()
const;
391 KOKKOS_INLINE_FUNCTION
int team_rank()
const;
394 KOKKOS_INLINE_FUNCTION
int team_size()
const;
401 template <
class JoinOp>
402 KOKKOS_INLINE_FUNCTION
typename JoinOp::value_type
team_reduce(
403 const typename JoinOp::value_type,
const JoinOp&)
const;
410 template <
typename Type>
411 KOKKOS_INLINE_FUNCTION Type
team_scan(
const Type& value)
const;
422 template <
typename Type>
423 KOKKOS_INLINE_FUNCTION Type
team_scan(
const Type& value,
424 Type*
const global_accum)
const;
428 struct PerTeamValue {
430 PerTeamValue(
int arg);
433 struct PerThreadValue {
435 PerThreadValue(
int arg);
438 template <
class iType,
class... Args>
439 struct ExtractVectorLength {
440 static inline iType value(
441 typename std::enable_if<std::is_integral<iType>::value, iType>::type val,
446 typename std::enable_if<!std::is_integral<iType>::value,
int>::type
448 typename std::enable_if<!std::is_integral<iType>::value, iType>::type,
454 template <
class iType,
class... Args>
455 inline typename std::enable_if<std::is_integral<iType>::value, iType>::type
456 extract_vector_length(iType val, Args...) {
460 template <
class iType,
class... Args>
461 inline typename std::enable_if<!std::is_integral<iType>::value,
int>::type
462 extract_vector_length(iType, Args...) {
468 Impl::PerTeamValue PerTeam(
const int& arg);
469 Impl::PerThreadValue PerThread(
const int& arg);
471 struct ScratchRequest {
477 inline ScratchRequest(
const int& level_,
478 const Impl::PerTeamValue& team_value) {
480 per_team = team_value.value;
484 inline ScratchRequest(
const int& level_,
485 const Impl::PerThreadValue& thread_value) {
488 per_thread = thread_value.value;
491 inline ScratchRequest(
const int& level_,
const Impl::PerTeamValue& team_value,
492 const Impl::PerThreadValue& thread_value) {
494 per_team = team_value.value;
495 per_thread = thread_value.value;
498 inline ScratchRequest(
const int& level_,
499 const Impl::PerThreadValue& thread_value,
500 const Impl::PerTeamValue& team_value) {
502 per_team = team_value.value;
503 per_thread = thread_value.value;
533 template <
class... Properties>
535 :
public Impl::TeamPolicyInternal<
536 typename Impl::PolicyTraits<Properties...>::execution_space,
538 typedef Impl::TeamPolicyInternal<
539 typename Impl::PolicyTraits<Properties...>::execution_space,
543 template <
class... OtherProperties>
547 typedef Impl::PolicyTraits<Properties...> traits;
555 int league_size_request,
int team_size_request,
556 int vector_length_request = 1)
557 : internal_policy(space_, league_size_request, team_size_request,
558 vector_length_request) {
562 TeamPolicy(
const typename traits::execution_space& space_,
563 int league_size_request,
const Kokkos::AUTO_t&,
564 int vector_length_request = 1)
565 : internal_policy(space_, league_size_request, Kokkos::AUTO(),
566 vector_length_request) {
573 int vector_length_request = 1)
574 : internal_policy(league_size_request, team_size_request,
575 vector_length_request) {
579 TeamPolicy(
int league_size_request,
const Kokkos::AUTO_t&,
580 int vector_length_request = 1)
581 : internal_policy(league_size_request, Kokkos::AUTO(),
582 vector_length_request) {
586 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
588 template <
class... Args>
589 TeamPolicy(
const typename traits::execution_space&,
int league_size_request,
590 int team_size_request,
int vector_length_request, Args... args)
591 : internal_policy(typename traits::execution_space(), league_size_request,
592 team_size_request, vector_length_request) {
597 template <
class... Args>
598 TeamPolicy(
const typename traits::execution_space&,
int league_size_request,
599 const Kokkos::AUTO_t&,
int vector_length_request, Args... args)
600 : internal_policy(typename traits::execution_space(), league_size_request,
601 Kokkos::AUTO(), vector_length_request) {
608 template <
class... Args>
609 TeamPolicy(
int league_size_request,
int team_size_request,
610 int vector_length_request, Args... args)
611 : internal_policy(league_size_request, team_size_request,
612 vector_length_request) {
617 template <
class... Args>
618 TeamPolicy(
int league_size_request,
const Kokkos::AUTO_t&,
619 int vector_length_request, Args... args)
620 : internal_policy(league_size_request, Kokkos::AUTO(),
621 vector_length_request) {
627 template <
class... Args>
628 TeamPolicy(
const typename traits::execution_space&,
int league_size_request,
629 int team_size_request, Args... args)
630 : internal_policy(typename traits::execution_space(), league_size_request,
632 Kokkos::Impl::extract_vector_length<Args...>(args...)) {
637 template <
class... Args>
638 TeamPolicy(
const typename traits::execution_space&,
int league_size_request,
639 const Kokkos::AUTO_t&, Args... args)
640 : internal_policy(typename traits::execution_space(), league_size_request,
642 Kokkos::Impl::extract_vector_length<Args...>(args...)) {
649 template <
class... Args>
650 TeamPolicy(
int league_size_request,
int team_size_request, Args... args)
651 : internal_policy(league_size_request, team_size_request,
652 Kokkos::Impl::extract_vector_length<Args...>(args...)) {
657 template <
class... Args>
658 TeamPolicy(
int league_size_request,
const Kokkos::AUTO_t&, Args... args)
659 : internal_policy(league_size_request, Kokkos::AUTO(),
660 Kokkos::Impl::extract_vector_length<Args...>(args...)) {
666 template <
class... OtherProperties>
667 TeamPolicy(
const TeamPolicy<OtherProperties...> p) : internal_policy(p) {
668 first_arg = p.first_arg;
673 TeamPolicy(
const internal_policy& p) : internal_policy(p) {
677 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
682 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
683 template <
class... Args>
684 inline void set(Args...) {
686 0 ==
sizeof...(Args),
687 "Kokkos::TeamPolicy: unhandled constructor arguments encountered.");
690 template <
class iType,
class... Args>
691 inline typename std::enable_if<std::is_integral<iType>::value>::type set(
692 iType, Args... args) {
698 Kokkos::Impl::throw_runtime_exception(
699 "Kokkos::TeamPolicy: integer argument to constructor in illegal "
704 template <
class... Args>
705 inline void set(
const ChunkSize& chunksize, Args... args) {
707 internal_policy::internal_set_chunk_size(chunksize.value);
711 template <
class... Args>
712 inline void set(
const ScratchRequest& scr_request, Args... args) {
714 internal_policy::internal_set_scratch_size(
715 scr_request.level, Impl::PerTeamValue(scr_request.per_team),
716 Impl::PerThreadValue(scr_request.per_thread));
720 inline TeamPolicy set_chunk_size(
int chunk)
const {
721 return TeamPolicy(internal_policy::set_chunk_size(chunk));
724 inline TeamPolicy set_scratch_size(
const int& level,
725 const Impl::PerTeamValue& per_team)
const {
726 return TeamPolicy(internal_policy::set_scratch_size(level, per_team));
728 inline TeamPolicy set_scratch_size(
729 const int& level,
const Impl::PerThreadValue& per_thread)
const {
730 return TeamPolicy(internal_policy::set_scratch_size(level, per_thread));
732 inline TeamPolicy set_scratch_size(
733 const int& level,
const Impl::PerTeamValue& per_team,
734 const Impl::PerThreadValue& per_thread)
const {
736 internal_policy::set_scratch_size(level, per_team, per_thread));
738 inline TeamPolicy set_scratch_size(
const int& level,
739 const Impl::PerThreadValue& per_thread,
740 const Impl::PerTeamValue& per_team)
const {
742 internal_policy::set_scratch_size(level, per_team, per_thread));
746 inline TeamPolicy& set_chunk_size(
int chunk) {
747 static_assert(std::is_same<decltype(internal_policy::set_chunk_size(chunk)),
748 internal_policy&>::value,
749 "internal set_chunk_size should return a reference");
750 return static_cast<TeamPolicy&
>(internal_policy::set_chunk_size(chunk));
753 inline TeamPolicy& set_scratch_size(
const int& level,
754 const Impl::PerTeamValue& per_team) {
755 static_assert(std::is_same<decltype(internal_policy::set_scratch_size(
757 internal_policy&>::value,
758 "internal set_chunk_size should return a reference");
759 return static_cast<TeamPolicy&
>(
760 internal_policy::set_scratch_size(level, per_team));
762 inline TeamPolicy& set_scratch_size(
const int& level,
763 const Impl::PerThreadValue& per_thread) {
764 return static_cast<TeamPolicy&
>(
765 internal_policy::set_scratch_size(level, per_thread));
767 inline TeamPolicy& set_scratch_size(
const int& level,
768 const Impl::PerTeamValue& per_team,
769 const Impl::PerThreadValue& per_thread) {
770 return static_cast<TeamPolicy&
>(
771 internal_policy::set_scratch_size(level, per_team, per_thread));
773 inline TeamPolicy& set_scratch_size(
const int& level,
774 const Impl::PerThreadValue& per_thread,
775 const Impl::PerTeamValue& per_team) {
776 return static_cast<TeamPolicy&
>(
777 internal_policy::set_scratch_size(level, per_team, per_thread));
784 template <
typename iType,
class TeamMemberType>
785 struct TeamThreadRangeBoundariesStruct {
787 KOKKOS_INLINE_FUNCTION
static iType ibegin(
const iType& arg_begin,
788 const iType& arg_end,
789 const iType& arg_rank,
790 const iType& arg_size) {
792 ((arg_end - arg_begin + arg_size - 1) / arg_size) * arg_rank;
795 KOKKOS_INLINE_FUNCTION
static iType iend(
const iType& arg_begin,
796 const iType& arg_end,
797 const iType& arg_rank,
798 const iType& arg_size) {
801 ((arg_end - arg_begin + arg_size - 1) / arg_size) * (arg_rank + 1);
802 return end_ < arg_end ? end_ : arg_end;
806 typedef iType index_type;
809 enum { increment = 1 };
810 const TeamMemberType& thread;
812 KOKKOS_INLINE_FUNCTION
813 TeamThreadRangeBoundariesStruct(
const TeamMemberType& arg_thread,
814 const iType& arg_end)
816 ibegin(0, arg_end, arg_thread.team_rank(), arg_thread.team_size())),
817 end(iend(0, arg_end, arg_thread.team_rank(), arg_thread.team_size())),
818 thread(arg_thread) {}
820 KOKKOS_INLINE_FUNCTION
821 TeamThreadRangeBoundariesStruct(
const TeamMemberType& arg_thread,
822 const iType& arg_begin,
const iType& arg_end)
823 : start(ibegin(arg_begin, arg_end, arg_thread.team_rank(),
824 arg_thread.team_size())),
825 end(iend(arg_begin, arg_end, arg_thread.team_rank(),
826 arg_thread.team_size())),
827 thread(arg_thread) {}
830 template <
typename iType,
class TeamMemberType>
831 struct TeamVectorRangeBoundariesStruct {
833 KOKKOS_INLINE_FUNCTION
static iType ibegin(
const iType& arg_begin,
834 const iType& arg_end,
835 const iType& arg_rank,
836 const iType& arg_size) {
838 ((arg_end - arg_begin + arg_size - 1) / arg_size) * arg_rank;
841 KOKKOS_INLINE_FUNCTION
static iType iend(
const iType& arg_begin,
842 const iType& arg_end,
843 const iType& arg_rank,
844 const iType& arg_size) {
847 ((arg_end - arg_begin + arg_size - 1) / arg_size) * (arg_rank + 1);
848 return end_ < arg_end ? end_ : arg_end;
852 typedef iType index_type;
855 enum { increment = 1 };
856 const TeamMemberType& thread;
858 KOKKOS_INLINE_FUNCTION
859 TeamVectorRangeBoundariesStruct(
const TeamMemberType& arg_thread,
860 const iType& arg_end)
862 ibegin(0, arg_end, arg_thread.team_rank(), arg_thread.team_size())),
863 end(iend(0, arg_end, arg_thread.team_rank(), arg_thread.team_size())),
864 thread(arg_thread) {}
866 KOKKOS_INLINE_FUNCTION
867 TeamVectorRangeBoundariesStruct(
const TeamMemberType& arg_thread,
868 const iType& arg_begin,
const iType& arg_end)
869 : start(ibegin(arg_begin, arg_end, arg_thread.team_rank(),
870 arg_thread.team_size())),
871 end(iend(arg_begin, arg_end, arg_thread.team_rank(),
872 arg_thread.team_size())),
873 thread(arg_thread) {}
876 template <
typename iType,
class TeamMemberType>
877 struct ThreadVectorRangeBoundariesStruct {
878 typedef iType index_type;
879 const index_type start;
880 const index_type end;
881 enum { increment = 1 };
883 KOKKOS_INLINE_FUNCTION
884 constexpr ThreadVectorRangeBoundariesStruct(
const TeamMemberType,
885 const index_type& count) noexcept
886 : start(static_cast<index_type>(0)), end(count) {}
888 KOKKOS_INLINE_FUNCTION
889 constexpr ThreadVectorRangeBoundariesStruct(
const index_type& count) noexcept
890 : start(static_cast<index_type>(0)), end(count) {}
892 KOKKOS_INLINE_FUNCTION
893 constexpr ThreadVectorRangeBoundariesStruct(
894 const TeamMemberType,
const index_type& arg_begin,
895 const index_type& arg_end) noexcept
896 : start(static_cast<index_type>(arg_begin)), end(arg_end) {}
898 KOKKOS_INLINE_FUNCTION
899 constexpr ThreadVectorRangeBoundariesStruct(
900 const index_type& arg_begin,
const index_type& arg_end) noexcept
901 : start(static_cast<index_type>(arg_begin)), end(arg_end) {}
904 template <
class TeamMemberType>
905 struct ThreadSingleStruct {
906 const TeamMemberType& team_member;
907 KOKKOS_INLINE_FUNCTION
908 ThreadSingleStruct(
const TeamMemberType& team_member_)
909 : team_member(team_member_) {}
912 template <
class TeamMemberType>
913 struct VectorSingleStruct {
914 const TeamMemberType& team_member;
915 KOKKOS_INLINE_FUNCTION
916 VectorSingleStruct(
const TeamMemberType& team_member_)
917 : team_member(team_member_) {}
929 template <
typename iType,
class TeamMemberType,
class _never_use_this_overload>
930 KOKKOS_INLINE_FUNCTION_DELETED
931 Impl::TeamThreadRangeBoundariesStruct<iType, TeamMemberType>
941 template <
typename iType1,
typename iType2,
class TeamMemberType,
942 class _never_use_this_overload>
943 KOKKOS_INLINE_FUNCTION_DELETED Impl::TeamThreadRangeBoundariesStruct<
944 typename std::common_type<iType1, iType2>::type, TeamMemberType>
946 const iType2& end) =
delete;
955 template <
typename iType,
class TeamMemberType,
class _never_use_this_overload>
956 KOKKOS_INLINE_FUNCTION_DELETED
957 Impl::TeamThreadRangeBoundariesStruct<iType, TeamMemberType>
967 template <
typename iType1,
typename iType2,
class TeamMemberType,
968 class _never_use_this_overload>
969 KOKKOS_INLINE_FUNCTION_DELETED Impl::TeamThreadRangeBoundariesStruct<
970 typename std::common_type<iType1, iType2>::type, TeamMemberType>
972 const iType2& end) =
delete;
981 template <
typename iType,
class TeamMemberType,
class _never_use_this_overload>
982 KOKKOS_INLINE_FUNCTION_DELETED
983 Impl::ThreadVectorRangeBoundariesStruct<iType, TeamMemberType>
986 template <
typename iType,
class TeamMemberType,
class _never_use_this_overload>
987 KOKKOS_INLINE_FUNCTION_DELETED
988 Impl::ThreadVectorRangeBoundariesStruct<iType, TeamMemberType>
990 const iType& arg_end) =
delete;
992 #if defined(KOKKOS_ENABLE_PROFILING)
995 template <
typename FunctorType,
typename TagType,
996 bool HasTag = !std::is_same<TagType, void>::value>
997 struct ParallelConstructName;
999 template <
typename FunctorType,
typename TagType>
1000 struct ParallelConstructName<FunctorType, TagType, true> {
1001 ParallelConstructName(std::string
const& label) : label_ref(label) {
1002 if (label.empty()) {
1003 default_name = std::string(
typeid(FunctorType).name()) +
"/" +
1004 typeid(TagType).name();
1007 std::string
const&
get() {
1008 return (label_ref.empty()) ? default_name : label_ref;
1010 std::string
const& label_ref;
1011 std::string default_name;
1014 template <
typename FunctorType,
typename TagType>
1015 struct ParallelConstructName<FunctorType, TagType, false> {
1016 ParallelConstructName(std::string
const& label) : label_ref(label) {
1017 if (label.empty()) {
1018 default_name = std::string(
typeid(FunctorType).name());
1021 std::string
const&
get() {
1022 return (label_ref.empty()) ? default_name : label_ref;
1024 std::string
const& label_ref;
1025 std::string default_name;
1034 namespace Experimental {
1037 template <
class Property,
class Policy>
1038 struct PolicyPropertyAdaptor;
1040 template <
unsigned long P,
class... Properties>
1041 struct PolicyPropertyAdaptor<WorkItemProperty::ImplWorkItemProperty<P>,
1042 RangePolicy<Properties...>> {
1043 typedef RangePolicy<Properties...> policy_in_t;
1044 typedef RangePolicy<
typename policy_in_t::traits::execution_space,
1045 typename policy_in_t::traits::schedule_type,
1046 typename policy_in_t::traits::work_tag,
1047 typename policy_in_t::traits::index_type,
1048 typename policy_in_t::traits::iteration_pattern,
1049 typename policy_in_t::traits::launch_bounds,
1050 WorkItemProperty::ImplWorkItemProperty<P>>
1054 template <
unsigned long P,
class... Properties>
1055 struct PolicyPropertyAdaptor<WorkItemProperty::ImplWorkItemProperty<P>,
1056 TeamPolicy<Properties...>> {
1057 typedef TeamPolicy<Properties...> policy_in_t;
1058 typedef TeamPolicy<
typename policy_in_t::traits::execution_space,
1059 typename policy_in_t::traits::schedule_type,
1060 typename policy_in_t::traits::work_tag,
1061 typename policy_in_t::traits::index_type,
1062 typename policy_in_t::traits::iteration_pattern,
1063 typename policy_in_t::traits::launch_bounds,
1064 WorkItemProperty::ImplWorkItemProperty<P>>
1069 template <
class PolicyType,
unsigned long P>
1070 constexpr
typename Impl::PolicyPropertyAdaptor<
1071 WorkItemProperty::ImplWorkItemProperty<P>, PolicyType>::policy_out_t
1072 require(
const PolicyType p, WorkItemProperty::ImplWorkItemProperty<P>) {
1073 return typename Impl::PolicyPropertyAdaptor<
1074 WorkItemProperty::ImplWorkItemProperty<P>, PolicyType>::policy_out_t(p);
KOKKOS_INLINE_FUNCTION void team_barrier() const
Barrier among the threads of this team.
KOKKOS_INLINE_FUNCTION_DELETED Impl::TeamThreadRangeBoundariesStruct< iType, TeamMemberType > TeamThreadRange(const TeamMemberType &, const iType &count)=delete
Execution policy for parallel work over a threads within a team.
KOKKOS_INLINE_FUNCTION int team_rank() const
Rank of this thread within this team.
TeamPolicy(int league_size_request, int team_size_request, int vector_length_request=1)
Construct policy with the default instance of the execution space.
KOKKOS_INLINE_FUNCTION int team_size() const
Number of threads in this team.
RangePolicy set_chunk_size(int chunk_size_) const
set chunk_size to a discrete value
RangePolicy execution_policy
Tag this class as an execution policy.
RangePolicy(const typename traits::execution_space &work_space, const member_type work_begin, const member_type work_end)
Total range.
KOKKOS_INLINE_FUNCTION JoinOp::value_type team_reduce(const typename JoinOp::value_type, const JoinOp &) const
Intra-team reduction. Returns join of all values of the team members.
KOKKOS_INLINE_FUNCTION int league_rank() const
Rank of this team within the league of teams.
member_type chunk_size() const
return chunk_size
TeamPolicy(const typename traits::execution_space &space_, int league_size_request, int team_size_request, int vector_length_request=1)
Construct policy with the given instance of the execution space.
KOKKOS_INLINE_FUNCTION traits::execution_space::scratch_memory_space team_shmem() const
Handle to the currently executing team shared scratch memory.
KOKKOS_INLINE_FUNCTION Type team_scan(const Type &value) const
Intra-team exclusive prefix sum with team_rank() ordering.
KOKKOS_INLINE_FUNCTION WorkRange(const RangePolicy &range, const int part_rank, const int part_size)
Subrange for a partition's rank and size.
RangePolicy(const member_type work_begin, const member_type work_end, Args...args)
Total range.
RangePolicy(const typename traits::execution_space &work_space, const member_type work_begin, const member_type work_end, Args...args)
Total range.
RangePolicy(const member_type work_begin, const member_type work_end)
Total range.
KOKKOS_INLINE_FUNCTION_DELETED Impl::TeamThreadRangeBoundariesStruct< iType, TeamMemberType > TeamVectorRange(const TeamMemberType &, const iType &count)=delete
Execution policy for parallel work over a threads within a team.
Execution policy for work over a range of an integral type.
Subrange for a partition's rank and size.
KOKKOS_INLINE_FUNCTION int league_size() const
Number of teams in the league.
Execution policy for parallel work over a league of teams of threads.
Parallel execution of a functor calls the functor once with each member of the execution policy...
KOKKOS_INLINE_FUNCTION_DELETED Impl::ThreadVectorRangeBoundariesStruct< iType, TeamMemberType > ThreadVectorRange(const TeamMemberType &, const iType &count)=delete
Execution policy for a vector parallel loop.