44 #ifndef KOKKOS_VIEW_HPP
45 #define KOKKOS_VIEW_HPP
47 #include <type_traits>
50 #include <initializer_list>
52 #include <Kokkos_Core_fwd.hpp>
53 #include <Kokkos_HostSpace.hpp>
54 #include <Kokkos_MemoryTraits.hpp>
55 #include <Kokkos_ExecPolicy.hpp>
57 #if defined(KOKKOS_ENABLE_PROFILING)
58 #include <impl/Kokkos_Profiling_Interface.hpp>
67 template<
class DataType >
68 struct ViewArrayAnalysis ;
70 template<
class DataType ,
class ArrayLayout
71 ,
typename ValueType =
72 typename ViewArrayAnalysis< DataType >::non_const_value_type
74 struct ViewDataAnalysis ;
76 template< class ,
class ... >
77 class ViewMapping {
public:
enum { is_assignable =
false }; };
81 template <
typename IntType>
82 KOKKOS_INLINE_FUNCTION
83 std::size_t count_valid_integers(
const IntType i0,
91 static_assert(std::is_integral<IntType>::value,
"count_valid_integers() must have integer arguments.");
93 return ( i0 !=KOKKOS_INVALID_INDEX ) + ( i1 !=KOKKOS_INVALID_INDEX ) + ( i2 !=KOKKOS_INVALID_INDEX ) +
94 ( i3 !=KOKKOS_INVALID_INDEX ) + ( i4 !=KOKKOS_INVALID_INDEX ) + ( i5 !=KOKKOS_INVALID_INDEX ) +
95 ( i6 !=KOKKOS_INVALID_INDEX ) + ( i7 !=KOKKOS_INVALID_INDEX );
100 KOKKOS_INLINE_FUNCTION
101 void runtime_check_rank_device(
const size_t dyn_rank,
102 const bool is_void_spec,
112 #ifndef KOKKOS_ENABLE_DEPRECATED_CODE
114 if ( is_void_spec ) {
115 const size_t num_passed_args = count_valid_integers(i0, i1, i2, i3,
118 if ( num_passed_args != dyn_rank && is_void_spec ) {
120 Kokkos::abort(
"Number of arguments passed to Kokkos::View() constructor must match the dynamic rank of the view.") ;
127 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
128 KOKKOS_INLINE_FUNCTION
129 void runtime_check_rank_host(
const size_t dyn_rank,
130 const bool is_void_spec,
138 const size_t i7,
const std::string & label ){
140 #ifndef KOKKOS_ENABLE_DEPRECATED_CODE
142 if ( is_void_spec ) {
143 const size_t num_passed_args = count_valid_integers(i0, i1, i2, i3,
146 if ( num_passed_args != dyn_rank ) {
148 const std::string message =
"Constructor for Kokkos View '" + label +
"' has mismatched number of arguments. Number of arguments = "
149 + std::to_string(num_passed_args) +
" but dynamic rank = " + std::to_string(dyn_rank) +
" \n";
150 Kokkos::abort(message.c_str()) ;
163 template<
class ViewType ,
int Traits = 0 >
164 struct ViewUniformType;
190 template<
class DataType ,
class ... Properties >
196 typedef void execution_space ;
197 typedef void memory_space ;
198 typedef void HostMirrorSpace ;
199 typedef void array_layout ;
200 typedef void memory_traits ;
201 typedef void specialize ;
204 template<
class ... Prop >
208 typedef typename ViewTraits<void,Prop...>::execution_space execution_space ;
209 typedef typename ViewTraits<void,Prop...>::memory_space memory_space ;
210 typedef typename ViewTraits<void,Prop...>::HostMirrorSpace HostMirrorSpace ;
211 typedef typename ViewTraits<void,Prop...>::array_layout array_layout ;
212 typedef typename ViewTraits<void,Prop...>::memory_traits memory_traits ;
213 typedef typename ViewTraits<void,Prop...>::specialize specialize ;
216 template<
class ArrayLayout ,
class ... Prop >
217 struct ViewTraits< typename std::enable_if< Kokkos::Impl::is_array_layout<ArrayLayout>::value >::type , ArrayLayout , Prop ... >
221 typedef typename ViewTraits<void,Prop...>::execution_space execution_space ;
222 typedef typename ViewTraits<void,Prop...>::memory_space memory_space ;
223 typedef typename ViewTraits<void,Prop...>::HostMirrorSpace HostMirrorSpace ;
224 typedef ArrayLayout array_layout ;
225 typedef typename ViewTraits<void,Prop...>::memory_traits memory_traits ;
226 typedef typename ViewTraits<void,Prop...>::specialize specialize ;
229 template<
class Space ,
class ... Prop >
230 struct ViewTraits< typename std::enable_if< Kokkos::Impl::is_space<Space>::value >::type , Space , Prop ... >
234 static_assert( std::is_same<
typename ViewTraits<void,Prop...>::execution_space ,
void >::value &&
235 std::is_same<
typename ViewTraits<void,Prop...>::memory_space ,
void >::value &&
236 std::is_same<
typename ViewTraits<void,Prop...>::HostMirrorSpace ,
void >::value &&
237 std::is_same<
typename ViewTraits<void,Prop...>::array_layout ,
void >::value
238 ,
"Only one View Execution or Memory Space template argument" );
240 typedef typename Space::execution_space execution_space ;
241 typedef typename Space::memory_space memory_space ;
242 typedef typename Kokkos::Impl::HostMirror< Space >::Space HostMirrorSpace ;
243 typedef typename execution_space::array_layout array_layout ;
244 typedef typename ViewTraits<void,Prop...>::memory_traits memory_traits ;
245 typedef typename ViewTraits<void,Prop...>::specialize specialize ;
248 template<
class MemoryTraits ,
class ... Prop >
249 struct ViewTraits< typename std::enable_if< Kokkos::Impl::is_memory_traits<MemoryTraits>::value >::type , MemoryTraits , Prop ... >
253 static_assert( std::is_same<
typename ViewTraits<void,Prop...>::execution_space ,
void >::value &&
254 std::is_same<
typename ViewTraits<void,Prop...>::memory_space ,
void >::value &&
255 std::is_same<
typename ViewTraits<void,Prop...>::array_layout ,
void >::value &&
256 std::is_same<
typename ViewTraits<void,Prop...>::memory_traits ,
void >::value
257 ,
"MemoryTrait is the final optional template argument for a View" );
259 typedef void execution_space ;
260 typedef void memory_space ;
261 typedef void HostMirrorSpace ;
262 typedef void array_layout ;
263 typedef MemoryTraits memory_traits ;
264 typedef void specialize ;
268 template<
class DataType ,
class ... Properties >
273 typedef ViewTraits< void , Properties ... > prop ;
276 std::conditional< ! std::is_same< typename prop::execution_space , void >::value
277 ,
typename prop::execution_space
278 , Kokkos::DefaultExecutionSpace
283 std::conditional< ! std::is_same< typename prop::memory_space , void >::value
284 ,
typename prop::memory_space
285 ,
typename ExecutionSpace::memory_space
290 std::conditional< ! std::is_same< typename prop::array_layout , void >::value
291 ,
typename prop::array_layout
292 ,
typename ExecutionSpace::array_layout
298 < ! std::is_same< typename prop::HostMirrorSpace , void >::value
299 ,
typename prop::HostMirrorSpace
300 ,
typename Kokkos::Impl::HostMirror< ExecutionSpace >::Space
305 std::conditional< ! std::is_same< typename prop::memory_traits , void >::value
306 ,
typename prop::memory_traits
307 ,
typename Kokkos::MemoryManaged
313 typedef Kokkos::Impl::ViewDataAnalysis< DataType , ArrayLayout > data_analysis ;
320 typedef typename data_analysis::type data_type ;
321 typedef typename data_analysis::const_type const_data_type ;
322 typedef typename data_analysis::non_const_type non_const_data_type ;
327 typedef typename data_analysis::scalar_array_type scalar_array_type ;
328 typedef typename data_analysis::const_scalar_array_type const_scalar_array_type ;
329 typedef typename data_analysis::non_const_scalar_array_type non_const_scalar_array_type ;
334 typedef typename data_analysis::value_type value_type ;
335 typedef typename data_analysis::const_value_type const_value_type ;
336 typedef typename data_analysis::non_const_value_type non_const_value_type ;
341 typedef ArrayLayout array_layout ;
342 typedef typename data_analysis::dimension dimension ;
344 typedef typename std::conditional<
345 std::is_same<typename data_analysis::specialize,void>::value
346 ,
typename prop::specialize
347 ,
typename data_analysis::specialize>::type
350 enum { rank = dimension::rank };
351 enum { rank_dynamic = dimension::rank_dynamic };
356 typedef ExecutionSpace execution_space ;
357 typedef MemorySpace memory_space ;
358 typedef Kokkos::Device<ExecutionSpace,MemorySpace> device_type ;
359 typedef MemoryTraits memory_traits ;
360 typedef HostMirrorSpace host_mirror_space ;
362 typedef typename MemorySpace::size_type size_type ;
364 enum { is_hostspace = std::is_same< MemorySpace , HostSpace >::value };
365 enum { is_managed = MemoryTraits::Unmanaged == 0 };
366 enum { is_random_access = MemoryTraits::RandomAccess == 1 };
453 template<
class DataType ,
class ... Properties >
461 #include <impl/Kokkos_ViewMapping.hpp>
462 #include <impl/Kokkos_ViewArray.hpp>
471 constexpr Kokkos::Impl::ALL_t
472 ALL = Kokkos::Impl::ALL_t();
474 constexpr Kokkos::Impl::WithoutInitializing_t
475 WithoutInitializing = Kokkos::Impl::WithoutInitializing_t();
477 constexpr Kokkos::Impl::AllowPadding_t
478 AllowPadding = Kokkos::Impl::AllowPadding_t();
491 template<
class ... Args >
493 Impl::ViewCtorProp< typename Impl::ViewCtorProp< void , Args >::type ... >
497 Impl::ViewCtorProp< typename Impl::ViewCtorProp< void , Args >::type ... >
500 static_assert( ! return_type::has_pointer
501 ,
"Cannot give pointer-to-memory for view allocation" );
503 return return_type( args... );
506 template<
class ... Args >
507 KOKKOS_INLINE_FUNCTION
508 Impl::ViewCtorProp< typename Impl::ViewCtorProp< void , Args >::type ... >
509 view_wrap( Args
const & ... args )
512 Impl::ViewCtorProp< typename Impl::ViewCtorProp< void , Args >::type ... >
515 static_assert( ! return_type::has_memory_space &&
516 ! return_type::has_execution_space &&
517 ! return_type::has_label &&
518 return_type::has_pointer
519 ,
"Must only give pointer-to-memory for view wrapping" );
521 return return_type( args... );
531 template<
class DataType ,
class ... Properties >
534 template<
class >
struct is_view :
public std::false_type {};
536 template<
class D,
class ... P >
537 struct is_view<
View<D,P...> > :
public std::true_type {};
539 template<
class D,
class ... P >
540 struct is_view< const
View<D,P...> > :
public std::true_type {};
542 template<
class DataType ,
class ... Properties >
543 class View :
public ViewTraits< DataType , Properties ... > {
546 template< class ,
class ... >
friend class View ;
547 template< class ,
class ... >
friend class Kokkos::Impl::ViewMapping ;
551 typedef ViewTraits< DataType , Properties ... > traits ;
555 typedef Kokkos::Impl::ViewMapping< traits , typename traits::specialize > map_type ;
556 typedef Kokkos::Impl::SharedAllocationTracker track_type ;
565 typedef View<
typename traits::scalar_array_type ,
566 typename traits::array_layout ,
567 typename traits::device_type ,
568 typename traits::memory_traits >
572 typedef View<
typename traits::const_data_type ,
573 typename traits::array_layout ,
574 typename traits::device_type ,
575 typename traits::memory_traits >
579 typedef View<
typename traits::non_const_data_type ,
580 typename traits::array_layout ,
581 typename traits::device_type ,
582 typename traits::memory_traits >
586 typedef View<
typename traits::non_const_data_type ,
587 typename traits::array_layout ,
588 typename traits::host_mirror_space >
592 typedef View<
typename traits::non_const_data_type ,
593 typename traits::array_layout ,
594 typename traits::host_mirror_space >
599 typedef typename Impl::ViewUniformType<View,0>::const_type uniform_const_type;
600 typedef typename Impl::ViewUniformType<View,0>::runtime_type uniform_runtime_type;
601 typedef typename Impl::ViewUniformType<View,0>::runtime_const_type uniform_runtime_const_type;
602 typedef typename Impl::ViewUniformType<View,0>::nomemspace_type uniform_nomemspace_type;
603 typedef typename Impl::ViewUniformType<View,0>::const_nomemspace_type uniform_const_nomemspace_type;
604 typedef typename Impl::ViewUniformType<View,0>::runtime_nomemspace_type uniform_runtime_nomemspace_type;
605 typedef typename Impl::ViewUniformType<View,0>::runtime_const_nomemspace_type uniform_runtime_const_nomemspace_type;
610 enum { Rank = map_type::Rank };
618 template<
typename iType >
619 KOKKOS_INLINE_FUNCTION constexpr
620 typename std::enable_if< std::is_integral<iType>::value ,
size_t >::type
622 {
return m_map.extent(r); }
624 static KOKKOS_INLINE_FUNCTION constexpr
626 static_extent(
const unsigned r ) noexcept
627 {
return map_type::static_extent(r); }
629 template<
typename iType >
630 KOKKOS_INLINE_FUNCTION constexpr
631 typename std::enable_if< std::is_integral<iType>::value ,
int >::type
632 extent_int(
const iType & r )
const noexcept
633 {
return static_cast<int>(m_map.extent(r)); }
635 KOKKOS_INLINE_FUNCTION constexpr
636 typename traits::array_layout layout()
const
637 {
return m_map.layout(); }
644 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
646 template<
typename iType >
647 KOKKOS_INLINE_FUNCTION constexpr
648 typename std::enable_if< std::is_integral<iType>::value ,
size_t >::type
649 dimension(
const iType & r )
const {
return extent( r ); }
651 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_0()
const {
return m_map.dimension_0(); }
652 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_1()
const {
return m_map.dimension_1(); }
653 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_2()
const {
return m_map.dimension_2(); }
654 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_3()
const {
return m_map.dimension_3(); }
655 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_4()
const {
return m_map.dimension_4(); }
656 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_5()
const {
return m_map.dimension_5(); }
657 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_6()
const {
return m_map.dimension_6(); }
658 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_7()
const {
return m_map.dimension_7(); }
664 KOKKOS_INLINE_FUNCTION constexpr
size_t size()
const {
return m_map.dimension_0() *
665 m_map.dimension_1() *
666 m_map.dimension_2() *
667 m_map.dimension_3() *
668 m_map.dimension_4() *
669 m_map.dimension_5() *
670 m_map.dimension_6() *
671 m_map.dimension_7(); }
673 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_0()
const {
return m_map.stride_0(); }
674 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_1()
const {
return m_map.stride_1(); }
675 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_2()
const {
return m_map.stride_2(); }
676 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_3()
const {
return m_map.stride_3(); }
677 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_4()
const {
return m_map.stride_4(); }
678 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_5()
const {
return m_map.stride_5(); }
679 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_6()
const {
return m_map.stride_6(); }
680 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_7()
const {
return m_map.stride_7(); }
682 template<
typename iType >
683 KOKKOS_INLINE_FUNCTION constexpr
684 typename std::enable_if< std::is_integral<iType>::value ,
size_t >::type
685 stride(iType r)
const {
686 return (r == 0 ? m_map.stride_0() :
687 (r == 1 ? m_map.stride_1() :
688 (r == 2 ? m_map.stride_2() :
689 (r == 3 ? m_map.stride_3() :
690 (r == 4 ? m_map.stride_4() :
691 (r == 5 ? m_map.stride_5() :
692 (r == 6 ? m_map.stride_6() :
693 m_map.stride_7())))))));
696 template<
typename iType >
697 KOKKOS_INLINE_FUNCTION
void stride( iType *
const s )
const { m_map.stride(s); }
702 typedef typename map_type::reference_type reference_type ;
703 typedef typename map_type::pointer_type pointer_type ;
705 enum { reference_type_is_lvalue_reference = std::is_lvalue_reference< reference_type >::value };
707 KOKKOS_INLINE_FUNCTION constexpr
size_t span()
const {
return m_map.span(); }
708 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
710 KOKKOS_INLINE_FUNCTION constexpr
size_t capacity()
const {
return m_map.span(); }
712 KOKKOS_INLINE_FUNCTION
bool span_is_contiguous()
const {
return m_map.span_is_contiguous(); }
713 KOKKOS_INLINE_FUNCTION constexpr pointer_type data()
const {
return m_map.data(); }
715 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
717 KOKKOS_INLINE_FUNCTION constexpr
bool is_contiguous()
const {
return m_map.span_is_contiguous(); }
719 KOKKOS_INLINE_FUNCTION constexpr pointer_type ptr_on_device()
const {
return m_map.data(); }
725 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
726 KOKKOS_INLINE_FUNCTION
727 const Kokkos::Impl::ViewMapping< traits , typename traits::specialize > &
728 implementation_map()
const {
return m_map ; }
730 KOKKOS_INLINE_FUNCTION
731 const Kokkos::Impl::ViewMapping< traits , typename traits::specialize > &
732 impl_map()
const {
return m_map ; }
733 KOKKOS_INLINE_FUNCTION
734 const Kokkos::Impl::SharedAllocationTracker &
735 impl_track()
const {
return m_track ; }
741 is_layout_left = std::is_same<
typename traits::array_layout
744 is_layout_right = std::is_same<
typename traits::array_layout
747 is_layout_stride = std::is_same<
typename traits::array_layout
751 std::is_same< typename traits::specialize , void >::value &&
752 ( is_layout_left || is_layout_right || is_layout_stride )
755 template< class Space , bool = Kokkos::Impl::MemorySpaceAccess< Space , typename traits::memory_space >::accessible >
struct verify_space
756 { KOKKOS_FORCEINLINE_FUNCTION
static void check() {} };
758 template<
class Space >
struct verify_space<Space,false>
759 { KOKKOS_FORCEINLINE_FUNCTION
static void check()
760 { Kokkos::abort(
"Kokkos::View ERROR: attempt to access inaccessible memory space"); };
763 #if defined( KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK )
765 #define KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( ARG ) \
766 View::template verify_space< Kokkos::Impl::ActiveExecutionMemorySpace >::check(); \
767 Kokkos::Impl::view_verify_operator_bounds< typename traits::memory_space > ARG ;
771 #define KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( ARG ) \
772 View::template verify_space< Kokkos::Impl::ActiveExecutionMemorySpace >::check();
777 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
778 template<
class ... Args >
779 KOKKOS_FORCEINLINE_FUNCTION
780 typename std::enable_if<( Kokkos::Impl::are_integral<Args...>::value
782 ), reference_type >::type
783 operator()( Args ... args )
const
785 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,args...) )
786 return m_map.reference();
789 template< typename I0
791 KOKKOS_FORCEINLINE_FUNCTION
792 typename std::enable_if<
793 ( Kokkos::Impl::are_integral<I0,Args...>::value
796 ), reference_type >::type
797 operator()( const I0 & i0,
800 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
801 return m_map.reference(i0);
804 template< typename I0
806 KOKKOS_FORCEINLINE_FUNCTION
807 typename std::enable_if<
808 ( Kokkos::Impl::are_integral<I0,Args...>::value
811 && ! is_layout_stride
812 ), reference_type >::type
813 operator()( const I0 & i0
814 , Args ... args )
const
816 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
817 return m_map.m_impl_handle[ i0 ];
820 template< typename I0
822 KOKKOS_FORCEINLINE_FUNCTION
823 typename std::enable_if<
824 ( Kokkos::Impl::are_integral<I0,Args...>::value
828 ), reference_type >::type
829 operator()( const I0 & i0
830 , Args ... args )
const
832 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
833 return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * i0 ];
839 template< typename I0 >
840 KOKKOS_FORCEINLINE_FUNCTION
841 typename std::enable_if<
842 ( Kokkos::Impl::are_integral<I0>::value
845 ), reference_type >::type
846 operator[]( const I0 & i0 )
const
848 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
849 return m_map.reference(i0);
852 template< typename I0 >
853 KOKKOS_FORCEINLINE_FUNCTION
854 typename std::enable_if<
855 ( Kokkos::Impl::are_integral<I0>::value
858 && ! is_layout_stride
859 ), reference_type >::type
860 operator[]( const I0 & i0 )
const
862 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
863 return m_map.m_impl_handle[ i0 ];
866 template< typename I0 >
867 KOKKOS_FORCEINLINE_FUNCTION
868 typename std::enable_if<
869 ( Kokkos::Impl::are_integral<I0>::value
873 ), reference_type >::type
874 operator[]( const I0 & i0 )
const
876 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
877 return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * i0 ];
880 template< typename I0 , typename I1
882 KOKKOS_FORCEINLINE_FUNCTION
883 typename std::enable_if<
884 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
887 ), reference_type >::type
888 operator()( const I0 & i0 , const I1 & i1
889 , Args ... args )
const
891 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
892 return m_map.reference(i0,i1);
895 template< typename I0 , typename I1
897 KOKKOS_FORCEINLINE_FUNCTION
898 typename std::enable_if<
899 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
902 && is_layout_left && ( traits::rank_dynamic == 0 )
903 ), reference_type >::type
904 operator()( const I0 & i0 , const I1 & i1
905 , Args ... args )
const
907 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
908 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_dim.N0 * i1 ];
911 template< typename I0 , typename I1
913 KOKKOS_FORCEINLINE_FUNCTION
914 typename std::enable_if<
915 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
918 && is_layout_left && ( traits::rank_dynamic != 0 )
919 ), reference_type >::type
920 operator()( const I0 & i0 , const I1 & i1
921 , Args ... args )
const
923 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
924 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_stride * i1 ];
927 template< typename I0 , typename I1
929 KOKKOS_FORCEINLINE_FUNCTION
930 typename std::enable_if<
931 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
934 && is_layout_right && ( traits::rank_dynamic == 0 )
935 ), reference_type >::type
936 operator()( const I0 & i0 , const I1 & i1
937 , Args ... args )
const
939 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
940 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_dim.N1 * i0 ];
943 template< typename I0 , typename I1
945 KOKKOS_FORCEINLINE_FUNCTION
946 typename std::enable_if<
947 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
950 && is_layout_right && ( traits::rank_dynamic != 0 )
951 ), reference_type >::type
952 operator()( const I0 & i0 , const I1 & i1
953 , Args ... args )
const
955 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
956 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_stride * i0 ];
959 template< typename I0 , typename I1
961 KOKKOS_FORCEINLINE_FUNCTION
962 typename std::enable_if<
963 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
967 ), reference_type >::type
968 operator()( const I0 & i0 , const I1 & i1
969 , Args ... args )
const
971 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
972 return m_map.m_impl_handle[ i0 * m_map.m_impl_offset.m_stride.S0 +
973 i1 * m_map.m_impl_offset.m_stride.S1 ];
979 template< typename I0 , typename I1 , typename I2
981 KOKKOS_FORCEINLINE_FUNCTION
982 typename std::enable_if<
983 ( Kokkos::Impl::are_integral<I0,I1,I2,Args...>::value
986 ), reference_type >::type
987 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2
988 , Args ... args )
const
990 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,args...) )
991 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2) ];
994 template< typename I0 , typename I1 , typename I2
996 KOKKOS_FORCEINLINE_FUNCTION
997 typename std::enable_if<
998 ( Kokkos::Impl::are_integral<I0,I1,I2,Args...>::value
1001 ), reference_type >::type
1002 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2
1003 , Args ... args )
const
1005 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,args...) )
1006 return m_map.reference(i0,i1,i2);
1012 template< typename I0 , typename I1 , typename I2 , typename I3
1014 KOKKOS_FORCEINLINE_FUNCTION
1015 typename std::enable_if<
1016 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,Args...>::value
1019 ), reference_type >::type
1020 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1021 , Args ... args )
const
1023 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,args...) )
1024 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3) ];
1027 template< typename I0 , typename I1 , typename I2 , typename I3
1029 KOKKOS_FORCEINLINE_FUNCTION
1030 typename std::enable_if<
1031 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,Args...>::value
1034 ), reference_type >::type
1035 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1036 , Args ... args )
const
1038 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,args...) )
1039 return m_map.reference(i0,i1,i2,i3);
1045 template< typename I0 , typename I1 , typename I2 , typename I3
1048 KOKKOS_FORCEINLINE_FUNCTION
1049 typename std::enable_if<
1050 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,Args...>::value
1053 ), reference_type >::type
1054 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1056 , Args ... args )
const
1058 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,args...) )
1059 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4) ];
1062 template< typename I0 , typename I1 , typename I2 , typename I3
1065 KOKKOS_FORCEINLINE_FUNCTION
1066 typename std::enable_if<
1067 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,Args...>::value
1070 ), reference_type >::type
1071 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1073 , Args ... args )
const
1075 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,args...) )
1076 return m_map.reference(i0,i1,i2,i3,i4);
1082 template< typename I0 , typename I1 , typename I2 , typename I3
1083 , typename I4 , typename I5
1085 KOKKOS_FORCEINLINE_FUNCTION
1086 typename std::enable_if<
1087 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,Args...>::value
1090 ), reference_type >::type
1091 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1092 , const I4 & i4 , const I5 & i5
1093 , Args ... args )
const
1095 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,args...) )
1096 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5) ];
1099 template< typename I0 , typename I1 , typename I2 , typename I3
1100 , typename I4 , typename I5
1102 KOKKOS_FORCEINLINE_FUNCTION
1103 typename std::enable_if<
1104 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,Args...>::value
1107 ), reference_type >::type
1108 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1109 , const I4 & i4 , const I5 & i5
1110 , Args ... args )
const
1112 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,args...) )
1113 return m_map.reference(i0,i1,i2,i3,i4,i5);
1119 template< typename I0 , typename I1 , typename I2 , typename I3
1120 , typename I4 , typename I5 , typename I6
1122 KOKKOS_FORCEINLINE_FUNCTION
1123 typename std::enable_if<
1124 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,Args...>::value
1127 ), reference_type >::type
1128 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1129 , const I4 & i4 , const I5 & i5 , const I6 & i6
1130 , Args ... args )
const
1132 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,args...) )
1133 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ];
1136 template< typename I0 , typename I1 , typename I2 , typename I3
1137 , typename I4 , typename I5 , typename I6
1139 KOKKOS_FORCEINLINE_FUNCTION
1140 typename std::enable_if<
1141 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,Args...>::value
1144 ), reference_type >::type
1145 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1146 , const I4 & i4 , const I5 & i5 , const I6 & i6
1147 , Args ... args )
const
1149 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,args...) )
1150 return m_map.reference(i0,i1,i2,i3,i4,i5,i6);
1156 template< typename I0 , typename I1 , typename I2 , typename I3
1157 , typename I4 , typename I5 , typename I6 , typename I7
1159 KOKKOS_FORCEINLINE_FUNCTION
1160 typename std::enable_if<
1161 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7,Args...>::value
1164 ), reference_type >::type
1165 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1166 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7
1167 , Args ... args )
const
1169 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7,args...) )
1170 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ];
1173 template< typename I0 , typename I1 , typename I2 , typename I3
1174 , typename I4 , typename I5 , typename I6 , typename I7
1176 KOKKOS_FORCEINLINE_FUNCTION
1177 typename std::enable_if<
1178 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7,Args...>::value
1181 ), reference_type >::type
1182 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1183 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7
1184 , Args ... args )
const
1186 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7,args...) )
1187 return m_map.reference(i0,i1,i2,i3,i4,i5,i6,i7);
1195 KOKKOS_FORCEINLINE_FUNCTION
1199 return m_map.reference();
1205 template<
typename I0>
1206 KOKKOS_FORCEINLINE_FUNCTION
1207 typename std::enable_if<
1208 ( Kokkos::Impl::are_integral<I0>::value
1211 ), reference_type >::type
1212 operator()(
const I0 & i0)
const
1214 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
1215 return m_map.reference(i0);
1218 template< typename I0>
1219 KOKKOS_FORCEINLINE_FUNCTION
1220 typename std::enable_if<
1221 ( Kokkos::Impl::are_integral<I0>::value
1224 && ! is_layout_stride
1225 ), reference_type >::type
1226 operator()( const I0 & i0 )
const
1228 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
1229 return m_map.m_impl_handle[ i0 ];
1232 template< typename I0 >
1233 KOKKOS_FORCEINLINE_FUNCTION
1234 typename std::enable_if<
1235 ( Kokkos::Impl::are_integral<I0>::value
1239 ), reference_type >::type
1240 operator()( const I0 & i0)
const
1242 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
1243 return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * i0 ];
1248 template< typename I0 >
1249 KOKKOS_FORCEINLINE_FUNCTION
1250 typename std::enable_if<
1251 ( Kokkos::Impl::are_integral<I0>::value
1254 ), reference_type >::type
1255 operator[]( const I0 & i0 )
const
1257 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
1258 return m_map.reference(i0);
1261 template< typename I0 >
1262 KOKKOS_FORCEINLINE_FUNCTION
1263 typename std::enable_if<
1264 ( Kokkos::Impl::are_integral<I0>::value
1267 && ! is_layout_stride
1268 ), reference_type >::type
1269 operator[]( const I0 & i0 )
const
1271 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
1272 return m_map.m_impl_handle[ i0 ];
1275 template< typename I0 >
1276 KOKKOS_FORCEINLINE_FUNCTION
1277 typename std::enable_if<
1278 ( Kokkos::Impl::are_integral<I0>::value
1282 ), reference_type >::type
1283 operator[]( const I0 & i0 )
const
1285 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
1286 return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * i0 ];
1293 template< typename I0 , typename I1 >
1294 KOKKOS_FORCEINLINE_FUNCTION
1295 typename std::enable_if<
1296 ( Kokkos::Impl::are_integral<I0,I1>::value
1299 ), reference_type >::type
1300 operator()( const I0 & i0 , const I1 & i1)
const
1302 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1303 return m_map.reference(i0,i1);
1306 template< typename I0 , typename I1 >
1307 KOKKOS_FORCEINLINE_FUNCTION
1308 typename std::enable_if<
1309 ( Kokkos::Impl::are_integral<I0,I1>::value
1312 && is_layout_left && ( traits::rank_dynamic == 0 )
1313 ), reference_type >::type
1314 operator()( const I0 & i0 , const I1 & i1)
const
1316 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1317 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_dim.N0 * i1 ];
1320 template< typename I0 , typename I1>
1321 KOKKOS_FORCEINLINE_FUNCTION
1322 typename std::enable_if<
1323 ( Kokkos::Impl::are_integral<I0,I1>::value
1326 && is_layout_left && ( traits::rank_dynamic != 0 )
1327 ), reference_type >::type
1328 operator()( const I0 & i0 , const I1 & i1)
const
1330 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1331 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_stride * i1 ];
1334 template< typename I0 , typename I1 >
1335 KOKKOS_FORCEINLINE_FUNCTION
1336 typename std::enable_if<
1337 ( Kokkos::Impl::are_integral<I0,I1>::value
1340 && is_layout_right && ( traits::rank_dynamic == 0 )
1341 ), reference_type >::type
1342 operator()( const I0 & i0 , const I1 & i1 )
const
1344 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1345 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_dim.N1 * i0 ];
1348 template< typename I0 , typename I1 >
1349 KOKKOS_FORCEINLINE_FUNCTION
1350 typename std::enable_if<
1351 ( Kokkos::Impl::are_integral<I0,I1>::value
1354 && is_layout_right && ( traits::rank_dynamic != 0 )
1355 ), reference_type >::type
1356 operator()( const I0 & i0 , const I1 & i1 )
const
1358 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1359 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_stride * i0 ];
1362 template< typename I0 , typename I1>
1363 KOKKOS_FORCEINLINE_FUNCTION
1364 typename std::enable_if<
1365 ( Kokkos::Impl::are_integral<I0,I1>::value
1369 ), reference_type >::type
1370 operator()( const I0 & i0 , const I1 & i1 )
const
1372 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1373 return m_map.m_impl_handle[ i0 * m_map.m_impl_offset.m_stride.S0 +
1374 i1 * m_map.m_impl_offset.m_stride.S1 ];
1380 template< typename I0 , typename I1 , typename I2 >
1381 KOKKOS_FORCEINLINE_FUNCTION
1382 typename std::enable_if<
1383 ( Kokkos::Impl::are_integral<I0,I1,I2>::value
1386 ), reference_type >::type
1387 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2)
const
1389 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2) )
1390 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2) ];
1393 template< typename I0 , typename I1 , typename I2>
1394 KOKKOS_FORCEINLINE_FUNCTION
1395 typename std::enable_if<
1396 ( Kokkos::Impl::are_integral<I0,I1,I2>::value
1399 ), reference_type >::type
1400 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2)
const
1402 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2) )
1403 return m_map.reference(i0,i1,i2);
1409 template< typename I0 , typename I1 , typename I2 , typename I3>
1410 KOKKOS_FORCEINLINE_FUNCTION
1411 typename std::enable_if<
1412 ( Kokkos::Impl::are_integral<I0,I1,I2,I3>::value
1415 ), reference_type >::type
1416 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3)
const
1418 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3) )
1419 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3) ];
1422 template< typename I0 , typename I1 , typename I2 , typename I3 >
1423 KOKKOS_FORCEINLINE_FUNCTION
1424 typename std::enable_if<
1425 ( Kokkos::Impl::are_integral<I0,I1,I2,I3>::value
1428 ), reference_type >::type
1429 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3)
const
1431 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3) )
1432 return m_map.reference(i0,i1,i2,i3);
1438 template< typename I0 , typename I1 , typename I2 , typename I3
1440 KOKKOS_FORCEINLINE_FUNCTION
1441 typename std::enable_if<
1442 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4>::value
1445 ), reference_type >::type
1446 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1447 , const I4 & i4 )
const
1449 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4) )
1450 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4) ];
1453 template< typename I0 , typename I1 , typename I2 , typename I3
1455 KOKKOS_FORCEINLINE_FUNCTION
1456 typename std::enable_if<
1457 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4>::value
1460 ), reference_type >::type
1461 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1462 , const I4 & i4)
const
1464 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4) )
1465 return m_map.reference(i0,i1,i2,i3,i4);
1471 template< typename I0 , typename I1 , typename I2 , typename I3
1472 , typename I4 , typename I5 >
1473 KOKKOS_FORCEINLINE_FUNCTION
1474 typename std::enable_if<
1475 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5>::value
1478 ), reference_type >::type
1479 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1480 , const I4 & i4 , const I5 & i5 )
const
1482 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5) )
1483 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5) ];
1486 template< typename I0 , typename I1 , typename I2 , typename I3
1487 , typename I4 , typename I5>
1488 KOKKOS_FORCEINLINE_FUNCTION
1489 typename std::enable_if<
1490 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5>::value
1493 ), reference_type >::type
1494 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1495 , const I4 & i4 , const I5 & i5)
const
1497 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5) )
1498 return m_map.reference(i0,i1,i2,i3,i4,i5);
1504 template< typename I0 , typename I1 , typename I2 , typename I3
1505 , typename I4 , typename I5 , typename I6>
1506 KOKKOS_FORCEINLINE_FUNCTION
1507 typename std::enable_if<
1508 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6>::value
1511 ), reference_type >::type
1512 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1513 , const I4 & i4 , const I5 & i5 , const I6 & i6)
const
1515 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6) )
1516 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ];
1519 template< typename I0 , typename I1 , typename I2 , typename I3
1520 , typename I4 , typename I5 , typename I6 >
1521 KOKKOS_FORCEINLINE_FUNCTION
1522 typename std::enable_if<
1523 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6>::value
1526 ), reference_type >::type
1527 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1528 , const I4 & i4 , const I5 & i5 , const I6 & i6)
const
1530 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6) )
1531 return m_map.reference(i0,i1,i2,i3,i4,i5,i6);
1537 template< typename I0 , typename I1 , typename I2 , typename I3
1538 , typename I4 , typename I5 , typename I6 , typename I7 >
1539 KOKKOS_FORCEINLINE_FUNCTION
1540 typename std::enable_if<
1541 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7>::value
1544 ), reference_type >::type
1545 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1546 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7)
const
1548 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7) )
1549 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ];
1552 template< typename I0 , typename I1 , typename I2 , typename I3
1553 , typename I4 , typename I5 , typename I6 , typename I7>
1554 KOKKOS_FORCEINLINE_FUNCTION
1555 typename std::enable_if<
1556 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7>::value
1559 ), reference_type >::type
1560 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1561 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7 )
const
1563 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7) )
1564 return m_map.reference(i0,i1,i2,i3,i4,i5,i6,i7);
1568 template<
class ... Args >
1569 KOKKOS_FORCEINLINE_FUNCTION
1570 typename std::enable_if<( Kokkos::Impl::are_integral<Args...>::value
1572 ), reference_type >::type
1573 access( Args ... args )
const
1575 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,args...) )
1576 return m_map.reference();
1579 template< typename I0
1581 KOKKOS_FORCEINLINE_FUNCTION
1582 typename std::enable_if<
1583 ( Kokkos::Impl::are_integral<I0,Args...>::value
1586 ), reference_type >::type
1587 access( const I0 & i0,
1588 Args ... args)
const
1590 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
1591 return m_map.reference(i0);
1594 template< typename I0
1596 KOKKOS_FORCEINLINE_FUNCTION
1597 typename std::enable_if<
1598 ( Kokkos::Impl::are_integral<I0,Args...>::value
1601 && ! is_layout_stride
1602 ), reference_type >::type
1603 access( const I0 & i0
1604 , Args ... args )
const
1606 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
1607 return m_map.m_impl_handle[ i0 ];
1610 template< typename I0
1612 KOKKOS_FORCEINLINE_FUNCTION
1613 typename std::enable_if<
1614 ( Kokkos::Impl::are_integral<I0,Args...>::value
1618 ), reference_type >::type
1619 access( const I0 & i0
1620 , Args ... args )
const
1622 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
1623 return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * i0 ];
1626 template< typename I0 , typename I1
1628 KOKKOS_FORCEINLINE_FUNCTION
1629 typename std::enable_if<
1630 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1633 ), reference_type >::type
1634 access( const I0 & i0 , const I1 & i1
1635 , Args ... args )
const
1637 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1638 return m_map.reference(i0,i1);
1641 template< typename I0 , typename I1
1643 KOKKOS_FORCEINLINE_FUNCTION
1644 typename std::enable_if<
1645 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1648 && is_layout_left && ( traits::rank_dynamic == 0 )
1649 ), reference_type >::type
1650 access( const I0 & i0 , const I1 & i1
1651 , Args ... args )
const
1653 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1654 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_dim.N0 * i1 ];
1657 template< typename I0 , typename I1
1659 KOKKOS_FORCEINLINE_FUNCTION
1660 typename std::enable_if<
1661 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1664 && is_layout_left && ( traits::rank_dynamic != 0 )
1665 ), reference_type >::type
1666 access( const I0 & i0 , const I1 & i1
1667 , Args ... args )
const
1669 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1670 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_stride * i1 ];
1673 template< typename I0 , typename I1
1675 KOKKOS_FORCEINLINE_FUNCTION
1676 typename std::enable_if<
1677 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1680 && is_layout_right && ( traits::rank_dynamic == 0 )
1681 ), reference_type >::type
1682 access( const I0 & i0 , const I1 & i1
1683 , Args ... args )
const
1685 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1686 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_dim.N1 * i0 ];
1689 template< typename I0 , typename I1
1691 KOKKOS_FORCEINLINE_FUNCTION
1692 typename std::enable_if<
1693 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1696 && is_layout_right && ( traits::rank_dynamic != 0 )
1697 ), reference_type >::type
1698 access( const I0 & i0 , const I1 & i1
1699 , Args ... args )
const
1701 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1702 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_stride * i0 ];
1705 template< typename I0 , typename I1
1707 KOKKOS_FORCEINLINE_FUNCTION
1708 typename std::enable_if<
1709 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1713 ), reference_type >::type
1714 access( const I0 & i0 , const I1 & i1
1715 , Args ... args )
const
1717 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1718 return m_map.m_impl_handle[ i0 * m_map.m_impl_offset.m_stride.S0 +
1719 i1 * m_map.m_impl_offset.m_stride.S1 ];
1725 template< typename I0 , typename I1 , typename I2
1727 KOKKOS_FORCEINLINE_FUNCTION
1728 typename std::enable_if<
1729 ( Kokkos::Impl::are_integral<I0,I1,I2,Args...>::value
1732 ), reference_type >::type
1733 access( const I0 & i0 , const I1 & i1 , const I2 & i2
1734 , Args ... args )
const
1736 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,args...) )
1737 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2) ];
1740 template< typename I0 , typename I1 , typename I2
1742 KOKKOS_FORCEINLINE_FUNCTION
1743 typename std::enable_if<
1744 ( Kokkos::Impl::are_integral<I0,I1,I2,Args...>::value
1747 ), reference_type >::type
1748 access( const I0 & i0 , const I1 & i1 , const I2 & i2
1749 , Args ... args )
const
1751 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,args...) )
1752 return m_map.reference(i0,i1,i2);
1758 template< typename I0 , typename I1 , typename I2 , typename I3
1760 KOKKOS_FORCEINLINE_FUNCTION
1761 typename std::enable_if<
1762 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,Args...>::value
1765 ), reference_type >::type
1766 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1767 , Args ... args )
const
1769 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,args...) )
1770 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3) ];
1773 template< typename I0 , typename I1 , typename I2 , typename I3
1775 KOKKOS_FORCEINLINE_FUNCTION
1776 typename std::enable_if<
1777 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,Args...>::value
1780 ), reference_type >::type
1781 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1782 , Args ... args )
const
1784 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,args...) )
1785 return m_map.reference(i0,i1,i2,i3);
1791 template< typename I0 , typename I1 , typename I2 , typename I3
1794 KOKKOS_FORCEINLINE_FUNCTION
1795 typename std::enable_if<
1796 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,Args...>::value
1799 ), reference_type >::type
1800 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1802 , Args ... args )
const
1804 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,args...) )
1805 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4) ];
1808 template< typename I0 , typename I1 , typename I2 , typename I3
1811 KOKKOS_FORCEINLINE_FUNCTION
1812 typename std::enable_if<
1813 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,Args...>::value
1816 ), reference_type >::type
1817 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1819 , Args ... args )
const
1821 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,args...) )
1822 return m_map.reference(i0,i1,i2,i3,i4);
1828 template< typename I0 , typename I1 , typename I2 , typename I3
1829 , typename I4 , typename I5
1831 KOKKOS_FORCEINLINE_FUNCTION
1832 typename std::enable_if<
1833 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,Args...>::value
1836 ), reference_type >::type
1837 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1838 , const I4 & i4 , const I5 & i5
1839 , Args ... args )
const
1841 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,args...) )
1842 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5) ];
1845 template< typename I0 , typename I1 , typename I2 , typename I3
1846 , typename I4 , typename I5
1848 KOKKOS_FORCEINLINE_FUNCTION
1849 typename std::enable_if<
1850 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,Args...>::value
1853 ), reference_type >::type
1854 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1855 , const I4 & i4 , const I5 & i5
1856 , Args ... args )
const
1858 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,args...) )
1859 return m_map.reference(i0,i1,i2,i3,i4,i5);
1865 template< typename I0 , typename I1 , typename I2 , typename I3
1866 , typename I4 , typename I5 , typename I6
1868 KOKKOS_FORCEINLINE_FUNCTION
1869 typename std::enable_if<
1870 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,Args...>::value
1873 ), reference_type >::type
1874 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1875 , const I4 & i4 , const I5 & i5 , const I6 & i6
1876 , Args ... args )
const
1878 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,args...) )
1879 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ];
1882 template< typename I0 , typename I1 , typename I2 , typename I3
1883 , typename I4 , typename I5 , typename I6
1885 KOKKOS_FORCEINLINE_FUNCTION
1886 typename std::enable_if<
1887 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,Args...>::value
1890 ), reference_type >::type
1891 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1892 , const I4 & i4 , const I5 & i5 , const I6 & i6
1893 , Args ... args )
const
1895 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,args...) )
1896 return m_map.reference(i0,i1,i2,i3,i4,i5,i6);
1902 template< typename I0 , typename I1 , typename I2 , typename I3
1903 , typename I4 , typename I5 , typename I6 , typename I7
1905 KOKKOS_FORCEINLINE_FUNCTION
1906 typename std::enable_if<
1907 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7,Args...>::value
1910 ), reference_type >::type
1911 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1912 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7
1913 , Args ... args )
const
1915 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7,args...) )
1916 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ];
1919 template< typename I0 , typename I1 , typename I2 , typename I3
1920 , typename I4 , typename I5 , typename I6 , typename I7
1922 KOKKOS_FORCEINLINE_FUNCTION
1923 typename std::enable_if<
1924 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7,Args...>::value
1927 ), reference_type >::type
1928 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1929 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7
1930 , Args ... args )
const
1932 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7,args...) )
1933 return m_map.reference(i0,i1,i2,i3,i4,i5,i6,i7);
1937 #undef KOKKOS_IMPL_VIEW_OPERATOR_VERIFY
1942 KOKKOS_INLINE_FUNCTION
1945 KOKKOS_INLINE_FUNCTION
1946 View() : m_track(), m_map() {}
1948 KOKKOS_INLINE_FUNCTION
1949 View(
const View & rhs ) : m_track( rhs.m_track, traits::is_managed ), m_map( rhs.m_map ) {}
1951 KOKKOS_INLINE_FUNCTION
1952 View( View && rhs ) : m_track( std::move(rhs.m_track) ), m_map( std::move(rhs.m_map) ) {}
1954 KOKKOS_INLINE_FUNCTION
1955 View & operator = (
const View & rhs ) { m_track = rhs.m_track ; m_map = rhs.m_map ;
return *this ; }
1957 KOKKOS_INLINE_FUNCTION
1958 View & operator = ( View && rhs ) { m_track = std::move(rhs.m_track) ; m_map = std::move(rhs.m_map) ;
return *this ; }
1966 template<
class RT ,
class ... RP >
1967 KOKKOS_INLINE_FUNCTION
1968 View(
const View<RT,RP...> & rhs )
1969 : m_track( rhs.m_track , traits::is_managed )
1972 typedef typename View<RT,RP...>::traits SrcTraits ;
1973 typedef Kokkos::Impl::ViewMapping< traits , SrcTraits , typename traits::specialize > Mapping ;
1974 static_assert( Mapping::is_assignable ,
"Incompatible View copy construction" );
1975 Mapping::assign( m_map , rhs.m_map , rhs.m_track );
1978 template<
class RT ,
class ... RP >
1979 KOKKOS_INLINE_FUNCTION
1980 View & operator = (
const View<RT,RP...> & rhs )
1982 typedef typename View<RT,RP...>::traits SrcTraits ;
1983 typedef Kokkos::Impl::ViewMapping< traits , SrcTraits , typename traits::specialize > Mapping ;
1984 static_assert( Mapping::is_assignable ,
"Incompatible View copy assignment" );
1985 Mapping::assign( m_map , rhs.m_map , rhs.m_track );
1986 m_track.assign( rhs.m_track , traits::is_managed );
1994 template<
class RT ,
class ... RP ,
class Arg0 ,
class ... Args >
1995 KOKKOS_INLINE_FUNCTION
1996 View(
const View< RT , RP... > & src_view
1997 ,
const Arg0 & arg0 , Args ... args )
1998 : m_track( src_view.m_track , traits::is_managed )
2001 typedef View< RT , RP... > SrcType ;
2003 typedef Kokkos::Impl::ViewMapping
2005 ,
typename SrcType::traits
2006 , Arg0 , Args... > Mapping ;
2008 typedef typename Mapping::type DstType ;
2010 static_assert( Kokkos::Impl::ViewMapping< traits , typename DstType::traits , typename traits::specialize >::is_assignable
2011 ,
"Subview construction requires compatible view and subview arguments" );
2013 Mapping::assign( m_map, src_view.m_map, arg0 , args... );
2019 KOKKOS_INLINE_FUNCTION
2020 int use_count()
const
2021 {
return m_track.use_count(); }
2024 const std::string label()
const
2025 {
return m_track.template get_label< typename traits::memory_space >(); }
2030 template<
class ... P >
2032 View(
const Impl::ViewCtorProp< P ... > & arg_prop
2033 ,
typename std::enable_if< ! Impl::ViewCtorProp< P... >::has_pointer
2034 ,
typename traits::array_layout
2035 >::type
const & arg_layout
2041 typedef Impl::ViewCtorProp< P ... > alloc_prop_input ;
2045 typedef Impl::ViewCtorProp
2047 ,
typename std::conditional
2048 < alloc_prop_input::has_label
2049 , std::integral_constant<unsigned,0>
2050 ,
typename std::string
2052 ,
typename std::conditional
2053 < alloc_prop_input::has_memory_space
2054 , std::integral_constant<unsigned,1>
2055 ,
typename traits::device_type::memory_space
2057 ,
typename std::conditional
2058 < alloc_prop_input::has_execution_space
2059 , std::integral_constant<unsigned,2>
2060 ,
typename traits::device_type::execution_space
2064 static_assert( traits::is_managed
2065 ,
"View allocation constructor requires managed memory" );
2067 if ( alloc_prop::initialize &&
2068 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
2069 ! alloc_prop::execution_space::is_initialized()
2071 ! alloc_prop::execution_space::impl_is_initialized()
2076 Kokkos::Impl::throw_runtime_exception(
"Constructing View and initializing data with uninitialized execution space");
2080 alloc_prop prop( arg_prop );
2083 #if defined( KOKKOS_ENABLE_CUDA )
2089 if ( std::is_same< Kokkos::CudaUVMSpace , typename traits::device_type::memory_space >::value ) {
2090 traits::device_type::memory_space::execution_space::fence();
2095 Kokkos::Impl::SharedAllocationRecord<> *
2096 record = m_map.allocate_shared( prop , arg_layout );
2099 #if defined( KOKKOS_ENABLE_CUDA )
2100 if ( std::is_same< Kokkos::CudaUVMSpace , typename traits::device_type::memory_space >::value ) {
2101 traits::device_type::memory_space::execution_space::fence();
2107 m_track.assign_allocated_record_to_uninitialized( record );
2110 KOKKOS_INLINE_FUNCTION
2111 void assign_data( pointer_type arg_data )
2114 m_map.assign_data( arg_data );
2118 template<
class ... P >
2119 explicit KOKKOS_INLINE_FUNCTION
2120 View(
const Impl::ViewCtorProp< P ... > & arg_prop
2121 ,
typename std::enable_if< Impl::ViewCtorProp< P... >::has_pointer
2122 ,
typename traits::array_layout
2123 >::type
const & arg_layout
2126 , m_map( arg_prop , arg_layout )
2129 std::is_same< pointer_type
2130 ,
typename Impl::ViewCtorProp< P... >::pointer_type
2132 "Constructing View to wrap user memory must supply matching pointer type" );
2136 template<
class ... P >
2138 View(
const Impl::ViewCtorProp< P ... > & arg_prop
2139 ,
typename std::enable_if< ! Impl::ViewCtorProp< P... >::has_pointer
2141 >::type
const arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2142 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2143 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2144 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2145 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2146 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2147 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2148 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2151 , typename traits::array_layout
2152 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2153 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2156 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2157 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2158 arg_N4, arg_N5, arg_N6, arg_N7, label());
2160 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2161 arg_N4, arg_N5, arg_N6, arg_N7);
2167 template<
class ... P >
2168 explicit KOKKOS_INLINE_FUNCTION
2169 View(
const Impl::ViewCtorProp< P ... > & arg_prop
2170 ,
typename std::enable_if< Impl::ViewCtorProp< P... >::has_pointer
2172 >::type
const arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2173 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2174 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2175 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2176 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2177 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2178 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2179 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2182 , typename traits::array_layout
2183 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2184 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2187 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2188 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2189 arg_N4, arg_N5, arg_N6, arg_N7, label());
2191 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2192 arg_N4, arg_N5, arg_N6, arg_N7);
2199 template<
typename Label >
2201 View(
const Label & arg_label
2202 ,
typename std::enable_if<
2203 Kokkos::Impl::is_view_label<Label>::value ,
2204 typename traits::array_layout >::type
const & arg_layout
2206 : View( Impl::ViewCtorProp< std::string >( arg_label ) , arg_layout )
2210 template<
typename Label >
2212 View(
const Label & arg_label
2213 ,
typename std::enable_if<
2214 Kokkos::Impl::is_view_label<Label>::value ,
2215 const size_t >::type arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2216 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2217 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2218 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2219 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2220 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2221 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2222 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2224 : View( Impl::ViewCtorProp< std::string >( arg_label )
2225 , typename traits::array_layout
2226 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2227 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2230 static_assert ( traits::array_layout::is_extent_constructible ,
"Layout is not extent constructible. A layout object should be passed too.\n" );
2232 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2233 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2234 arg_N4, arg_N5, arg_N6, arg_N7, label());
2236 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2237 arg_N4, arg_N5, arg_N6, arg_N7);
2247 View(
const ViewAllocateWithoutInitializing & arg_prop
2248 ,
const typename traits::array_layout & arg_layout
2250 : View( Impl::ViewCtorProp< std::string , Kokkos::Impl::WithoutInitializing_t >( arg_prop.label , Kokkos::WithoutInitializing )
2256 View(
const ViewAllocateWithoutInitializing & arg_prop
2257 ,
const size_t arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2258 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2259 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2260 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2261 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2262 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2263 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2264 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2266 : View( Impl::ViewCtorProp< std::string , Kokkos::Impl::WithoutInitializing_t >( arg_prop.label , Kokkos::WithoutInitializing )
2267 , typename traits::array_layout
2268 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2269 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2272 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2273 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2274 arg_N4, arg_N5, arg_N6, arg_N7, label());
2276 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2277 arg_N4, arg_N5, arg_N6, arg_N7);
2282 template <
class Traits>
2283 KOKKOS_INLINE_FUNCTION
2284 View(
const track_type & track,
const Kokkos::Impl::ViewMapping< Traits , typename Traits::specialize > &map ) :
2285 m_track(track), m_map()
2287 typedef Kokkos::Impl::ViewMapping< traits , Traits , typename traits::specialize > Mapping ;
2288 static_assert( Mapping::is_assignable ,
"Incompatible View copy construction" );
2289 Mapping::assign( m_map , map , track );
2294 static constexpr
size_t required_allocation_size(
2295 const size_t arg_N0 = 0
2296 ,
const size_t arg_N1 = 0
2297 ,
const size_t arg_N2 = 0
2298 ,
const size_t arg_N3 = 0
2299 ,
const size_t arg_N4 = 0
2300 ,
const size_t arg_N5 = 0
2301 ,
const size_t arg_N6 = 0
2302 ,
const size_t arg_N7 = 0
2305 return map_type::memory_span(
2306 typename traits::array_layout
2307 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2308 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) );
2311 explicit KOKKOS_INLINE_FUNCTION
2312 View( pointer_type arg_ptr
2313 ,
const size_t arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2314 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2315 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2316 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2317 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2318 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2319 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2320 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2322 : View( Impl::ViewCtorProp<pointer_type>(arg_ptr)
2323 , typename traits::array_layout
2324 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2325 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2328 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2329 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2330 arg_N4, arg_N5, arg_N6, arg_N7, label());
2332 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2333 arg_N4, arg_N5, arg_N6, arg_N7);
2338 explicit KOKKOS_INLINE_FUNCTION
2339 View( pointer_type arg_ptr
2340 ,
const typename traits::array_layout & arg_layout
2342 : View( Impl::ViewCtorProp<pointer_type>(arg_ptr) , arg_layout )
2352 shmem_size(
const size_t arg_N0 = KOKKOS_INVALID_INDEX,
2353 const size_t arg_N1 = KOKKOS_INVALID_INDEX,
2354 const size_t arg_N2 = KOKKOS_INVALID_INDEX,
2355 const size_t arg_N3 = KOKKOS_INVALID_INDEX,
2356 const size_t arg_N4 = KOKKOS_INVALID_INDEX,
2357 const size_t arg_N5 = KOKKOS_INVALID_INDEX,
2358 const size_t arg_N6 = KOKKOS_INVALID_INDEX,
2359 const size_t arg_N7 = KOKKOS_INVALID_INDEX )
2361 if ( is_layout_stride ) {
2362 Kokkos::abort(
"Kokkos::View::shmem_size(extents...) doesn't work with LayoutStride. Pass a LayoutStride object instead" );
2364 const size_t num_passed_args = Impl::count_valid_integers(arg_N0, arg_N1, arg_N2, arg_N3,
2365 arg_N4, arg_N5, arg_N6, arg_N7);
2367 if ( std::is_same<typename traits::specialize,void>::value && num_passed_args != traits::rank_dynamic ) {
2368 Kokkos::abort(
"Kokkos::View::shmem_size() rank_dynamic != number of arguments.\n" );
2371 return View::shmem_size(
2372 typename traits::array_layout
2373 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2374 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) );
2378 size_t shmem_size(
typename traits::array_layout
const& arg_layout )
2380 return map_type::memory_span( arg_layout )+
sizeof(
typename traits::value_type);
2383 explicit KOKKOS_INLINE_FUNCTION
2384 View(
const typename traits::execution_space::scratch_memory_space & arg_space
2385 ,
const typename traits::array_layout & arg_layout )
2386 : View( Impl::ViewCtorProp<pointer_type>(
2387 reinterpret_cast<pointer_type>(
2388 arg_space.get_shmem_aligned( map_type::memory_span( arg_layout ), sizeof(typename traits::value_type) ) ) )
2392 explicit KOKKOS_INLINE_FUNCTION
2393 View(
const typename traits::execution_space::scratch_memory_space & arg_space
2394 ,
const size_t arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2395 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2396 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2397 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2398 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2399 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2400 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2401 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG )
2402 : View( Impl::ViewCtorProp<pointer_type>(
2403 reinterpret_cast<pointer_type>(
2404 arg_space.get_shmem_aligned(
2405 map_type::memory_span(
2406 typename traits::array_layout
2407 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2408 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) ), sizeof(typename traits::value_type) ) ) )
2409 , typename traits::array_layout
2410 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2411 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2415 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2416 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2417 arg_N4, arg_N5, arg_N6, arg_N7, label());
2419 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2420 arg_N4, arg_N5, arg_N6, arg_N7);
2431 template <
typename D ,
class ... P >
2432 KOKKOS_INLINE_FUNCTION
2438 template<
class V ,
class ... Args >
2440 typename Kokkos::Impl::ViewMapping
2442 ,
typename V::traits
2446 template<
class D,
class ... P ,
class ... Args >
2447 KOKKOS_INLINE_FUNCTION
2448 typename Kokkos::Impl::ViewMapping
2450 , ViewTraits< D , P... >
2453 subview(
const View< D, P... > & src , Args ... args )
2455 static_assert( View< D , P... >::Rank ==
sizeof...(Args) ,
2456 "subview requires one argument for each source View rank" );
2459 Kokkos::Impl::ViewMapping
2461 , ViewTraits< D , P ... >
2462 , Args ... >::type( src , args ... );
2465 template<
class MemoryTraits ,
class D,
class ... P ,
class ... Args >
2466 KOKKOS_INLINE_FUNCTION
2467 typename Kokkos::Impl::ViewMapping
2469 , ViewTraits< D , P... >
2471 >::template apply< MemoryTraits >::type
2472 subview(
const View< D, P... > & src , Args ... args )
2474 static_assert( View< D , P... >::Rank ==
sizeof...(Args) ,
2475 "subview requires one argument for each source View rank" );
2478 Kokkos::Impl::ViewMapping
2480 , ViewTraits< D , P ... >
2482 ::template apply< MemoryTraits >
2483 ::type( src , args ... );
2493 template<
class LT ,
class ... LP ,
class RT ,
class ... RP >
2494 KOKKOS_INLINE_FUNCTION
2496 const View<RT,RP...> & rhs )
2499 typedef ViewTraits<LT,LP...> lhs_traits ;
2500 typedef ViewTraits<RT,RP...> rhs_traits ;
2503 std::is_same<
typename lhs_traits::const_value_type ,
2504 typename rhs_traits::const_value_type >::value &&
2505 std::is_same<
typename lhs_traits::array_layout ,
2506 typename rhs_traits::array_layout >::value &&
2507 std::is_same<
typename lhs_traits::memory_space ,
2508 typename rhs_traits::memory_space >::value &&
2509 unsigned(lhs_traits::rank) == unsigned(rhs_traits::rank) &&
2510 lhs.data() == rhs.data() &&
2511 lhs.span() == rhs.span() &&
2512 lhs.extent(0) == rhs.extent(0) &&
2513 lhs.extent(1) == rhs.extent(1) &&
2514 lhs.extent(2) == rhs.extent(2) &&
2515 lhs.extent(3) == rhs.extent(3) &&
2516 lhs.extent(4) == rhs.extent(4) &&
2517 lhs.extent(5) == rhs.extent(5) &&
2518 lhs.extent(6) == rhs.extent(6) &&
2519 lhs.extent(7) == rhs.extent(7);
2522 template<
class LT ,
class ... LP ,
class RT ,
class ... RP >
2523 KOKKOS_INLINE_FUNCTION
2525 const View<RT,RP...> & rhs )
2539 void shared_allocation_tracking_disable()
2540 { Kokkos::Impl::SharedAllocationRecord<void,void>::tracking_disable(); }
2543 void shared_allocation_tracking_enable()
2544 { Kokkos::Impl::SharedAllocationRecord<void,void>::tracking_enable(); }
2552 namespace Kokkos {
namespace Impl {
2554 template <
class Specialize,
typename A,
typename B >
2555 struct CommonViewValueType;
2557 template <
typename A,
typename B >
2558 struct CommonViewValueType< void, A, B >
2560 using value_type =
typename std::common_type< A , B >::type;
2564 template <
class Specialize,
class ValueType >
2565 struct CommonViewAllocProp;
2567 template <
class ValueType >
2568 struct CommonViewAllocProp< void, ValueType >
2570 using value_type = ValueType;
2571 using scalar_array_type = ValueType;
2573 template <
class ... Views >
2574 KOKKOS_INLINE_FUNCTION
2575 CommonViewAllocProp(
const Views & ... ) {}
2579 template <
class ... Views >
2580 struct DeduceCommonViewAllocProp;
2584 template <
class FirstView >
2585 struct DeduceCommonViewAllocProp< FirstView >
2587 using specialize =
typename FirstView::traits::specialize;
2589 using value_type =
typename FirstView::traits::value_type;
2591 enum :
bool { is_view = is_view< FirstView >::value };
2593 using prop_type = CommonViewAllocProp< specialize, value_type >;
2597 template <
class FirstView,
class ... NextViews >
2598 struct DeduceCommonViewAllocProp< FirstView, NextViews... >
2600 using NextTraits = DeduceCommonViewAllocProp< NextViews... >;
2602 using first_specialize =
typename FirstView::traits::specialize;
2603 using first_value_type =
typename FirstView::traits::value_type;
2605 enum :
bool { first_is_view = is_view< FirstView >::value };
2607 using next_specialize =
typename NextTraits::specialize;
2608 using next_value_type =
typename NextTraits::value_type;
2610 enum :
bool { next_is_view = NextTraits::is_view };
2616 static_assert( !(!std::is_same< first_specialize, next_specialize >::value && !std::is_same< first_specialize, void>::value && !std::is_same< void, next_specialize >::value) ,
"Kokkos DeduceCommonViewAllocProp ERROR: Only one non-void specialize trait allowed" );
2619 using specialize =
typename std::conditional< std::is_same< first_specialize, next_specialize >::value
2621 ,
typename std::conditional< ( std::is_same< first_specialize, void >::value
2622 && !std::is_same< next_specialize, void >::value)
2628 using value_type =
typename CommonViewValueType< specialize, first_value_type, next_value_type >::value_type;
2630 enum :
bool { is_view = (first_is_view && next_is_view) };
2632 using prop_type = CommonViewAllocProp< specialize, value_type >;
2637 template <
class ... Views >
2638 using DeducedCommonPropsType =
typename Impl::DeduceCommonViewAllocProp<Views...>::prop_type ;
2641 template <
class ... Views >
2642 KOKKOS_INLINE_FUNCTION
2643 DeducedCommonPropsType<Views...>
2644 common_view_alloc_prop( Views
const & ... views )
2646 return DeducedCommonPropsType<Views...>( views... );
2655 using Kokkos::is_view ;
2660 #include <impl/Kokkos_ViewUniformType.hpp>
2661 #include <impl/Kokkos_Atomic_View.hpp>
KOKKOS_INLINE_FUNCTION bool operator==(const complex< RealType1 > &x, const complex< RealType2 > &y)
Equality operator for two complex numbers.
KOKKOS_INLINE_FUNCTION bool operator!=(const complex< RealType1 > &x, const complex< RealType2 > &y)
Inequality operator for two complex numbers.
Memory layout tag indicating left-to-right (Fortran scheme) striding of multi-indices.
View< typename traits::scalar_array_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits > array_type
Compatible view of array of scalar types.
Memory layout tag indicated arbitrarily strided multi-index mapping into contiguous memory...
Impl::ViewCtorProp< typename Impl::ViewCtorProp< void, Args >::type... > view_alloc(Args const &...args)
Create View allocation parameter bundle from argument list.
View to an array of data.
Memory layout tag indicating right-to-left (C or lexigraphical scheme) striding of multi-indices...
View< typename traits::non_const_data_type, typename traits::array_layout, typename traits::host_mirror_space > host_mirror_type
Compatible HostMirror view.
View< typename traits::non_const_data_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits > non_const_type
Compatible view of non-const data type.
Impl::ViewUniformType< View, 0 >::type uniform_type
Unified types.
View< typename traits::non_const_data_type, typename traits::array_layout, typename traits::host_mirror_space > HostMirror
Compatible HostMirror view.
Traits class for accessing attributes of a View.
View< typename traits::const_data_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits > const_type
Compatible view of const data type.
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< std::is_integral< iType >::value, size_t >::type extent(const iType &r) const noexcept
rank() to be implemented