44 #ifndef KOKKOS_EXECPOLICY_HPP
45 #define KOKKOS_EXECPOLICY_HPP
47 #include <Kokkos_Core_fwd.hpp>
48 #include <impl/Kokkos_Traits.hpp>
49 #include <impl/Kokkos_Error.hpp>
50 #include <impl/Kokkos_Tags.hpp>
51 #include <impl/Kokkos_AnalyzePolicy.hpp>
52 #include <Kokkos_Concepts.hpp>
54 #if defined(KOKKOS_ENABLE_PROFILING)
56 #endif // KOKKOS_ENABLE_PROFILING
62 struct ParallelForTag {};
63 struct ParallelScanTag {};
64 struct ParallelReduceTag {};
68 ChunkSize(
int value_):value(value_) {}
92 template<
class ... Properties>
94 :
public Impl::PolicyTraits<Properties ... >
97 typedef Impl::PolicyTraits<Properties ... > traits;
100 typename traits::execution_space m_space ;
101 typename traits::index_type m_begin ;
102 typename traits::index_type m_end ;
103 typename traits::index_type m_granularity ;
104 typename traits::index_type m_granularity_mask ;
106 template<
class ... OtherProperties>
112 typedef typename traits::index_type member_type ;
113 typedef typename traits::index_type index_type;
115 KOKKOS_INLINE_FUNCTION
const typename traits::execution_space & space()
const {
return m_space ; }
116 KOKKOS_INLINE_FUNCTION member_type begin()
const {
return m_begin ; }
117 KOKKOS_INLINE_FUNCTION member_type end()
const {
return m_end ; }
122 void operator()(
const int&)
const {}
124 RangePolicy(
const RangePolicy&) =
default;
125 RangePolicy(RangePolicy&&) =
default;
127 template<
class ... OtherProperties>
128 RangePolicy(
const RangePolicy<OtherProperties...> p) {
132 m_granularity = p.m_granularity;
133 m_granularity_mask = p.m_granularity_mask;
136 inline RangePolicy() : m_space(), m_begin(0), m_end(0) {}
141 ,
const member_type work_begin
142 ,
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)
150 set_auto_chunk_size();
156 ,
const member_type work_end
159 , work_begin , work_end )
161 set_auto_chunk_size();
165 template<
class ... Args>
168 ,
const member_type work_begin
169 ,
const member_type work_end
172 : m_space( work_space )
173 , m_begin( work_begin < work_end ? work_begin : 0 )
174 , m_end( work_begin < work_end ? work_end : 0 )
176 , m_granularity_mask(0)
178 set_auto_chunk_size();
183 template<
class ... Args>
186 ,
const member_type work_end
190 , work_begin , work_end )
192 set_auto_chunk_size();
200 template<
class ... Args>
201 inline void set(Args ...) {
202 static_assert( 0 ==
sizeof...(Args),
"Kokkos::RangePolicy: unhandled constructor arguments encountered.");
205 template<
class ... Args>
206 inline void set(
const ChunkSize& chunksize, Args ... args) {
207 m_granularity = chunksize.value;
208 m_granularity_mask = m_granularity - 1;
214 return m_granularity;
220 p.m_granularity = chunk_size_;
221 p.m_granularity_mask = p.m_granularity - 1;
227 inline void set_auto_chunk_size() {
229 typename traits::index_type concurrency = traits::execution_space::concurrency();
230 if( concurrency==0 ) concurrency=1;
232 if(m_granularity > 0) {
233 if(!Impl::is_integral_power_of_two( m_granularity ))
234 Kokkos::abort(
"RangePolicy blocking granularity must be power of two" );
237 member_type new_chunk_size = 1;
238 while(new_chunk_size*100*concurrency < m_end-m_begin)
240 if(new_chunk_size < 128) {
242 while( (new_chunk_size*40*concurrency < m_end-m_begin ) && (new_chunk_size<128) )
245 m_granularity = new_chunk_size;
246 m_granularity_mask = m_granularity - 1;
255 typedef typename RangePolicy::work_tag work_tag ;
256 typedef typename RangePolicy::member_type member_type ;
258 KOKKOS_INLINE_FUNCTION member_type begin()
const {
return m_begin ; }
259 KOKKOS_INLINE_FUNCTION member_type end()
const {
return m_end ; }
265 KOKKOS_INLINE_FUNCTION
267 ,
const int part_rank
268 ,
const int part_size
270 : m_begin(0), m_end(0)
275 const member_type work_part =
276 ( ( ( ( range.end() - range.begin() ) + ( part_size - 1 ) ) / part_size )
277 + range.m_granularity_mask ) & ~member_type(range.m_granularity_mask);
279 m_begin = range.begin() + work_part * part_rank ;
280 m_end = m_begin + work_part ;
282 if ( range.end() < m_begin ) m_begin = range.end() ;
283 if ( range.end() < m_end ) m_end = range.end() ;
288 member_type m_begin ;
304 template<
class ExecSpace,
class ... Properties>
305 class TeamPolicyInternal:
public Impl::PolicyTraits<Properties ... > {
307 typedef Impl::PolicyTraits<Properties ... > traits;
311 typedef typename traits::index_type index_type;
324 template<
class FunctorType >
325 static int team_size_max(
const FunctorType & );
337 template<
class FunctorType >
338 static int team_size_recommended(
const FunctorType & );
340 template<
class FunctorType >
341 static int team_size_recommended(
const FunctorType & ,
const int&);
343 template<
class FunctorType>
344 int team_size_recommended(
const FunctorType & functor ,
const int vector_length);
348 TeamPolicyInternal(
const typename traits::execution_space & ,
int league_size_request ,
int team_size_request ,
int vector_length_request = 1 );
350 TeamPolicyInternal(
const typename traits::execution_space & ,
int league_size_request ,
const Kokkos::AUTO_t & ,
int vector_length_request = 1 );
353 TeamPolicyInternal(
int league_size_request ,
int team_size_request ,
int vector_length_request = 1 );
355 TeamPolicyInternal(
int league_size_request ,
const Kokkos::AUTO_t & ,
int vector_length_request = 1 );
366 KOKKOS_INLINE_FUNCTION
int league_size()
const ;
373 KOKKOS_INLINE_FUNCTION
int team_size()
const ;
375 inline typename traits::index_type chunk_size()
const ;
377 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
378 inline TeamPolicyInternal set_chunk_size(
int chunk_size)
const ;
380 inline TeamPolicyInternal& set_chunk_size(
int chunk_size);
389 KOKKOS_INLINE_FUNCTION
390 typename traits::execution_space::scratch_memory_space
team_shmem()
const ;
399 KOKKOS_INLINE_FUNCTION
int team_rank()
const ;
402 KOKKOS_INLINE_FUNCTION
int team_size()
const ;
408 template<
class JoinOp >
409 KOKKOS_INLINE_FUNCTION
410 typename JoinOp::value_type
team_reduce(
const typename JoinOp::value_type
411 ,
const JoinOp & )
const ;
418 template<
typename Type >
419 KOKKOS_INLINE_FUNCTION Type
team_scan(
const Type & value )
const ;
430 template<
typename Type >
431 KOKKOS_INLINE_FUNCTION Type
team_scan(
const Type & value , Type *
const global_accum )
const ;
436 struct PerTeamValue {
438 PerTeamValue(
int arg);
441 struct PerThreadValue {
443 PerThreadValue(
int arg);
446 template<
class iType,
class ... Args>
447 struct ExtractVectorLength {
448 static inline iType value(
typename std::enable_if<std::is_integral<iType>::value,iType>::type val, Args...) {
451 static inline typename std::enable_if<!std::is_integral<iType>::value,
int>::type value(
typename std::enable_if<!std::is_integral<iType>::value,iType>::type, Args...) {
456 template<
class iType,
class ... Args>
457 inline typename std::enable_if<std::is_integral<iType>::value,iType>::type extract_vector_length(iType val, Args...) {
461 template<
class iType,
class ... Args>
462 inline typename std::enable_if<!std::is_integral<iType>::value,
int>::type extract_vector_length(iType, Args...) {
468 Impl::PerTeamValue PerTeam(
const int& arg);
469 Impl::PerThreadValue PerThread(
const int& arg);
471 struct ScratchRequest {
478 ScratchRequest(
const int& level_,
const Impl::PerTeamValue& team_value) {
480 per_team = team_value.value;
485 ScratchRequest(
const int& level_,
const Impl::PerThreadValue& thread_value) {
488 per_thread = thread_value.value;;
492 ScratchRequest(
const int& level_,
const Impl::PerTeamValue& team_value,
const Impl::PerThreadValue& thread_value) {
494 per_team = team_value.value;
495 per_thread = thread_value.value;;
499 ScratchRequest(
const int& level_,
const Impl::PerThreadValue& thread_value,
const Impl::PerTeamValue& team_value) {
501 per_team = team_value.value;
502 per_thread = thread_value.value;;
532 template<
class ... Properties>
534 Impl::TeamPolicyInternal<
535 typename Impl::PolicyTraits<Properties ... >::execution_space,
537 typedef Impl::TeamPolicyInternal<
538 typename Impl::PolicyTraits<Properties ... >::execution_space,
539 Properties ...> internal_policy;
541 template<
class ... OtherProperties>
545 typedef Impl::PolicyTraits<Properties ... > traits;
552 TeamPolicy(
const typename traits::execution_space & space_ ,
int league_size_request ,
int team_size_request ,
int vector_length_request = 1 )
553 : internal_policy(space_,league_size_request,team_size_request, vector_length_request) {first_arg =
false;}
555 TeamPolicy(
const typename traits::execution_space & space_,
int league_size_request ,
const Kokkos::AUTO_t & ,
int vector_length_request = 1 )
556 : internal_policy(space_,league_size_request,Kokkos::AUTO(), vector_length_request) {first_arg =
false;}
559 TeamPolicy(
int league_size_request ,
int team_size_request ,
int vector_length_request = 1 )
560 : internal_policy(league_size_request,team_size_request, vector_length_request) {first_arg =
false;}
562 TeamPolicy(
int league_size_request ,
const Kokkos::AUTO_t & ,
int vector_length_request = 1 )
563 : internal_policy(league_size_request,Kokkos::AUTO(), vector_length_request) {first_arg =
false;}
565 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
567 template<
class ... Args>
568 TeamPolicy(
const typename traits::execution_space & ,
int league_size_request ,
int team_size_request ,
int vector_length_request,
570 : internal_policy(typename traits::execution_space(),league_size_request,team_size_request, vector_length_request) {
575 template<
class ... Args>
576 TeamPolicy(
const typename traits::execution_space & ,
int league_size_request ,
const Kokkos::AUTO_t & ,
int vector_length_request ,
578 : internal_policy(typename traits::execution_space(),league_size_request,Kokkos::AUTO(), vector_length_request) {
584 template<
class ... Args>
585 TeamPolicy(
int league_size_request ,
int team_size_request ,
int vector_length_request ,
587 : internal_policy(league_size_request,team_size_request, vector_length_request) {
592 template<
class ... Args>
593 TeamPolicy(
int league_size_request ,
const Kokkos::AUTO_t & ,
int vector_length_request ,
595 : internal_policy(league_size_request,Kokkos::AUTO(), vector_length_request) {
601 template<
class ... Args>
602 TeamPolicy(
const typename traits::execution_space & ,
int league_size_request ,
int team_size_request ,
604 : internal_policy(typename traits::execution_space(),league_size_request,team_size_request,
605 Kokkos::Impl::extract_vector_length<Args...>(args...)) {
610 template<
class ... Args>
611 TeamPolicy(
const typename traits::execution_space & ,
int league_size_request ,
const Kokkos::AUTO_t & ,
613 : internal_policy(typename traits::execution_space(),league_size_request,Kokkos::AUTO(),
614 Kokkos::Impl::extract_vector_length<Args...>(args...)) {
620 template<
class ... Args>
621 TeamPolicy(
int league_size_request ,
int team_size_request ,
623 : internal_policy(league_size_request,team_size_request,
624 Kokkos::Impl::extract_vector_length<Args...>(args...)) {
629 template<
class ... Args>
630 TeamPolicy(
int league_size_request ,
const Kokkos::AUTO_t & ,
632 : internal_policy(league_size_request,Kokkos::AUTO(),
633 Kokkos::Impl::extract_vector_length<Args...>(args...)) {
639 template<
class ... OtherProperties>
640 TeamPolicy(
const TeamPolicy<OtherProperties...> p):internal_policy(p) {
641 first_arg = p.first_arg;
646 TeamPolicy(
const internal_policy& p):internal_policy(p) {first_arg =
false;}
648 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
653 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
654 template<
class ... Args>
655 inline void set(Args ...) {
656 static_assert( 0 ==
sizeof...(Args),
"Kokkos::TeamPolicy: unhandled constructor arguments encountered.");
659 template<
class iType,
class ... Args>
660 inline typename std::enable_if<std::is_integral<iType>::value>::type set(iType, Args ... args) {
666 Kokkos::Impl::throw_runtime_exception(
"Kokkos::TeamPolicy: integer argument to constructor in illegal place.");
670 template<
class ... Args>
671 inline void set(
const ChunkSize& chunksize, Args ... args) {
673 internal_policy::internal_set_chunk_size(chunksize.value);
677 template<
class ... Args>
678 inline void set(
const ScratchRequest& scr_request, Args ... args) {
680 internal_policy::internal_set_scratch_size(scr_request.level,Impl::PerTeamValue(scr_request.per_team),
681 Impl::PerThreadValue(scr_request.per_thread));
685 inline TeamPolicy set_chunk_size(
int chunk)
const {
686 return TeamPolicy(internal_policy::set_chunk_size(chunk));
689 inline TeamPolicy set_scratch_size(
const int& level,
const Impl::PerTeamValue& per_team)
const {
690 return TeamPolicy(internal_policy::set_scratch_size(level,per_team));
692 inline TeamPolicy set_scratch_size(
const int& level,
const Impl::PerThreadValue& per_thread)
const {
693 return TeamPolicy(internal_policy::set_scratch_size(level,per_thread));
695 inline TeamPolicy set_scratch_size(
const int& level,
const Impl::PerTeamValue& per_team,
const Impl::PerThreadValue& per_thread)
const {
696 return TeamPolicy(internal_policy::set_scratch_size(level, per_team, per_thread));
698 inline TeamPolicy set_scratch_size(
const int& level,
const Impl::PerThreadValue& per_thread,
const Impl::PerTeamValue& per_team)
const {
699 return TeamPolicy(internal_policy::set_scratch_size(level, per_team, per_thread));
703 inline TeamPolicy& set_chunk_size(
int chunk) {
704 static_assert(std::is_same<decltype(internal_policy::set_chunk_size(chunk)), internal_policy&>::value,
"internal set_chunk_size should return a reference");
705 return static_cast<TeamPolicy&
>(internal_policy::set_chunk_size(chunk));
708 inline TeamPolicy& set_scratch_size(
const int& level,
const Impl::PerTeamValue& per_team) {
709 static_assert(std::is_same<decltype(internal_policy::set_scratch_size(level,per_team)), internal_policy&>::value,
"internal set_chunk_size should return a reference");
710 return static_cast<TeamPolicy&
>(internal_policy::set_scratch_size(level,per_team));
712 inline TeamPolicy& set_scratch_size(
const int& level,
const Impl::PerThreadValue& per_thread) {
713 return static_cast<TeamPolicy&
>(internal_policy::set_scratch_size(level,per_thread));
715 inline TeamPolicy& set_scratch_size(
const int& level,
const Impl::PerTeamValue& per_team,
const Impl::PerThreadValue& per_thread) {
716 return static_cast<TeamPolicy&
>(internal_policy::set_scratch_size(level, per_team, per_thread));
718 inline TeamPolicy& set_scratch_size(
const int& level,
const Impl::PerThreadValue& per_thread,
const Impl::PerTeamValue& per_team) {
719 return static_cast<TeamPolicy&
>(internal_policy::set_scratch_size(level, per_team, per_thread));
727 template<
typename iType,
class TeamMemberType>
728 struct TeamThreadRangeBoundariesStruct {
731 KOKKOS_INLINE_FUNCTION
static
732 iType ibegin(
const iType & arg_begin
733 ,
const iType & arg_end
734 ,
const iType & arg_rank
735 ,
const iType & arg_size
738 return arg_begin + ( ( arg_end - arg_begin + arg_size - 1 ) / arg_size ) * arg_rank ;
741 KOKKOS_INLINE_FUNCTION
static
742 iType iend(
const iType & arg_begin
743 ,
const iType & arg_end
744 ,
const iType & arg_rank
745 ,
const iType & arg_size
748 const iType end_ = arg_begin + ( ( arg_end - arg_begin + arg_size - 1 ) / arg_size ) * ( arg_rank + 1 );
749 return end_ < arg_end ? end_ : arg_end ;
754 typedef iType index_type;
757 enum {increment = 1};
758 const TeamMemberType& thread;
760 KOKKOS_INLINE_FUNCTION
761 TeamThreadRangeBoundariesStruct(
const TeamMemberType& arg_thread
762 ,
const iType& arg_end
764 : start( ibegin( 0 , arg_end , arg_thread.team_rank() , arg_thread.team_size() ) )
765 , end( iend( 0 , arg_end , arg_thread.team_rank() , arg_thread.team_size() ) )
766 , thread( arg_thread )
769 KOKKOS_INLINE_FUNCTION
770 TeamThreadRangeBoundariesStruct(
const TeamMemberType& arg_thread
771 ,
const iType& arg_begin
772 ,
const iType& arg_end
774 : start( ibegin( arg_begin , arg_end , arg_thread.team_rank() , arg_thread.team_size() ) )
775 , end( iend( arg_begin , arg_end , arg_thread.team_rank() , arg_thread.team_size() ) )
776 , thread( arg_thread )
780 template<
typename iType,
class TeamMemberType>
781 struct TeamVectorRangeBoundariesStruct {
784 KOKKOS_INLINE_FUNCTION
static
785 iType ibegin(
const iType & arg_begin
786 ,
const iType & arg_end
787 ,
const iType & arg_rank
788 ,
const iType & arg_size
791 return arg_begin + ( ( arg_end - arg_begin + arg_size - 1 ) / arg_size ) * arg_rank ;
794 KOKKOS_INLINE_FUNCTION
static
795 iType iend(
const iType & arg_begin
796 ,
const iType & arg_end
797 ,
const iType & arg_rank
798 ,
const iType & arg_size
801 const iType end_ = arg_begin + ( ( arg_end - arg_begin + arg_size - 1 ) / arg_size ) * ( arg_rank + 1 );
802 return end_ < arg_end ? end_ : arg_end ;
807 typedef iType index_type;
810 enum {increment = 1};
811 const TeamMemberType& thread;
813 KOKKOS_INLINE_FUNCTION
814 TeamVectorRangeBoundariesStruct(
const TeamMemberType& arg_thread
815 ,
const iType& arg_end
817 : start( ibegin( 0 , arg_end , arg_thread.team_rank() , arg_thread.team_size() ) )
818 , end( iend( 0 , arg_end , arg_thread.team_rank() , arg_thread.team_size() ) )
819 , thread( arg_thread )
822 KOKKOS_INLINE_FUNCTION
823 TeamVectorRangeBoundariesStruct(
const TeamMemberType& arg_thread
824 ,
const iType& arg_begin
825 ,
const iType& arg_end
827 : start( ibegin( arg_begin , arg_end , arg_thread.team_rank() , arg_thread.team_size() ) )
828 , end( iend( arg_begin , arg_end , arg_thread.team_rank() , arg_thread.team_size() ) )
829 , thread( arg_thread )
833 template<
typename iType,
class TeamMemberType>
834 struct ThreadVectorRangeBoundariesStruct {
835 typedef iType index_type;
836 const index_type start;
837 const index_type end;
838 enum {increment = 1};
840 KOKKOS_INLINE_FUNCTION
841 constexpr ThreadVectorRangeBoundariesStruct (
const TeamMemberType,
const index_type& count ) noexcept
842 : start( static_cast<index_type>(0) )
845 KOKKOS_INLINE_FUNCTION
846 constexpr ThreadVectorRangeBoundariesStruct (
const index_type& count ) noexcept
847 : start( static_cast<index_type>(0) )
850 KOKKOS_INLINE_FUNCTION
851 constexpr ThreadVectorRangeBoundariesStruct (
const TeamMemberType,
const index_type& arg_begin,
const index_type& arg_end ) noexcept
852 : start( static_cast<index_type>(arg_begin) )
855 KOKKOS_INLINE_FUNCTION
856 constexpr ThreadVectorRangeBoundariesStruct (
const index_type& arg_begin,
const index_type& arg_end ) noexcept
857 : start( static_cast<index_type>(arg_begin) )
861 template<
class TeamMemberType>
862 struct ThreadSingleStruct {
863 const TeamMemberType& team_member;
864 KOKKOS_INLINE_FUNCTION
865 ThreadSingleStruct(
const TeamMemberType& team_member_ ) : team_member( team_member_ ) {}
868 template<
class TeamMemberType>
869 struct VectorSingleStruct {
870 const TeamMemberType& team_member;
871 KOKKOS_INLINE_FUNCTION
872 VectorSingleStruct(
const TeamMemberType& team_member_ ) : team_member( team_member_ ) {}
883 template<
typename iType,
class TeamMemberType,
class _never_use_this_overload>
884 KOKKOS_INLINE_FUNCTION_DELETED
885 Impl::TeamThreadRangeBoundariesStruct<iType,TeamMemberType>
894 template<
typename iType1,
typename iType2,
class TeamMemberType,
class _never_use_this_overload>
895 KOKKOS_INLINE_FUNCTION_DELETED
896 Impl::TeamThreadRangeBoundariesStruct<typename std::common_type<iType1, iType2>::type, TeamMemberType>
897 TeamThreadRange(
const TeamMemberType&,
const iType1& begin,
const iType2& end ) =
delete;
905 template<
typename iType,
class TeamMemberType,
class _never_use_this_overload>
906 KOKKOS_INLINE_FUNCTION_DELETED
907 Impl::TeamThreadRangeBoundariesStruct<iType,TeamMemberType>
916 template<
typename iType1,
typename iType2,
class TeamMemberType,
class _never_use_this_overload>
917 KOKKOS_INLINE_FUNCTION_DELETED
918 Impl::TeamThreadRangeBoundariesStruct<typename std::common_type<iType1, iType2>::type, TeamMemberType>
919 TeamVectorRange(
const TeamMemberType&,
const iType1& begin,
const iType2& end ) =
delete;
927 template<
typename iType,
class TeamMemberType,
class _never_use_this_overload>
928 KOKKOS_INLINE_FUNCTION_DELETED
929 Impl::ThreadVectorRangeBoundariesStruct<iType,TeamMemberType>
932 template<
typename iType,
class TeamMemberType,
class _never_use_this_overload>
933 KOKKOS_INLINE_FUNCTION_DELETED
934 Impl::ThreadVectorRangeBoundariesStruct<iType,TeamMemberType>
935 ThreadVectorRange(
const TeamMemberType&,
const iType& arg_begin,
const iType& arg_end ) =
delete;
937 #if defined(KOKKOS_ENABLE_PROFILING)
940 template<
typename FunctorType,
typename TagType,
941 bool HasTag = !std::is_same<TagType, void>::value >
942 struct ParallelConstructName;
944 template<
typename FunctorType,
typename TagType>
945 struct ParallelConstructName<FunctorType, TagType, true> {
946 ParallelConstructName(std::string
const& label):label_ref(label) {
948 default_name = std::string(
typeid(FunctorType).name()) +
"/" +
949 typeid(TagType).name();
952 std::string
const&
get() {
953 return (label_ref.empty()) ? default_name : label_ref;
955 std::string
const& label_ref;
956 std::string default_name;
959 template<
typename FunctorType,
typename TagType>
960 struct ParallelConstructName<FunctorType, TagType, false> {
961 ParallelConstructName(std::string
const& label):label_ref(label) {
963 default_name = std::string(
typeid(FunctorType).name());
966 std::string
const&
get() {
967 return (label_ref.empty()) ? default_name : label_ref;
969 std::string
const& label_ref;
970 std::string default_name;
979 namespace Experimental {
982 template<
class Property,
class Policy>
983 struct PolicyPropertyAdaptor;
985 template<
unsigned long P,
class ... Properties>
986 struct PolicyPropertyAdaptor<WorkItemProperty::ImplWorkItemProperty<P>,RangePolicy<Properties...>> {
987 typedef RangePolicy<Properties...> policy_in_t;
988 typedef RangePolicy<
typename policy_in_t::traits::execution_space,
989 typename policy_in_t::traits::schedule_type,
990 typename policy_in_t::traits::work_tag,
991 typename policy_in_t::traits::index_type,
992 typename policy_in_t::traits::iteration_pattern,
993 typename policy_in_t::traits::launch_bounds,
994 WorkItemProperty::ImplWorkItemProperty<P>> policy_out_t;
997 template<
unsigned long P,
class ... Properties>
998 struct PolicyPropertyAdaptor<WorkItemProperty::ImplWorkItemProperty<P>,TeamPolicy<Properties...>> {
999 typedef TeamPolicy<Properties...> policy_in_t;
1000 typedef TeamPolicy<
typename policy_in_t::traits::execution_space,
1001 typename policy_in_t::traits::schedule_type,
1002 typename policy_in_t::traits::work_tag,
1003 typename policy_in_t::traits::index_type,
1004 typename policy_in_t::traits::iteration_pattern,
1005 typename policy_in_t::traits::launch_bounds,
1006 WorkItemProperty::ImplWorkItemProperty<P>> policy_out_t;
1010 template<
class PolicyType,
unsigned long P>
1011 constexpr
typename Impl::PolicyPropertyAdaptor<WorkItemProperty::ImplWorkItemProperty<P>,PolicyType>::policy_out_t
1012 require(
const PolicyType p, WorkItemProperty::ImplWorkItemProperty<P>){
1013 return typename Impl::PolicyPropertyAdaptor<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_DELETED Impl::ThreadVectorRangeBoundariesStruct< iType, TeamMemberType > ThreadVectorRange(const TeamMemberType &, const iType &count)=delete
Execution policy for a vector parallel loop.
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.
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::TeamThreadRangeBoundariesStruct< iType, TeamMemberType > TeamVectorRange(const TeamMemberType &, const iType &count)=delete
Execution policy for parallel work over a threads within a team.