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 ... >
79 enum { is_assignable_data_type =
false };
80 enum { is_assignable =
false };
85 template <
typename IntType>
86 KOKKOS_INLINE_FUNCTION
87 std::size_t count_valid_integers(
const IntType i0,
95 static_assert(std::is_integral<IntType>::value,
"count_valid_integers() must have integer arguments.");
97 return ( i0 !=KOKKOS_INVALID_INDEX ) + ( i1 !=KOKKOS_INVALID_INDEX ) + ( i2 !=KOKKOS_INVALID_INDEX ) +
98 ( i3 !=KOKKOS_INVALID_INDEX ) + ( i4 !=KOKKOS_INVALID_INDEX ) + ( i5 !=KOKKOS_INVALID_INDEX ) +
99 ( i6 !=KOKKOS_INVALID_INDEX ) + ( i7 !=KOKKOS_INVALID_INDEX );
104 #ifndef KOKKOS_ENABLE_DEPRECATED_CODE
105 KOKKOS_INLINE_FUNCTION
106 void runtime_check_rank_device(
const size_t dyn_rank,
107 const bool is_void_spec,
117 if ( is_void_spec ) {
118 const size_t num_passed_args = count_valid_integers(i0, i1, i2, i3,
121 if ( num_passed_args != dyn_rank && is_void_spec ) {
123 Kokkos::abort(
"Number of arguments passed to Kokkos::View() constructor must match the dynamic rank of the view.") ;
129 KOKKOS_INLINE_FUNCTION
130 void runtime_check_rank_device(
const size_t ,
144 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
145 #ifndef KOKKOS_ENABLE_DEPRECATED_CODE
146 KOKKOS_INLINE_FUNCTION
147 void runtime_check_rank_host(
const size_t dyn_rank,
148 const bool is_void_spec,
156 const size_t i7,
const std::string & label ){
159 if ( is_void_spec ) {
160 const size_t num_passed_args = count_valid_integers(i0, i1, i2, i3,
163 if ( num_passed_args != dyn_rank ) {
165 const std::string message =
"Constructor for Kokkos View '" + label +
"' has mismatched number of arguments. Number of arguments = "
166 + std::to_string(num_passed_args) +
" but dynamic rank = " + std::to_string(dyn_rank) +
" \n";
167 Kokkos::abort(message.c_str()) ;
172 KOKKOS_INLINE_FUNCTION
173 void runtime_check_rank_host(
const size_t ,
182 const size_t ,
const std::string &){}
192 template<
class ViewType ,
int Traits = 0 >
193 struct ViewUniformType;
219 template<
class DataType ,
class ... Properties >
225 typedef void execution_space ;
226 typedef void memory_space ;
227 typedef void HostMirrorSpace ;
228 typedef void array_layout ;
229 typedef void memory_traits ;
230 typedef void specialize ;
233 template<
class ... Prop >
237 typedef typename ViewTraits<void,Prop...>::execution_space execution_space ;
238 typedef typename ViewTraits<void,Prop...>::memory_space memory_space ;
239 typedef typename ViewTraits<void,Prop...>::HostMirrorSpace HostMirrorSpace ;
240 typedef typename ViewTraits<void,Prop...>::array_layout array_layout ;
241 typedef typename ViewTraits<void,Prop...>::memory_traits memory_traits ;
242 typedef typename ViewTraits<void,Prop...>::specialize specialize ;
245 template<
class ArrayLayout ,
class ... Prop >
246 struct ViewTraits< typename std::enable_if< Kokkos::Impl::is_array_layout<ArrayLayout>::value >::type , ArrayLayout , Prop ... >
250 typedef typename ViewTraits<void,Prop...>::execution_space execution_space ;
251 typedef typename ViewTraits<void,Prop...>::memory_space memory_space ;
252 typedef typename ViewTraits<void,Prop...>::HostMirrorSpace HostMirrorSpace ;
253 typedef ArrayLayout array_layout ;
254 typedef typename ViewTraits<void,Prop...>::memory_traits memory_traits ;
255 typedef typename ViewTraits<void,Prop...>::specialize specialize ;
258 template<
class Space ,
class ... Prop >
259 struct ViewTraits< typename std::enable_if< Kokkos::Impl::is_space<Space>::value >::type , Space , Prop ... >
263 static_assert( std::is_same<
typename ViewTraits<void,Prop...>::execution_space ,
void >::value &&
264 std::is_same<
typename ViewTraits<void,Prop...>::memory_space ,
void >::value &&
265 std::is_same<
typename ViewTraits<void,Prop...>::HostMirrorSpace ,
void >::value &&
266 std::is_same<
typename ViewTraits<void,Prop...>::array_layout ,
void >::value
267 ,
"Only one View Execution or Memory Space template argument" );
269 typedef typename Space::execution_space execution_space ;
270 typedef typename Space::memory_space memory_space ;
271 typedef typename Kokkos::Impl::HostMirror< Space >::Space HostMirrorSpace ;
272 typedef typename execution_space::array_layout array_layout ;
273 typedef typename ViewTraits<void,Prop...>::memory_traits memory_traits ;
274 typedef typename ViewTraits<void,Prop...>::specialize specialize ;
277 template<
class MemoryTraits ,
class ... Prop >
278 struct ViewTraits< typename std::enable_if< Kokkos::Impl::is_memory_traits<MemoryTraits>::value >::type , MemoryTraits , Prop ... >
282 static_assert( std::is_same<
typename ViewTraits<void,Prop...>::execution_space ,
void >::value &&
283 std::is_same<
typename ViewTraits<void,Prop...>::memory_space ,
void >::value &&
284 std::is_same<
typename ViewTraits<void,Prop...>::array_layout ,
void >::value &&
285 std::is_same<
typename ViewTraits<void,Prop...>::memory_traits ,
void >::value
286 ,
"MemoryTrait is the final optional template argument for a View" );
288 typedef void execution_space ;
289 typedef void memory_space ;
290 typedef void HostMirrorSpace ;
291 typedef void array_layout ;
292 typedef MemoryTraits memory_traits ;
293 typedef void specialize ;
297 template<
class DataType ,
class ... Properties >
302 typedef ViewTraits< void , Properties ... > prop ;
305 std::conditional< ! std::is_same< typename prop::execution_space , void >::value
306 ,
typename prop::execution_space
307 , Kokkos::DefaultExecutionSpace
312 std::conditional< ! std::is_same< typename prop::memory_space , void >::value
313 ,
typename prop::memory_space
314 ,
typename ExecutionSpace::memory_space
319 std::conditional< ! std::is_same< typename prop::array_layout , void >::value
320 ,
typename prop::array_layout
321 ,
typename ExecutionSpace::array_layout
327 < ! std::is_same< typename prop::HostMirrorSpace , void >::value
328 ,
typename prop::HostMirrorSpace
329 ,
typename Kokkos::Impl::HostMirror< ExecutionSpace >::Space
334 std::conditional< ! std::is_same< typename prop::memory_traits , void >::value
335 ,
typename prop::memory_traits
336 ,
typename Kokkos::MemoryManaged
342 typedef Kokkos::Impl::ViewDataAnalysis< DataType , ArrayLayout > data_analysis ;
349 typedef typename data_analysis::type data_type ;
350 typedef typename data_analysis::const_type const_data_type ;
351 typedef typename data_analysis::non_const_type non_const_data_type ;
356 typedef typename data_analysis::scalar_array_type scalar_array_type ;
357 typedef typename data_analysis::const_scalar_array_type const_scalar_array_type ;
358 typedef typename data_analysis::non_const_scalar_array_type non_const_scalar_array_type ;
363 typedef typename data_analysis::value_type value_type ;
364 typedef typename data_analysis::const_value_type const_value_type ;
365 typedef typename data_analysis::non_const_value_type non_const_value_type ;
370 typedef ArrayLayout array_layout ;
371 typedef typename data_analysis::dimension dimension ;
373 typedef typename std::conditional<
374 std::is_same<typename data_analysis::specialize,void>::value
375 ,
typename prop::specialize
376 ,
typename data_analysis::specialize>::type
379 enum { rank = dimension::rank };
380 enum { rank_dynamic = dimension::rank_dynamic };
385 typedef ExecutionSpace execution_space ;
386 typedef MemorySpace memory_space ;
387 typedef Kokkos::Device<ExecutionSpace,MemorySpace> device_type ;
388 typedef MemoryTraits memory_traits ;
389 typedef HostMirrorSpace host_mirror_space ;
391 typedef typename MemorySpace::size_type size_type ;
393 enum { is_hostspace = std::is_same< MemorySpace , HostSpace >::value };
394 enum { is_managed = MemoryTraits::is_unmanaged == 0 };
395 enum { is_random_access = MemoryTraits::is_random_access == 1 };
482 template<
class DataType ,
class ... Properties >
490 #include <impl/Kokkos_ViewMapping.hpp>
491 #include <impl/Kokkos_ViewArray.hpp>
500 constexpr Kokkos::Impl::ALL_t
501 ALL = Kokkos::Impl::ALL_t();
503 constexpr Kokkos::Impl::WithoutInitializing_t
504 WithoutInitializing = Kokkos::Impl::WithoutInitializing_t();
506 constexpr Kokkos::Impl::AllowPadding_t
507 AllowPadding = Kokkos::Impl::AllowPadding_t();
520 template<
class ... Args >
522 Impl::ViewCtorProp< typename Impl::ViewCtorProp< void , Args >::type ... >
526 Impl::ViewCtorProp< typename Impl::ViewCtorProp< void , Args >::type ... >
529 static_assert( ! return_type::has_pointer
530 ,
"Cannot give pointer-to-memory for view allocation" );
532 return return_type( args... );
535 template<
class ... Args >
536 KOKKOS_INLINE_FUNCTION
537 Impl::ViewCtorProp< typename Impl::ViewCtorProp< void , Args >::type ... >
538 view_wrap( Args
const & ... args )
541 Impl::ViewCtorProp< typename Impl::ViewCtorProp< void , Args >::type ... >
544 static_assert( ! return_type::has_memory_space &&
545 ! return_type::has_execution_space &&
546 ! return_type::has_label &&
547 return_type::has_pointer
548 ,
"Must only give pointer-to-memory for view wrapping" );
550 return return_type( args... );
560 template<
class DataType ,
class ... Properties >
563 template<
class >
struct is_view :
public std::false_type {};
565 template<
class D,
class ... P >
566 struct is_view<
View<D,P...> > :
public std::true_type {};
568 template<
class D,
class ... P >
569 struct is_view< const
View<D,P...> > :
public std::true_type {};
571 template<
class DataType ,
class ... Properties >
572 class View :
public ViewTraits< DataType , Properties ... > {
575 template< class ,
class ... >
friend class View ;
576 template< class ,
class ... >
friend class Kokkos::Impl::ViewMapping ;
580 typedef ViewTraits< DataType , Properties ... > traits ;
584 typedef Kokkos::Impl::ViewMapping< traits , typename traits::specialize > map_type ;
585 typedef Kokkos::Impl::SharedAllocationTracker track_type ;
594 typedef View<
typename traits::scalar_array_type ,
595 typename traits::array_layout ,
596 typename traits::device_type ,
597 typename traits::memory_traits >
601 typedef View<
typename traits::const_data_type ,
602 typename traits::array_layout ,
603 typename traits::device_type ,
604 typename traits::memory_traits >
608 typedef View<
typename traits::non_const_data_type ,
609 typename traits::array_layout ,
610 typename traits::device_type ,
611 typename traits::memory_traits >
615 typedef View<
typename traits::non_const_data_type ,
616 typename traits::array_layout ,
617 typename traits::host_mirror_space >
621 typedef View<
typename traits::non_const_data_type ,
622 typename traits::array_layout ,
623 typename traits::host_mirror_space >
628 typedef typename Impl::ViewUniformType<View,0>::const_type uniform_const_type;
629 typedef typename Impl::ViewUniformType<View,0>::runtime_type uniform_runtime_type;
630 typedef typename Impl::ViewUniformType<View,0>::runtime_const_type uniform_runtime_const_type;
631 typedef typename Impl::ViewUniformType<View,0>::nomemspace_type uniform_nomemspace_type;
632 typedef typename Impl::ViewUniformType<View,0>::const_nomemspace_type uniform_const_nomemspace_type;
633 typedef typename Impl::ViewUniformType<View,0>::runtime_nomemspace_type uniform_runtime_nomemspace_type;
634 typedef typename Impl::ViewUniformType<View,0>::runtime_const_nomemspace_type uniform_runtime_const_nomemspace_type;
639 enum { Rank = map_type::Rank };
647 template<
typename iType >
648 KOKKOS_INLINE_FUNCTION constexpr
649 typename std::enable_if< std::is_integral<iType>::value ,
size_t >::type
651 {
return m_map.extent(r); }
653 static KOKKOS_INLINE_FUNCTION constexpr
655 static_extent(
const unsigned r ) noexcept
656 {
return map_type::static_extent(r); }
658 template<
typename iType >
659 KOKKOS_INLINE_FUNCTION constexpr
660 typename std::enable_if< std::is_integral<iType>::value ,
int >::type
661 extent_int(
const iType & r )
const noexcept
662 {
return static_cast<int>(m_map.extent(r)); }
664 KOKKOS_INLINE_FUNCTION constexpr
665 typename traits::array_layout layout()
const
666 {
return m_map.layout(); }
673 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
675 template<
typename iType >
676 KOKKOS_INLINE_FUNCTION constexpr
677 typename std::enable_if< std::is_integral<iType>::value ,
size_t >::type
678 dimension(
const iType & r )
const {
return extent( r ); }
680 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_0()
const {
return m_map.dimension_0(); }
681 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_1()
const {
return m_map.dimension_1(); }
682 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_2()
const {
return m_map.dimension_2(); }
683 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_3()
const {
return m_map.dimension_3(); }
684 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_4()
const {
return m_map.dimension_4(); }
685 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_5()
const {
return m_map.dimension_5(); }
686 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_6()
const {
return m_map.dimension_6(); }
687 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_7()
const {
return m_map.dimension_7(); }
693 KOKKOS_INLINE_FUNCTION constexpr
size_t size()
const {
return m_map.dimension_0() *
694 m_map.dimension_1() *
695 m_map.dimension_2() *
696 m_map.dimension_3() *
697 m_map.dimension_4() *
698 m_map.dimension_5() *
699 m_map.dimension_6() *
700 m_map.dimension_7(); }
702 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_0()
const {
return m_map.stride_0(); }
703 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_1()
const {
return m_map.stride_1(); }
704 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_2()
const {
return m_map.stride_2(); }
705 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_3()
const {
return m_map.stride_3(); }
706 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_4()
const {
return m_map.stride_4(); }
707 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_5()
const {
return m_map.stride_5(); }
708 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_6()
const {
return m_map.stride_6(); }
709 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_7()
const {
return m_map.stride_7(); }
711 template<
typename iType >
712 KOKKOS_INLINE_FUNCTION constexpr
713 typename std::enable_if< std::is_integral<iType>::value ,
size_t >::type
714 stride(iType r)
const {
715 return (r == 0 ? m_map.stride_0() :
716 (r == 1 ? m_map.stride_1() :
717 (r == 2 ? m_map.stride_2() :
718 (r == 3 ? m_map.stride_3() :
719 (r == 4 ? m_map.stride_4() :
720 (r == 5 ? m_map.stride_5() :
721 (r == 6 ? m_map.stride_6() :
722 m_map.stride_7())))))));
725 template<
typename iType >
726 KOKKOS_INLINE_FUNCTION
void stride( iType *
const s )
const { m_map.stride(s); }
731 typedef typename map_type::reference_type reference_type ;
732 typedef typename map_type::pointer_type pointer_type ;
734 enum { reference_type_is_lvalue_reference = std::is_lvalue_reference< reference_type >::value };
736 KOKKOS_INLINE_FUNCTION constexpr
size_t span()
const {
return m_map.span(); }
737 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
739 KOKKOS_INLINE_FUNCTION constexpr
size_t capacity()
const {
return m_map.span(); }
741 KOKKOS_INLINE_FUNCTION
bool span_is_contiguous()
const {
return m_map.span_is_contiguous(); }
742 KOKKOS_INLINE_FUNCTION constexpr pointer_type data()
const {
return m_map.data(); }
744 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
746 KOKKOS_INLINE_FUNCTION constexpr
bool is_contiguous()
const {
return m_map.span_is_contiguous(); }
748 KOKKOS_INLINE_FUNCTION constexpr pointer_type ptr_on_device()
const {
return m_map.data(); }
754 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
755 KOKKOS_INLINE_FUNCTION
756 const Kokkos::Impl::ViewMapping< traits , typename traits::specialize > &
757 implementation_map()
const {
return m_map ; }
759 KOKKOS_INLINE_FUNCTION
760 const Kokkos::Impl::ViewMapping< traits , typename traits::specialize > &
761 impl_map()
const {
return m_map ; }
762 KOKKOS_INLINE_FUNCTION
763 const Kokkos::Impl::SharedAllocationTracker &
764 impl_track()
const {
return m_track ; }
770 is_layout_left = std::is_same<
typename traits::array_layout
773 is_layout_right = std::is_same<
typename traits::array_layout
776 is_layout_stride = std::is_same<
typename traits::array_layout
780 std::is_same< typename traits::specialize , void >::value &&
781 ( is_layout_left || is_layout_right || is_layout_stride )
784 template< class Space , bool = Kokkos::Impl::MemorySpaceAccess< Space , typename traits::memory_space >::accessible >
struct verify_space
785 { KOKKOS_FORCEINLINE_FUNCTION
static void check() {} };
787 template<
class Space >
struct verify_space<Space,false>
788 { KOKKOS_FORCEINLINE_FUNCTION
static void check()
789 { Kokkos::abort(
"Kokkos::View ERROR: attempt to access inaccessible memory space"); };
792 #if defined( KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK )
794 #define KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( ARG ) \
795 View::template verify_space< Kokkos::Impl::ActiveExecutionMemorySpace >::check(); \
796 Kokkos::Impl::view_verify_operator_bounds< typename traits::memory_space > ARG ;
800 #define KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( ARG ) \
801 View::template verify_space< Kokkos::Impl::ActiveExecutionMemorySpace >::check();
806 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
807 template<
class ... Args >
808 KOKKOS_FORCEINLINE_FUNCTION
809 typename std::enable_if<( Kokkos::Impl::are_integral<Args...>::value
811 ), reference_type >::type
812 operator()( Args ... args )
const
814 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,args...) )
815 return m_map.reference();
818 template< typename I0
820 KOKKOS_FORCEINLINE_FUNCTION
821 typename std::enable_if<
822 ( Kokkos::Impl::are_integral<I0,Args...>::value
825 ), reference_type >::type
826 operator()( const I0 & i0,
829 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
830 return m_map.reference(i0);
833 template< typename I0
835 KOKKOS_FORCEINLINE_FUNCTION
836 typename std::enable_if<
837 ( Kokkos::Impl::are_integral<I0,Args...>::value
840 && ! is_layout_stride
841 ), reference_type >::type
842 operator()( const I0 & i0
843 , Args ... args )
const
845 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
846 return m_map.m_impl_handle[ i0 ];
849 template< typename I0
851 KOKKOS_FORCEINLINE_FUNCTION
852 typename std::enable_if<
853 ( Kokkos::Impl::are_integral<I0,Args...>::value
857 ), reference_type >::type
858 operator()( const I0 & i0
859 , Args ... args )
const
861 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
862 return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * i0 ];
868 template< typename I0 >
869 KOKKOS_FORCEINLINE_FUNCTION
870 typename std::enable_if<
871 ( Kokkos::Impl::are_integral<I0>::value
874 ), reference_type >::type
875 operator[]( const I0 & i0 )
const
877 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
878 return m_map.reference(i0);
881 template< typename I0 >
882 KOKKOS_FORCEINLINE_FUNCTION
883 typename std::enable_if<
884 ( Kokkos::Impl::are_integral<I0>::value
887 && ! is_layout_stride
888 ), reference_type >::type
889 operator[]( const I0 & i0 )
const
891 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
892 return m_map.m_impl_handle[ i0 ];
895 template< typename I0 >
896 KOKKOS_FORCEINLINE_FUNCTION
897 typename std::enable_if<
898 ( Kokkos::Impl::are_integral<I0>::value
902 ), reference_type >::type
903 operator[]( const I0 & i0 )
const
905 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
906 return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * i0 ];
909 template< typename I0 , typename I1
911 KOKKOS_FORCEINLINE_FUNCTION
912 typename std::enable_if<
913 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
916 ), reference_type >::type
917 operator()( const I0 & i0 , const I1 & i1
918 , Args ... args )
const
920 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
921 return m_map.reference(i0,i1);
924 template< typename I0 , typename I1
926 KOKKOS_FORCEINLINE_FUNCTION
927 typename std::enable_if<
928 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
931 && is_layout_left && ( traits::rank_dynamic == 0 )
932 ), reference_type >::type
933 operator()( const I0 & i0 , const I1 & i1
934 , Args ... args )
const
936 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
937 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_dim.N0 * i1 ];
940 template< typename I0 , typename I1
942 KOKKOS_FORCEINLINE_FUNCTION
943 typename std::enable_if<
944 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
947 && is_layout_left && ( traits::rank_dynamic != 0 )
948 ), reference_type >::type
949 operator()( const I0 & i0 , const I1 & i1
950 , Args ... args )
const
952 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
953 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_stride * i1 ];
956 template< typename I0 , typename I1
958 KOKKOS_FORCEINLINE_FUNCTION
959 typename std::enable_if<
960 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
963 && is_layout_right && ( traits::rank_dynamic == 0 )
964 ), reference_type >::type
965 operator()( const I0 & i0 , const I1 & i1
966 , Args ... args )
const
968 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
969 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_dim.N1 * i0 ];
972 template< typename I0 , typename I1
974 KOKKOS_FORCEINLINE_FUNCTION
975 typename std::enable_if<
976 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
979 && is_layout_right && ( traits::rank_dynamic != 0 )
980 ), reference_type >::type
981 operator()( const I0 & i0 , const I1 & i1
982 , Args ... args )
const
984 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
985 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_stride * i0 ];
988 template< typename I0 , typename I1
990 KOKKOS_FORCEINLINE_FUNCTION
991 typename std::enable_if<
992 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
996 ), reference_type >::type
997 operator()( const I0 & i0 , const I1 & i1
998 , Args ... args )
const
1000 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1001 return m_map.m_impl_handle[ i0 * m_map.m_impl_offset.m_stride.S0 +
1002 i1 * m_map.m_impl_offset.m_stride.S1 ];
1008 template< typename I0 , typename I1 , typename I2
1010 KOKKOS_FORCEINLINE_FUNCTION
1011 typename std::enable_if<
1012 ( Kokkos::Impl::are_integral<I0,I1,I2,Args...>::value
1015 ), reference_type >::type
1016 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2
1017 , Args ... args )
const
1019 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,args...) )
1020 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2) ];
1023 template< typename I0 , typename I1 , typename I2
1025 KOKKOS_FORCEINLINE_FUNCTION
1026 typename std::enable_if<
1027 ( Kokkos::Impl::are_integral<I0,I1,I2,Args...>::value
1030 ), reference_type >::type
1031 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2
1032 , Args ... args )
const
1034 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,args...) )
1035 return m_map.reference(i0,i1,i2);
1041 template< typename I0 , typename I1 , typename I2 , typename I3
1043 KOKKOS_FORCEINLINE_FUNCTION
1044 typename std::enable_if<
1045 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,Args...>::value
1048 ), reference_type >::type
1049 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1050 , Args ... args )
const
1052 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,args...) )
1053 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3) ];
1056 template< typename I0 , typename I1 , typename I2 , typename I3
1058 KOKKOS_FORCEINLINE_FUNCTION
1059 typename std::enable_if<
1060 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,Args...>::value
1063 ), reference_type >::type
1064 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1065 , Args ... args )
const
1067 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,args...) )
1068 return m_map.reference(i0,i1,i2,i3);
1074 template< typename I0 , typename I1 , typename I2 , typename I3
1077 KOKKOS_FORCEINLINE_FUNCTION
1078 typename std::enable_if<
1079 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,Args...>::value
1082 ), reference_type >::type
1083 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1085 , Args ... args )
const
1087 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,args...) )
1088 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4) ];
1091 template< typename I0 , typename I1 , typename I2 , typename I3
1094 KOKKOS_FORCEINLINE_FUNCTION
1095 typename std::enable_if<
1096 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,Args...>::value
1099 ), reference_type >::type
1100 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1102 , Args ... args )
const
1104 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,args...) )
1105 return m_map.reference(i0,i1,i2,i3,i4);
1111 template< typename I0 , typename I1 , typename I2 , typename I3
1112 , typename I4 , typename I5
1114 KOKKOS_FORCEINLINE_FUNCTION
1115 typename std::enable_if<
1116 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,Args...>::value
1119 ), reference_type >::type
1120 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1121 , const I4 & i4 , const I5 & i5
1122 , Args ... args )
const
1124 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,args...) )
1125 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5) ];
1128 template< typename I0 , typename I1 , typename I2 , typename I3
1129 , typename I4 , typename I5
1131 KOKKOS_FORCEINLINE_FUNCTION
1132 typename std::enable_if<
1133 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,Args...>::value
1136 ), reference_type >::type
1137 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1138 , const I4 & i4 , const I5 & i5
1139 , Args ... args )
const
1141 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,args...) )
1142 return m_map.reference(i0,i1,i2,i3,i4,i5);
1148 template< typename I0 , typename I1 , typename I2 , typename I3
1149 , typename I4 , typename I5 , typename I6
1151 KOKKOS_FORCEINLINE_FUNCTION
1152 typename std::enable_if<
1153 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,Args...>::value
1156 ), reference_type >::type
1157 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1158 , const I4 & i4 , const I5 & i5 , const I6 & i6
1159 , Args ... args )
const
1161 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,args...) )
1162 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ];
1165 template< typename I0 , typename I1 , typename I2 , typename I3
1166 , typename I4 , typename I5 , typename I6
1168 KOKKOS_FORCEINLINE_FUNCTION
1169 typename std::enable_if<
1170 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,Args...>::value
1173 ), reference_type >::type
1174 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1175 , const I4 & i4 , const I5 & i5 , const I6 & i6
1176 , Args ... args )
const
1178 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,args...) )
1179 return m_map.reference(i0,i1,i2,i3,i4,i5,i6);
1185 template< typename I0 , typename I1 , typename I2 , typename I3
1186 , typename I4 , typename I5 , typename I6 , typename I7
1188 KOKKOS_FORCEINLINE_FUNCTION
1189 typename std::enable_if<
1190 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7,Args...>::value
1193 ), reference_type >::type
1194 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1195 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7
1196 , Args ... args )
const
1198 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7,args...) )
1199 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ];
1202 template< typename I0 , typename I1 , typename I2 , typename I3
1203 , typename I4 , typename I5 , typename I6 , typename I7
1205 KOKKOS_FORCEINLINE_FUNCTION
1206 typename std::enable_if<
1207 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7,Args...>::value
1210 ), reference_type >::type
1211 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1212 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7
1213 , Args ... args )
const
1215 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7,args...) )
1216 return m_map.reference(i0,i1,i2,i3,i4,i5,i6,i7);
1224 KOKKOS_FORCEINLINE_FUNCTION
1228 return m_map.reference();
1234 template<
typename I0>
1235 KOKKOS_FORCEINLINE_FUNCTION
1236 typename std::enable_if<
1237 ( Kokkos::Impl::are_integral<I0>::value
1240 ), reference_type >::type
1241 operator()(
const I0 & i0)
const
1243 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
1244 return m_map.reference(i0);
1247 template< typename I0>
1248 KOKKOS_FORCEINLINE_FUNCTION
1249 typename std::enable_if<
1250 ( Kokkos::Impl::are_integral<I0>::value
1253 && ! is_layout_stride
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.m_impl_handle[ i0 ];
1261 template< typename I0 >
1262 KOKKOS_FORCEINLINE_FUNCTION
1263 typename std::enable_if<
1264 ( Kokkos::Impl::are_integral<I0>::value
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[ m_map.m_impl_offset.m_stride.S0 * i0 ];
1277 template< typename I0 >
1278 KOKKOS_FORCEINLINE_FUNCTION
1279 typename std::enable_if<
1280 ( Kokkos::Impl::are_integral<I0>::value
1283 ), reference_type >::type
1284 operator[]( const I0 & i0 )
const
1286 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
1287 return m_map.reference(i0);
1290 template< typename I0 >
1291 KOKKOS_FORCEINLINE_FUNCTION
1292 typename std::enable_if<
1293 ( Kokkos::Impl::are_integral<I0>::value
1296 && ! is_layout_stride
1297 ), reference_type >::type
1298 operator[]( const I0 & i0 )
const
1300 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
1301 return m_map.m_impl_handle[ i0 ];
1304 template< typename I0 >
1305 KOKKOS_FORCEINLINE_FUNCTION
1306 typename std::enable_if<
1307 ( Kokkos::Impl::are_integral<I0>::value
1311 ), reference_type >::type
1312 operator[]( const I0 & i0 )
const
1314 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0) )
1315 return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * i0 ];
1322 template< typename I0 , typename I1 >
1323 KOKKOS_FORCEINLINE_FUNCTION
1324 typename std::enable_if<
1325 ( Kokkos::Impl::are_integral<I0,I1>::value
1328 ), reference_type >::type
1329 operator()( const I0 & i0 , const I1 & i1)
const
1331 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1332 return m_map.reference(i0,i1);
1335 template< typename I0 , typename I1 >
1336 KOKKOS_FORCEINLINE_FUNCTION
1337 typename std::enable_if<
1338 ( Kokkos::Impl::are_integral<I0,I1>::value
1341 && is_layout_left && ( traits::rank_dynamic == 0 )
1342 ), reference_type >::type
1343 operator()( const I0 & i0 , const I1 & i1)
const
1345 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1346 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_dim.N0 * i1 ];
1349 template< typename I0 , typename I1>
1350 KOKKOS_FORCEINLINE_FUNCTION
1351 typename std::enable_if<
1352 ( Kokkos::Impl::are_integral<I0,I1>::value
1355 && is_layout_left && ( traits::rank_dynamic != 0 )
1356 ), reference_type >::type
1357 operator()( const I0 & i0 , const I1 & i1)
const
1359 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1360 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_stride * i1 ];
1363 template< typename I0 , typename I1 >
1364 KOKKOS_FORCEINLINE_FUNCTION
1365 typename std::enable_if<
1366 ( Kokkos::Impl::are_integral<I0,I1>::value
1369 && is_layout_right && ( traits::rank_dynamic == 0 )
1370 ), reference_type >::type
1371 operator()( const I0 & i0 , const I1 & i1 )
const
1373 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1374 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_dim.N1 * i0 ];
1377 template< typename I0 , typename I1 >
1378 KOKKOS_FORCEINLINE_FUNCTION
1379 typename std::enable_if<
1380 ( Kokkos::Impl::are_integral<I0,I1>::value
1383 && is_layout_right && ( traits::rank_dynamic != 0 )
1384 ), reference_type >::type
1385 operator()( const I0 & i0 , const I1 & i1 )
const
1387 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1388 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_stride * i0 ];
1391 template< typename I0 , typename I1>
1392 KOKKOS_FORCEINLINE_FUNCTION
1393 typename std::enable_if<
1394 ( Kokkos::Impl::are_integral<I0,I1>::value
1398 ), reference_type >::type
1399 operator()( const I0 & i0 , const I1 & i1 )
const
1401 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1) )
1402 return m_map.m_impl_handle[ i0 * m_map.m_impl_offset.m_stride.S0 +
1403 i1 * m_map.m_impl_offset.m_stride.S1 ];
1409 template< typename I0 , typename I1 , typename I2 >
1410 KOKKOS_FORCEINLINE_FUNCTION
1411 typename std::enable_if<
1412 ( Kokkos::Impl::are_integral<I0,I1,I2>::value
1415 ), reference_type >::type
1416 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2)
const
1418 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2) )
1419 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2) ];
1422 template< typename I0 , typename I1 , typename I2>
1423 KOKKOS_FORCEINLINE_FUNCTION
1424 typename std::enable_if<
1425 ( Kokkos::Impl::are_integral<I0,I1,I2>::value
1428 ), reference_type >::type
1429 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2)
const
1431 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2) )
1432 return m_map.reference(i0,i1,i2);
1438 template< typename I0 , typename I1 , typename I2 , typename I3>
1439 KOKKOS_FORCEINLINE_FUNCTION
1440 typename std::enable_if<
1441 ( Kokkos::Impl::are_integral<I0,I1,I2,I3>::value
1444 ), reference_type >::type
1445 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3)
const
1447 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3) )
1448 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3) ];
1451 template< typename I0 , typename I1 , typename I2 , typename I3 >
1452 KOKKOS_FORCEINLINE_FUNCTION
1453 typename std::enable_if<
1454 ( Kokkos::Impl::are_integral<I0,I1,I2,I3>::value
1457 ), reference_type >::type
1458 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3)
const
1460 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3) )
1461 return m_map.reference(i0,i1,i2,i3);
1467 template< typename I0 , typename I1 , typename I2 , typename I3
1469 KOKKOS_FORCEINLINE_FUNCTION
1470 typename std::enable_if<
1471 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4>::value
1474 ), reference_type >::type
1475 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1476 , const I4 & i4 )
const
1478 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4) )
1479 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4) ];
1482 template< typename I0 , typename I1 , typename I2 , typename I3
1484 KOKKOS_FORCEINLINE_FUNCTION
1485 typename std::enable_if<
1486 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4>::value
1489 ), reference_type >::type
1490 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1491 , const I4 & i4)
const
1493 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4) )
1494 return m_map.reference(i0,i1,i2,i3,i4);
1500 template< typename I0 , typename I1 , typename I2 , typename I3
1501 , typename I4 , typename I5 >
1502 KOKKOS_FORCEINLINE_FUNCTION
1503 typename std::enable_if<
1504 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5>::value
1507 ), reference_type >::type
1508 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1509 , const I4 & i4 , const I5 & i5 )
const
1511 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5) )
1512 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5) ];
1515 template< typename I0 , typename I1 , typename I2 , typename I3
1516 , typename I4 , typename I5>
1517 KOKKOS_FORCEINLINE_FUNCTION
1518 typename std::enable_if<
1519 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5>::value
1522 ), reference_type >::type
1523 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1524 , const I4 & i4 , const I5 & i5)
const
1526 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5) )
1527 return m_map.reference(i0,i1,i2,i3,i4,i5);
1533 template< typename I0 , typename I1 , typename I2 , typename I3
1534 , typename I4 , typename I5 , typename I6>
1535 KOKKOS_FORCEINLINE_FUNCTION
1536 typename std::enable_if<
1537 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6>::value
1540 ), reference_type >::type
1541 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1542 , const I4 & i4 , const I5 & i5 , const I6 & i6)
const
1544 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6) )
1545 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ];
1548 template< typename I0 , typename I1 , typename I2 , typename I3
1549 , typename I4 , typename I5 , typename I6 >
1550 KOKKOS_FORCEINLINE_FUNCTION
1551 typename std::enable_if<
1552 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6>::value
1555 ), reference_type >::type
1556 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1557 , const I4 & i4 , const I5 & i5 , const I6 & i6)
const
1559 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6) )
1560 return m_map.reference(i0,i1,i2,i3,i4,i5,i6);
1566 template< typename I0 , typename I1 , typename I2 , typename I3
1567 , typename I4 , typename I5 , typename I6 , typename I7 >
1568 KOKKOS_FORCEINLINE_FUNCTION
1569 typename std::enable_if<
1570 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7>::value
1573 ), reference_type >::type
1574 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1575 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7)
const
1577 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7) )
1578 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ];
1581 template< typename I0 , typename I1 , typename I2 , typename I3
1582 , typename I4 , typename I5 , typename I6 , typename I7>
1583 KOKKOS_FORCEINLINE_FUNCTION
1584 typename std::enable_if<
1585 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7>::value
1588 ), reference_type >::type
1589 operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1590 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7 )
const
1592 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7) )
1593 return m_map.reference(i0,i1,i2,i3,i4,i5,i6,i7);
1597 template<
class ... Args >
1598 KOKKOS_FORCEINLINE_FUNCTION
1599 typename std::enable_if<( Kokkos::Impl::are_integral<Args...>::value
1601 ), reference_type >::type
1602 access( Args ... args )
const
1604 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,args...) )
1605 return m_map.reference();
1608 template< typename I0
1610 KOKKOS_FORCEINLINE_FUNCTION
1611 typename std::enable_if<
1612 ( Kokkos::Impl::are_integral<I0,Args...>::value
1615 ), reference_type >::type
1616 access( const I0 & i0,
1617 Args ... args)
const
1619 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
1620 return m_map.reference(i0);
1623 template< typename I0
1625 KOKKOS_FORCEINLINE_FUNCTION
1626 typename std::enable_if<
1627 ( Kokkos::Impl::are_integral<I0,Args...>::value
1630 && ! is_layout_stride
1631 ), reference_type >::type
1632 access( const I0 & i0
1633 , Args ... args )
const
1635 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
1636 return m_map.m_impl_handle[ i0 ];
1639 template< typename I0
1641 KOKKOS_FORCEINLINE_FUNCTION
1642 typename std::enable_if<
1643 ( Kokkos::Impl::are_integral<I0,Args...>::value
1647 ), reference_type >::type
1648 access( const I0 & i0
1649 , Args ... args )
const
1651 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,args...) )
1652 return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * i0 ];
1655 template< typename I0 , typename I1
1657 KOKKOS_FORCEINLINE_FUNCTION
1658 typename std::enable_if<
1659 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1662 ), reference_type >::type
1663 access( const I0 & i0 , const I1 & i1
1664 , Args ... args )
const
1666 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1667 return m_map.reference(i0,i1);
1670 template< typename I0 , typename I1
1672 KOKKOS_FORCEINLINE_FUNCTION
1673 typename std::enable_if<
1674 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1677 && is_layout_left && ( traits::rank_dynamic == 0 )
1678 ), reference_type >::type
1679 access( const I0 & i0 , const I1 & i1
1680 , Args ... args )
const
1682 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1683 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_dim.N0 * i1 ];
1686 template< typename I0 , typename I1
1688 KOKKOS_FORCEINLINE_FUNCTION
1689 typename std::enable_if<
1690 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1693 && is_layout_left && ( traits::rank_dynamic != 0 )
1694 ), reference_type >::type
1695 access( const I0 & i0 , const I1 & i1
1696 , Args ... args )
const
1698 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1699 return m_map.m_impl_handle[ i0 + m_map.m_impl_offset.m_stride * i1 ];
1702 template< typename I0 , typename I1
1704 KOKKOS_FORCEINLINE_FUNCTION
1705 typename std::enable_if<
1706 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1709 && is_layout_right && ( traits::rank_dynamic == 0 )
1710 ), reference_type >::type
1711 access( const I0 & i0 , const I1 & i1
1712 , Args ... args )
const
1714 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1715 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_dim.N1 * i0 ];
1718 template< typename I0 , typename I1
1720 KOKKOS_FORCEINLINE_FUNCTION
1721 typename std::enable_if<
1722 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1725 && is_layout_right && ( traits::rank_dynamic != 0 )
1726 ), reference_type >::type
1727 access( const I0 & i0 , const I1 & i1
1728 , Args ... args )
const
1730 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1731 return m_map.m_impl_handle[ i1 + m_map.m_impl_offset.m_stride * i0 ];
1734 template< typename I0 , typename I1
1736 KOKKOS_FORCEINLINE_FUNCTION
1737 typename std::enable_if<
1738 ( Kokkos::Impl::are_integral<I0,I1,Args...>::value
1742 ), reference_type >::type
1743 access( const I0 & i0 , const I1 & i1
1744 , Args ... args )
const
1746 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,args...) )
1747 return m_map.m_impl_handle[ i0 * m_map.m_impl_offset.m_stride.S0 +
1748 i1 * m_map.m_impl_offset.m_stride.S1 ];
1754 template< typename I0 , typename I1 , typename I2
1756 KOKKOS_FORCEINLINE_FUNCTION
1757 typename std::enable_if<
1758 ( Kokkos::Impl::are_integral<I0,I1,I2,Args...>::value
1761 ), reference_type >::type
1762 access( const I0 & i0 , const I1 & i1 , const I2 & i2
1763 , Args ... args )
const
1765 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,args...) )
1766 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2) ];
1769 template< typename I0 , typename I1 , typename I2
1771 KOKKOS_FORCEINLINE_FUNCTION
1772 typename std::enable_if<
1773 ( Kokkos::Impl::are_integral<I0,I1,I2,Args...>::value
1776 ), reference_type >::type
1777 access( const I0 & i0 , const I1 & i1 , const I2 & i2
1778 , Args ... args )
const
1780 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,args...) )
1781 return m_map.reference(i0,i1,i2);
1787 template< typename I0 , typename I1 , typename I2 , typename I3
1789 KOKKOS_FORCEINLINE_FUNCTION
1790 typename std::enable_if<
1791 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,Args...>::value
1794 ), reference_type >::type
1795 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1796 , Args ... args )
const
1798 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,args...) )
1799 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3) ];
1802 template< typename I0 , typename I1 , typename I2 , typename I3
1804 KOKKOS_FORCEINLINE_FUNCTION
1805 typename std::enable_if<
1806 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,Args...>::value
1809 ), reference_type >::type
1810 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1811 , Args ... args )
const
1813 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,args...) )
1814 return m_map.reference(i0,i1,i2,i3);
1820 template< typename I0 , typename I1 , typename I2 , typename I3
1823 KOKKOS_FORCEINLINE_FUNCTION
1824 typename std::enable_if<
1825 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,Args...>::value
1828 ), reference_type >::type
1829 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1831 , Args ... args )
const
1833 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,args...) )
1834 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4) ];
1837 template< typename I0 , typename I1 , typename I2 , typename I3
1840 KOKKOS_FORCEINLINE_FUNCTION
1841 typename std::enable_if<
1842 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,Args...>::value
1845 ), reference_type >::type
1846 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1848 , Args ... args )
const
1850 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,args...) )
1851 return m_map.reference(i0,i1,i2,i3,i4);
1857 template< typename I0 , typename I1 , typename I2 , typename I3
1858 , typename I4 , typename I5
1860 KOKKOS_FORCEINLINE_FUNCTION
1861 typename std::enable_if<
1862 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,Args...>::value
1865 ), reference_type >::type
1866 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1867 , const I4 & i4 , const I5 & i5
1868 , Args ... args )
const
1870 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,args...) )
1871 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5) ];
1874 template< typename I0 , typename I1 , typename I2 , typename I3
1875 , typename I4 , typename I5
1877 KOKKOS_FORCEINLINE_FUNCTION
1878 typename std::enable_if<
1879 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,Args...>::value
1882 ), reference_type >::type
1883 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1884 , const I4 & i4 , const I5 & i5
1885 , Args ... args )
const
1887 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,args...) )
1888 return m_map.reference(i0,i1,i2,i3,i4,i5);
1894 template< typename I0 , typename I1 , typename I2 , typename I3
1895 , typename I4 , typename I5 , typename I6
1897 KOKKOS_FORCEINLINE_FUNCTION
1898 typename std::enable_if<
1899 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,Args...>::value
1902 ), reference_type >::type
1903 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1904 , const I4 & i4 , const I5 & i5 , const I6 & i6
1905 , Args ... args )
const
1907 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,args...) )
1908 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ];
1911 template< typename I0 , typename I1 , typename I2 , typename I3
1912 , typename I4 , typename I5 , typename I6
1914 KOKKOS_FORCEINLINE_FUNCTION
1915 typename std::enable_if<
1916 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,Args...>::value
1919 ), reference_type >::type
1920 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1921 , const I4 & i4 , const I5 & i5 , const I6 & i6
1922 , Args ... args )
const
1924 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,args...) )
1925 return m_map.reference(i0,i1,i2,i3,i4,i5,i6);
1931 template< typename I0 , typename I1 , typename I2 , typename I3
1932 , typename I4 , typename I5 , typename I6 , typename I7
1934 KOKKOS_FORCEINLINE_FUNCTION
1935 typename std::enable_if<
1936 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7,Args...>::value
1939 ), reference_type >::type
1940 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1941 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7
1942 , Args ... args )
const
1944 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7,args...) )
1945 return m_map.m_impl_handle[ m_map.m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ];
1948 template< typename I0 , typename I1 , typename I2 , typename I3
1949 , typename I4 , typename I5 , typename I6 , typename I7
1951 KOKKOS_FORCEINLINE_FUNCTION
1952 typename std::enable_if<
1953 ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7,Args...>::value
1956 ), reference_type >::type
1957 access( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
1958 , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7
1959 , Args ... args )
const
1961 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (m_track,m_map,i0,i1,i2,i3,i4,i5,i6,i7,args...) )
1962 return m_map.reference(i0,i1,i2,i3,i4,i5,i6,i7);
1966 #undef KOKKOS_IMPL_VIEW_OPERATOR_VERIFY
1971 KOKKOS_INLINE_FUNCTION
1974 KOKKOS_INLINE_FUNCTION
1975 View() : m_track(), m_map() {}
1977 KOKKOS_INLINE_FUNCTION
1978 View(
const View & rhs ) : m_track( rhs.m_track, traits::is_managed ), m_map( rhs.m_map ) {}
1980 KOKKOS_INLINE_FUNCTION
1981 View( View && rhs ) : m_track( std::move(rhs.m_track) ), m_map( std::move(rhs.m_map) ) {}
1983 KOKKOS_INLINE_FUNCTION
1984 View & operator = (
const View & rhs ) { m_track = rhs.m_track ; m_map = rhs.m_map ;
return *this ; }
1986 KOKKOS_INLINE_FUNCTION
1987 View & operator = ( View && rhs ) { m_track = std::move(rhs.m_track) ; m_map = std::move(rhs.m_map) ;
return *this ; }
1995 template<
class RT ,
class ... RP >
1996 KOKKOS_INLINE_FUNCTION
1997 View(
const View<RT,RP...> & rhs,
1998 typename std::enable_if<Kokkos::Impl::ViewMapping<
1999 traits ,
typename View<RT,RP...>::traits ,
typename traits::specialize >::is_assignable_data_type>::type* = 0
2001 : m_track( rhs.m_track , traits::is_managed )
2004 typedef typename View<RT,RP...>::traits SrcTraits ;
2005 typedef Kokkos::Impl::ViewMapping< traits , SrcTraits , typename traits::specialize > Mapping ;
2006 static_assert( Mapping::is_assignable ,
"Incompatible View copy construction" );
2007 Mapping::assign( m_map , rhs.m_map , rhs.m_track );
2010 template<
class RT ,
class ... RP >
2011 KOKKOS_INLINE_FUNCTION
2012 typename std::enable_if<Kokkos::Impl::ViewMapping<
2013 traits ,
typename View<RT,RP...>::traits ,
typename traits::specialize >::is_assignable_data_type,
2014 View>::type & operator = (
const View<RT,RP...> & rhs )
2016 typedef typename View<RT,RP...>::traits SrcTraits ;
2017 typedef Kokkos::Impl::ViewMapping< traits , SrcTraits , typename traits::specialize > Mapping ;
2018 static_assert( Mapping::is_assignable ,
"Incompatible View copy assignment" );
2019 Mapping::assign( m_map , rhs.m_map , rhs.m_track );
2020 m_track.assign( rhs.m_track , traits::is_managed );
2028 template<
class RT ,
class ... RP ,
class Arg0 ,
class ... Args >
2029 KOKKOS_INLINE_FUNCTION
2030 View(
const View< RT , RP... > & src_view
2031 ,
const Arg0 arg0 , Args ... args )
2032 : m_track( src_view.m_track , traits::is_managed )
2035 typedef View< RT , RP... > SrcType ;
2037 typedef Kokkos::Impl::ViewMapping
2039 ,
typename SrcType::traits
2040 , Arg0 , Args... > Mapping ;
2042 typedef typename Mapping::type DstType ;
2044 static_assert( Kokkos::Impl::ViewMapping< traits , typename DstType::traits , typename traits::specialize >::is_assignable
2045 ,
"Subview construction requires compatible view and subview arguments" );
2047 Mapping::assign( m_map, src_view.m_map, arg0 , args... );
2053 KOKKOS_INLINE_FUNCTION
2054 int use_count()
const
2055 {
return m_track.use_count(); }
2058 const std::string label()
const
2059 {
return m_track.template get_label< typename traits::memory_space >(); }
2064 template<
class ... P >
2066 View(
const Impl::ViewCtorProp< P ... > & arg_prop
2067 ,
typename std::enable_if< ! Impl::ViewCtorProp< P... >::has_pointer
2068 ,
typename traits::array_layout
2069 >::type
const & arg_layout
2075 typedef Impl::ViewCtorProp< P ... > alloc_prop_input ;
2079 typedef Impl::ViewCtorProp
2081 ,
typename std::conditional
2082 < alloc_prop_input::has_label
2083 , std::integral_constant<unsigned,0>
2084 ,
typename std::string
2086 ,
typename std::conditional
2087 < alloc_prop_input::has_memory_space
2088 , std::integral_constant<unsigned,1>
2089 ,
typename traits::device_type::memory_space
2091 ,
typename std::conditional
2092 < alloc_prop_input::has_execution_space
2093 , std::integral_constant<unsigned,2>
2094 ,
typename traits::device_type::execution_space
2098 static_assert( traits::is_managed
2099 ,
"View allocation constructor requires managed memory" );
2101 if ( alloc_prop::initialize &&
2102 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
2103 ! alloc_prop::execution_space::is_initialized()
2105 ! alloc_prop::execution_space::impl_is_initialized()
2110 Kokkos::Impl::throw_runtime_exception(
"Constructing View and initializing data with uninitialized execution space");
2114 alloc_prop prop_copy( arg_prop );
2117 #if defined( KOKKOS_ENABLE_CUDA )
2123 if ( std::is_same< Kokkos::CudaUVMSpace , typename traits::device_type::memory_space >::value ) {
2124 typename traits::device_type::memory_space::execution_space().fence();
2129 Kokkos::Impl::SharedAllocationRecord<> *
2130 record = m_map.allocate_shared( prop_copy , arg_layout );
2133 #if defined( KOKKOS_ENABLE_CUDA )
2134 if ( std::is_same< Kokkos::CudaUVMSpace , typename traits::device_type::memory_space >::value ) {
2135 typename traits::device_type::memory_space::execution_space().fence();
2141 m_track.assign_allocated_record_to_uninitialized( record );
2144 KOKKOS_INLINE_FUNCTION
2145 void assign_data( pointer_type arg_data )
2148 m_map.assign_data( arg_data );
2152 template<
class ... P >
2153 explicit KOKKOS_INLINE_FUNCTION
2154 View(
const Impl::ViewCtorProp< P ... > & arg_prop
2155 ,
typename std::enable_if< Impl::ViewCtorProp< P... >::has_pointer
2156 ,
typename traits::array_layout
2157 >::type
const & arg_layout
2160 , m_map( arg_prop , arg_layout )
2163 std::is_same< pointer_type
2164 ,
typename Impl::ViewCtorProp< P... >::pointer_type
2166 "Constructing View to wrap user memory must supply matching pointer type" );
2170 template<
class ... P >
2172 View(
const Impl::ViewCtorProp< P ... > & arg_prop
2173 ,
typename std::enable_if< ! Impl::ViewCtorProp< P... >::has_pointer
2175 >::type
const arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2176 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2177 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2178 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2179 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2180 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2181 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2182 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2185 , typename traits::array_layout
2186 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2187 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2190 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2191 Impl::runtime_check_rank_host(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, label());
2194 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2195 arg_N4, arg_N5, arg_N6, arg_N7);
2201 template<
class ... P >
2202 explicit KOKKOS_INLINE_FUNCTION
2203 View(
const Impl::ViewCtorProp< P ... > & arg_prop
2204 ,
typename std::enable_if< Impl::ViewCtorProp< P... >::has_pointer
2206 >::type
const arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2207 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2208 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2209 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2210 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2211 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2212 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2213 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2216 , typename traits::array_layout
2217 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2218 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2221 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2222 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2223 arg_N4, arg_N5, arg_N6, arg_N7, label());
2225 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2226 arg_N4, arg_N5, arg_N6, arg_N7);
2233 template<
typename Label >
2235 View(
const Label & arg_label
2236 ,
typename std::enable_if<
2237 Kokkos::Impl::is_view_label<Label>::value ,
2238 typename traits::array_layout >::type
const & arg_layout
2240 : View( Impl::ViewCtorProp< std::string >( arg_label ) , arg_layout )
2244 template<
typename Label >
2246 View(
const Label & arg_label
2247 ,
typename std::enable_if<
2248 Kokkos::Impl::is_view_label<Label>::value ,
2249 const size_t >::type arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2250 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2251 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2252 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2253 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2254 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2255 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2256 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2258 : View( Impl::ViewCtorProp< std::string >( arg_label )
2259 , typename traits::array_layout
2260 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2261 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2264 static_assert ( traits::array_layout::is_extent_constructible ,
"Layout is not extent constructible. A layout object should be passed too.\n" );
2266 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2267 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2268 arg_N4, arg_N5, arg_N6, arg_N7, label());
2270 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2271 arg_N4, arg_N5, arg_N6, arg_N7);
2281 View(
const ViewAllocateWithoutInitializing & arg_prop
2282 ,
const typename traits::array_layout & arg_layout
2284 : View( Impl::ViewCtorProp< std::string , Kokkos::Impl::WithoutInitializing_t >( arg_prop.label , Kokkos::WithoutInitializing )
2290 View(
const ViewAllocateWithoutInitializing & arg_prop
2291 ,
const size_t arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2292 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2293 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2294 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2295 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2296 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2297 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2298 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2300 : View( Impl::ViewCtorProp< std::string , Kokkos::Impl::WithoutInitializing_t >( arg_prop.label , Kokkos::WithoutInitializing )
2301 , typename traits::array_layout
2302 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2303 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2306 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2307 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2308 arg_N4, arg_N5, arg_N6, arg_N7, label());
2310 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2311 arg_N4, arg_N5, arg_N6, arg_N7);
2316 template <
class Traits>
2317 KOKKOS_INLINE_FUNCTION
2318 View(
const track_type & track,
const Kokkos::Impl::ViewMapping< Traits , typename Traits::specialize > &map ) :
2319 m_track(track), m_map()
2321 typedef Kokkos::Impl::ViewMapping< traits , Traits , typename traits::specialize > Mapping ;
2322 static_assert( Mapping::is_assignable ,
"Incompatible View copy construction" );
2323 Mapping::assign( m_map , map , track );
2328 static constexpr
size_t required_allocation_size(
2329 const size_t arg_N0 = 0
2330 ,
const size_t arg_N1 = 0
2331 ,
const size_t arg_N2 = 0
2332 ,
const size_t arg_N3 = 0
2333 ,
const size_t arg_N4 = 0
2334 ,
const size_t arg_N5 = 0
2335 ,
const size_t arg_N6 = 0
2336 ,
const size_t arg_N7 = 0
2339 return map_type::memory_span(
2340 typename traits::array_layout
2341 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2342 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) );
2345 explicit KOKKOS_INLINE_FUNCTION
2346 View( pointer_type arg_ptr
2347 ,
const size_t arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2348 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2349 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2350 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2351 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2352 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2353 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2354 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2356 : View( Impl::ViewCtorProp<pointer_type>(arg_ptr)
2357 , typename traits::array_layout
2358 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2359 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2362 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2363 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2364 arg_N4, arg_N5, arg_N6, arg_N7, label());
2366 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2367 arg_N4, arg_N5, arg_N6, arg_N7);
2372 explicit KOKKOS_INLINE_FUNCTION
2373 View( pointer_type arg_ptr
2374 ,
const typename traits::array_layout & arg_layout
2376 : View( Impl::ViewCtorProp<pointer_type>(arg_ptr) , arg_layout )
2386 shmem_size(
const size_t arg_N0 = KOKKOS_INVALID_INDEX,
2387 const size_t arg_N1 = KOKKOS_INVALID_INDEX,
2388 const size_t arg_N2 = KOKKOS_INVALID_INDEX,
2389 const size_t arg_N3 = KOKKOS_INVALID_INDEX,
2390 const size_t arg_N4 = KOKKOS_INVALID_INDEX,
2391 const size_t arg_N5 = KOKKOS_INVALID_INDEX,
2392 const size_t arg_N6 = KOKKOS_INVALID_INDEX,
2393 const size_t arg_N7 = KOKKOS_INVALID_INDEX )
2395 if ( is_layout_stride ) {
2396 Kokkos::abort(
"Kokkos::View::shmem_size(extents...) doesn't work with LayoutStride. Pass a LayoutStride object instead" );
2398 const size_t num_passed_args = Impl::count_valid_integers(arg_N0, arg_N1, arg_N2, arg_N3,
2399 arg_N4, arg_N5, arg_N6, arg_N7);
2401 if ( std::is_same<typename traits::specialize,void>::value && num_passed_args != traits::rank_dynamic ) {
2402 Kokkos::abort(
"Kokkos::View::shmem_size() rank_dynamic != number of arguments.\n" );
2405 return View::shmem_size(
2406 typename traits::array_layout
2407 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2408 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) );
2412 size_t shmem_size(
typename traits::array_layout
const& arg_layout )
2414 return map_type::memory_span( arg_layout )+
sizeof(
typename traits::value_type);
2417 explicit KOKKOS_INLINE_FUNCTION
2418 View(
const typename traits::execution_space::scratch_memory_space & arg_space
2419 ,
const typename traits::array_layout & arg_layout )
2420 : View( Impl::ViewCtorProp<pointer_type>(
2421 reinterpret_cast<pointer_type>(
2422 arg_space.get_shmem_aligned( map_type::memory_span( arg_layout ), sizeof(typename traits::value_type) ) ) )
2426 explicit KOKKOS_INLINE_FUNCTION
2427 View(
const typename traits::execution_space::scratch_memory_space & arg_space
2428 ,
const size_t arg_N0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2429 ,
const size_t arg_N1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2430 ,
const size_t arg_N2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2431 ,
const size_t arg_N3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2432 ,
const size_t arg_N4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2433 ,
const size_t arg_N5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2434 ,
const size_t arg_N6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG
2435 ,
const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG )
2436 : View( Impl::ViewCtorProp<pointer_type>(
2437 reinterpret_cast<pointer_type>(
2438 arg_space.get_shmem_aligned(
2439 map_type::memory_span(
2440 typename traits::array_layout
2441 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2442 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) ), sizeof(typename traits::value_type) ) ) )
2443 , typename traits::array_layout
2444 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
2445 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
2449 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
2450 Impl::runtime_check_rank_host(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2451 arg_N4, arg_N5, arg_N6, arg_N7, label());
2453 Impl::runtime_check_rank_device(traits::rank_dynamic, std::is_same<typename traits::specialize,void>::value, arg_N0, arg_N1, arg_N2, arg_N3,
2454 arg_N4, arg_N5, arg_N6, arg_N7);
2465 template <
typename D ,
class ... P >
2466 KOKKOS_INLINE_FUNCTION
2472 template<
class V ,
class ... Args >
2474 typename Kokkos::Impl::ViewMapping
2476 ,
typename V::traits
2480 template<
class D,
class ... P ,
class ... Args >
2481 KOKKOS_INLINE_FUNCTION
2482 typename Kokkos::Impl::ViewMapping
2484 , ViewTraits< D , P... >
2487 subview(
const View< D, P... > & src , Args ... args )
2489 static_assert( View< D , P... >::Rank ==
sizeof...(Args) ,
2490 "subview requires one argument for each source View rank" );
2493 Kokkos::Impl::ViewMapping
2495 , ViewTraits< D , P ... >
2496 , Args ... >::type( src , args ... );
2499 template<
class MemoryTraits ,
class D,
class ... P ,
class ... Args >
2500 KOKKOS_INLINE_FUNCTION
2501 typename Kokkos::Impl::ViewMapping
2503 , ViewTraits< D , P... >
2505 >::template apply< MemoryTraits >::type
2506 subview(
const View< D, P... > & src , Args ... args )
2508 static_assert( View< D , P... >::Rank ==
sizeof...(Args) ,
2509 "subview requires one argument for each source View rank" );
2512 Kokkos::Impl::ViewMapping
2514 , ViewTraits< D , P ... >
2516 ::template apply< MemoryTraits >
2517 ::type( src , args ... );
2527 template<
class LT ,
class ... LP ,
class RT ,
class ... RP >
2528 KOKKOS_INLINE_FUNCTION
2530 const View<RT,RP...> & rhs )
2533 typedef ViewTraits<LT,LP...> lhs_traits ;
2534 typedef ViewTraits<RT,RP...> rhs_traits ;
2537 std::is_same<
typename lhs_traits::const_value_type ,
2538 typename rhs_traits::const_value_type >::value &&
2539 std::is_same<
typename lhs_traits::array_layout ,
2540 typename rhs_traits::array_layout >::value &&
2541 std::is_same<
typename lhs_traits::memory_space ,
2542 typename rhs_traits::memory_space >::value &&
2543 unsigned(lhs_traits::rank) == unsigned(rhs_traits::rank) &&
2544 lhs.data() == rhs.data() &&
2545 lhs.span() == rhs.span() &&
2546 lhs.extent(0) == rhs.extent(0) &&
2547 lhs.extent(1) == rhs.extent(1) &&
2548 lhs.extent(2) == rhs.extent(2) &&
2549 lhs.extent(3) == rhs.extent(3) &&
2550 lhs.extent(4) == rhs.extent(4) &&
2551 lhs.extent(5) == rhs.extent(5) &&
2552 lhs.extent(6) == rhs.extent(6) &&
2553 lhs.extent(7) == rhs.extent(7);
2556 template<
class LT ,
class ... LP ,
class RT ,
class ... RP >
2557 KOKKOS_INLINE_FUNCTION
2559 const View<RT,RP...> & rhs )
2573 void shared_allocation_tracking_disable()
2574 { Kokkos::Impl::SharedAllocationRecord<void,void>::tracking_disable(); }
2577 void shared_allocation_tracking_enable()
2578 { Kokkos::Impl::SharedAllocationRecord<void,void>::tracking_enable(); }
2586 namespace Kokkos {
namespace Impl {
2588 template <
class Specialize,
typename A,
typename B >
2589 struct CommonViewValueType;
2591 template <
typename A,
typename B >
2592 struct CommonViewValueType< void, A, B >
2594 using value_type =
typename std::common_type< A , B >::type;
2598 template <
class Specialize,
class ValueType >
2599 struct CommonViewAllocProp;
2601 template <
class ValueType >
2602 struct CommonViewAllocProp< void, ValueType >
2604 using value_type = ValueType;
2605 using scalar_array_type = ValueType;
2607 template <
class ... Views >
2608 KOKKOS_INLINE_FUNCTION
2609 CommonViewAllocProp(
const Views & ... ) {}
2613 template <
class ... Views >
2614 struct DeduceCommonViewAllocProp;
2618 template <
class FirstView >
2619 struct DeduceCommonViewAllocProp< FirstView >
2621 using specialize =
typename FirstView::traits::specialize;
2623 using value_type =
typename FirstView::traits::value_type;
2625 enum :
bool { is_view = is_view< FirstView >::value };
2627 using prop_type = CommonViewAllocProp< specialize, value_type >;
2631 template <
class FirstView,
class ... NextViews >
2632 struct DeduceCommonViewAllocProp< FirstView, NextViews... >
2634 using NextTraits = DeduceCommonViewAllocProp< NextViews... >;
2636 using first_specialize =
typename FirstView::traits::specialize;
2637 using first_value_type =
typename FirstView::traits::value_type;
2639 enum :
bool { first_is_view = is_view< FirstView >::value };
2641 using next_specialize =
typename NextTraits::specialize;
2642 using next_value_type =
typename NextTraits::value_type;
2644 enum :
bool { next_is_view = NextTraits::is_view };
2650 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" );
2653 using specialize =
typename std::conditional< std::is_same< first_specialize, next_specialize >::value
2655 ,
typename std::conditional< ( std::is_same< first_specialize, void >::value
2656 && !std::is_same< next_specialize, void >::value)
2662 using value_type =
typename CommonViewValueType< specialize, first_value_type, next_value_type >::value_type;
2664 enum :
bool { is_view = (first_is_view && next_is_view) };
2666 using prop_type = CommonViewAllocProp< specialize, value_type >;
2671 template <
class ... Views >
2672 using DeducedCommonPropsType =
typename Impl::DeduceCommonViewAllocProp<Views...>::prop_type ;
2675 template <
class ... Views >
2676 KOKKOS_INLINE_FUNCTION
2677 DeducedCommonPropsType<Views...>
2678 common_view_alloc_prop( Views
const & ... views )
2680 return DeducedCommonPropsType<Views...>( views... );
2689 using Kokkos::is_view ;
2694 #include <impl/Kokkos_ViewUniformType.hpp>
2695 #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