42 #ifndef KOKKOS_EXPERIMENTAL_VIEW_MP_VECTOR_CONTIGUOUS_HPP
43 #define KOKKOS_EXPERIMENTAL_VIEW_MP_VECTOR_CONTIGUOUS_HPP
45 #include "Sacado_Traits.hpp"
51 #include "Kokkos_Core_fwd.hpp"
52 #include "Kokkos_View.hpp"
53 #include "Kokkos_Layout.hpp"
63 template<
class Space,
class T,
class ... P>
70 namespace Experimental {
75 template<
class ... Args >
78 template<
class D ,
class ... P ,
class ... Args >
81 std::is_same<
typename Kokkos::ViewTraits<
D,P...>::specialize
84 ( (
sizeof...(Args) == 0 ) ||
94 template <
typename T,
typename ... P>
97 static const bool value =
98 std::is_same<
typename view_type::specialize,
102 template <
typename T,
typename ... P>
103 KOKKOS_INLINE_FUNCTION
107 return view.impl_map().dimension_scalar();
113 template<
class T ,
class ... P >
115 typename Kokkos::View<T,P...>::HostMirror
117 const Kokkos::View<T,P...> & src,
118 typename std::enable_if<
119 std::is_same<
typename ViewTraits<T,P...>::specialize ,
121 !std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
122 Kokkos::LayoutStride >::value >::type * = 0);
124 template<
class T ,
class ... P >
126 typename Kokkos::View<T,P...>::HostMirror
128 const Kokkos::View<T,P...> & src,
129 typename std::enable_if<
130 std::is_same<
typename ViewTraits<T,P...>::specialize ,
132 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
133 Kokkos::LayoutStride >::value >::type * = 0);
135 template<
class Space,
class T,
class ... P>
136 typename Impl::MirrorType<Space,T,P ...>::view_type
139 const Kokkos::View<T,P...> & src,
140 typename std::enable_if<
141 std::is_same<
typename ViewTraits<T,P...>::specialize ,
145 template<
class DT,
class ... DP >
147 const View<DT,DP...> & view ,
149 ,
typename std::enable_if<(
150 std::is_same<
typename ViewTraits<DT,DP...>::specialize
155 template<
class DT,
class ... DP >
157 const View<DT,DP...> & view ,
159 ,
typename std::enable_if<(
160 std::is_same<
typename ViewTraits<DT,DP...>::specialize
165 template<
class ExecSpace ,
class DT,
class ... DP >
168 const View<DT,DP...> & view ,
170 ,
typename std::enable_if<(
171 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
172 std::is_same<
typename ViewTraits<DT,DP...>::specialize
177 template<
class ExecSpace ,
class DT,
class ... DP >
180 const View<DT,DP...> & view ,
182 ,
typename std::enable_if<(
183 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
184 std::is_same<
typename ViewTraits<DT,DP...>::specialize
189 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
191 void deep_copy(
const View<DT,DP...> & dst ,
192 const View<ST,SP...> & src
193 ,
typename std::enable_if<(
194 std::is_same<
typename ViewTraits<DT,DP...>::specialize
197 std::is_same<
typename ViewTraits<ST,SP...>::specialize
205 #include "Kokkos_Core.hpp"
209 template <
typename D,
typename ... P>
211 typename std::enable_if< is_view_mp_vector< View<D,P...> >::value >
::type > {
213 typedef typename view_type::traits::dimension
dimension;
215 typedef typename Kokkos::Impl::ViewDataType< flat_value_type , dimension >::type
flat_data_type;
219 template<
class T ,
class ... P >
221 typename Kokkos::View<T,P...>::HostMirror
223 ,
typename std::enable_if<
224 std::is_same<
typename ViewTraits<T,P...>::specialize ,
227 ! std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
228 , Kokkos::LayoutStride >::value
232 typedef View<T,P...> src_type ;
233 typedef typename src_type::HostMirror dst_type ;
235 typename src_type::array_layout layout = src.layout();
238 return dst_type(std::string(src.label()).append(
"_mirror"), layout);
241 template<
class T ,
class ... P >
243 typename Kokkos::View<T,P...>::HostMirror
245 ,
typename std::enable_if<
246 std::is_same<
typename ViewTraits<T,P...>::specialize ,
249 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
250 , Kokkos::LayoutStride >::value
254 typedef View<T,P...> src_type ;
255 typedef typename src_type::HostMirror dst_type ;
257 Kokkos::LayoutStride layout ;
259 layout.dimension[0] = src.extent(0);
260 layout.dimension[1] = src.extent(1);
261 layout.dimension[2] = src.extent(2);
262 layout.dimension[3] = src.extent(3);
263 layout.dimension[4] = src.extent(4);
264 layout.dimension[5] = src.extent(5);
265 layout.dimension[6] = src.extent(6);
266 layout.dimension[7] = src.extent(7);
268 layout.stride[0] = src.stride_0();
269 layout.stride[1] = src.stride_1();
270 layout.stride[2] = src.stride_2();
271 layout.stride[3] = src.stride_3();
272 layout.stride[4] = src.stride_4();
273 layout.stride[5] = src.stride_5();
274 layout.stride[6] = src.stride_6();
275 layout.stride[7] = src.stride_7();
279 return dst_type(std::string(src.label()).append(
"_mirror"), layout);
282 template<
class Space,
class T,
class ... P>
283 typename Impl::MirrorType<Space,T,P ...>::view_type
285 ,
typename std::enable_if<
286 std::is_same<
typename ViewTraits<T,P...>::specialize ,
289 typedef View<T,P...> src_type ;
290 typename src_type::array_layout layout = src.layout();
296 template<
class DT,
class ... DP >
298 const View<DT,DP...> & view ,
300 ,
typename std::enable_if<(
301 std::is_same<
typename ViewTraits<DT,DP...>::specialize
307 typename ViewTraits<DT,DP...>::non_const_value_type >::value
308 ,
"Can only deep copy into non-const type" );
315 template<
class DT,
class ... DP >
317 const View<DT,DP...> & view ,
319 ,
typename std::enable_if<(
320 std::is_same<
typename ViewTraits<DT,DP...>::specialize
326 typename ViewTraits<DT,DP...>::non_const_value_type >::value
327 ,
"Can only deep copy into non-const type" );
340 template<
class ExecSpace ,
class DT,
class ... DP >
343 const View<DT,DP...> & view ,
345 ,
typename std::enable_if<(
346 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
347 std::is_same<
typename ViewTraits<DT,DP...>::specialize
353 typename ViewTraits<DT,DP...>::non_const_value_type >::value
354 ,
"Can only deep copy into non-const type" );
361 template<
class ExecSpace ,
class DT,
class ... DP >
364 const View<DT,DP...> & view ,
366 ,
typename std::enable_if<(
367 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
368 std::is_same<
typename ViewTraits<DT,DP...>::specialize
374 typename ViewTraits<DT,DP...>::non_const_value_type >::value
375 ,
"Can only deep copy into non-const type" );
388 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
391 const View<ST,SP...> & src
392 ,
typename std::enable_if<(
393 std::is_same<
typename ViewTraits<DT,DP...>::specialize
396 std::is_same<
typename ViewTraits<ST,SP...>::specialize
402 typename ViewTraits<DT,DP...>::non_const_value_type >::value
403 ,
"Deep copy destination must be non-const" );
406 (
unsigned(ViewTraits<DT,DP...>::rank) ==
407 unsigned(ViewTraits<ST,SP...>::rank) )
408 ,
"Deep copy destination and source must have same rank" );
430 template<
class DataType ,
class ArrayLayout ,
typename StorageType >
431 struct ViewDataAnalysis< DataType
433 , Sacado::MP::Vector< StorageType > >
439 static const int DimVector = StorageType::static_size;
453 ViewDataType< value_type , dimension >::type
type ;
455 ViewDataType< const_value_type , dimension >::type
const_type ;
462 enum { is_const = std::is_same< value_type , const_value_type >::value };
466 std::conditional< is_const , const ScalarType , ScalarType >::type
474 typedef typename array_analysis::dimension::
475 template prepend<0>::type
477 typedef typename array_analysis::dimension::
478 template append<DimVector>::type
480 typedef typename std::conditional<
481 std::is_same< ArrayLayout, Kokkos::LayoutLeft>::value,
492 ViewDataType< const_scalar_type , scalar_dimension >::type
496 ViewDataType< non_const_scalar_type , scalar_dimension >::type
506 namespace Experimental {
509 template <
class ValueType,
510 bool is_static = Sacado::IsStaticallySized<ValueType>::value >
516 template <
class ValueType>
524 KOKKOS_INLINE_FUNCTION
525 static constexpr
size_t
530 KOKKOS_INLINE_FUNCTION
533 template <
typename T>
534 KOKKOS_INLINE_FUNCTION
536 value_ptr = a.value_ptr;
537 scalar_ptr = a.scalar_ptr;
541 KOKKOS_INLINE_FUNCTION
547 template <
class ExecSpace>
548 struct ConstructDestructFunctor {
549 typedef Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type >
FunctorType ;
553 ConstructDestructFunctor() =
default;
554 ConstructDestructFunctor(
const ConstructDestructFunctor&) =
default;
555 ConstructDestructFunctor& operator=(
const ConstructDestructFunctor&) =
default;
558 const bool initialize,
560 const unsigned vector_size,
562 m_functor( space , scalar_ptr , span*vector_size ),
563 m_initialize(initialize) {}
567 m_functor.construct_shared_allocation();
572 m_functor.destroy_shared_allocation();
577 template <
class ExecSpace>
578 inline ConstructDestructFunctor<ExecSpace>
580 const bool initialize,
582 const unsigned vector_size)
const {
583 return ConstructDestructFunctor<ExecSpace>(space, initialize, span, vector_size, scalar_ptr);
587 template <
typename T>
588 KOKKOS_INLINE_FUNCTION
590 value_ptr =
reinterpret_cast<value_type*
>(ptr);
601 template <
class ValueType>
609 KOKKOS_INLINE_FUNCTION
610 static constexpr
size_t
615 KOKKOS_INLINE_FUNCTION
618 template <
typename T>
619 KOKKOS_INLINE_FUNCTION
621 value_ptr = a.value_ptr;
622 scalar_ptr = a.scalar_ptr;
629 KOKKOS_INLINE_FUNCTION
632 scalar_ptr =
reinterpret_cast<scalar_type*
>(ptr+span);
635 template <
class ExecSpace>
636 struct VectorConstruct {
643 VectorConstruct() =
default;
644 VectorConstruct(
const VectorConstruct&) =
default;
645 VectorConstruct& operator=(
const VectorConstruct&) =
default;
652 const unsigned vector_size) :
653 m_space(space), m_p(p), m_sp(sp), m_span(span), m_vector_size(vector_size) {}
656 if ( ! m_space.in_parallel() ) {
657 typedef Kokkos::RangePolicy< ExecSpace > PolicyType ;
658 const Kokkos::Impl::ParallelFor< VectorConstruct , PolicyType >
659 closure( *
this , PolicyType( 0 , m_span ) );
664 for (
size_t i = 0 ; i < m_span ; ++i )
operator()(i);
668 KOKKOS_INLINE_FUNCTION
669 void operator() (
const size_t i)
const {
670 new (m_p+i)
value_type(m_vector_size, m_sp+i*m_vector_size,
false);
674 template <
class ExecSpace>
675 struct ConstructDestructFunctor {
682 ConstructDestructFunctor() =
default;
683 ConstructDestructFunctor(
const ConstructDestructFunctor&) =
default;
684 ConstructDestructFunctor& operator=(
const ConstructDestructFunctor&) =
default;
687 const bool initialize,
689 const unsigned vector_size,
692 m_scalar_functor( space , scalar_ptr , span*vector_size ),
693 m_vector_functor( space , value_ptr , scalar_ptr , span , vector_size ),
694 m_initialize(initialize) {}
699 m_scalar_functor.construct_shared_allocation();
711 m_vector_functor.execute();
718 m_scalar_functor.destroy_shared_allocation();
723 template <
class ExecSpace>
724 inline ConstructDestructFunctor<ExecSpace>
726 const bool initialize,
728 const unsigned vector_size)
const {
729 return ConstructDestructFunctor<ExecSpace>(space, initialize, span, vector_size, scalar_ptr, value_ptr);
734 template <
typename T>
735 KOKKOS_INLINE_FUNCTION
737 value_ptr =
reinterpret_cast<value_type*
>(ptr);
739 scalar_ptr = value_ptr->coeff();
750 template<
class Traits >
751 class ViewMapping< Traits ,
752 typename std::enable_if<
753 ( std::is_same< typename Traits::specialize
754 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
756 ( std::is_same< typename Traits::array_layout
757 , Kokkos::LayoutLeft >::value
759 std::is_same< typename Traits::array_layout
760 , Kokkos::LayoutRight >::value
762 std::is_same< typename Traits::array_layout
763 , Kokkos::LayoutStride >::value
766 , typename Traits::specialize
771 template< class ,
class ... >
friend class ViewMapping ;
772 template< class ,
class ... >
friend class Kokkos::View ;
780 enum { StokhosStorageStaticDimension = stokhos_storage_type::static_size };
781 typedef Sacado::integral_nonzero< unsigned , StokhosStorageStaticDimension >
sacado_size_type;
785 typedef ViewOffset<
typename Traits::dimension
786 ,
typename Traits::array_layout
794 typedef ViewOffset<
typename array_dimension::
795 template append<StokhosStorageStaticDimension>::type,
796 typename Traits::array_layout,
799 typedef ViewOffset<
typename array_dimension::
800 template prepend<0>::type,
801 typename Traits::array_layout,
804 typedef typename std::conditional<
805 std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft>::value,
839 enum { Rank = Traits::dimension::rank };
842 enum { Sacado_Rank = std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft >::value ? 0 : Rank+1 };
845 template<
typename iType >
846 KOKKOS_INLINE_FUNCTION constexpr
size_t extent(
const iType & r )
const
847 {
return m_impl_offset.m_dim.extent(r); }
849 KOKKOS_INLINE_FUNCTION constexpr
850 typename Traits::array_layout
layout()
const
851 {
return m_impl_offset.layout(); }
854 {
return m_impl_offset.dimension_0(); }
856 {
return m_impl_offset.dimension_1(); }
858 {
return m_impl_offset.dimension_2(); }
860 {
return m_impl_offset.dimension_3(); }
862 {
return m_impl_offset.dimension_4(); }
864 {
return m_impl_offset.dimension_5(); }
866 {
return m_impl_offset.dimension_6(); }
868 {
return m_impl_offset.dimension_7(); }
876 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_0()
const
877 {
return m_impl_offset.stride_0(); }
878 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_1()
const
879 {
return m_impl_offset.stride_1(); }
880 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_2()
const
881 {
return m_impl_offset.stride_2(); }
882 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_3()
const
883 {
return m_impl_offset.stride_3(); }
884 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_4()
const
885 {
return m_impl_offset.stride_4(); }
886 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_5()
const
887 {
return m_impl_offset.stride_5(); }
888 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_6()
const
889 {
return m_impl_offset.stride_6(); }
890 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_7()
const
891 {
return m_impl_offset.stride_7(); }
893 template<
typename iType >
894 KOKKOS_INLINE_FUNCTION
void stride( iType *
const s )
const
895 { m_impl_offset.stride(s); }
899 {
return m_sacado_size.value; }
902 static const bool is_static = stokhos_storage_type::is_static ;
905 static const bool is_contiguous =
true;
917 KOKKOS_INLINE_FUNCTION constexpr
size_t span()
const
918 {
return m_impl_offset.span(); }
922 {
return m_impl_offset.span_is_contiguous() && (m_stride == 1); }
926 {
return m_impl_handle.value_ptr ; }
930 KOKKOS_FORCEINLINE_FUNCTION
932 {
return *m_impl_handle.value_ptr; }
935 template<
typename I0 >
936 KOKKOS_FORCEINLINE_FUNCTION
938 std::enable_if< std::is_integral<I0>::value &&
939 ! std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
940 , reference_type >::type
942 {
return m_impl_handle.value_ptr[m_stride * i0]; }
945 template<
typename I0 >
946 KOKKOS_FORCEINLINE_FUNCTION
948 std::enable_if< std::is_integral<I0>::value &&
949 std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
950 , reference_type >::type
952 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0) ]; }
954 template<
typename I0 ,
typename I1 >
955 KOKKOS_FORCEINLINE_FUNCTION
957 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1) ]; }
959 template<
typename I0 ,
typename I1 ,
typename I2 >
960 KOKKOS_FORCEINLINE_FUNCTION
962 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2) ]; }
964 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3 >
965 KOKKOS_FORCEINLINE_FUNCTION
967 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3) ]; }
969 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
971 KOKKOS_FORCEINLINE_FUNCTION
973 ,
const I4 & i4 )
const
974 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4) ]; }
976 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
977 ,
typename I4 ,
typename I5 >
978 KOKKOS_FORCEINLINE_FUNCTION
980 ,
const I4 & i4 ,
const I5 & i5 )
const
981 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5) ]; }
983 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
984 ,
typename I4 ,
typename I5 ,
typename I6 >
985 KOKKOS_FORCEINLINE_FUNCTION
987 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 )
const
988 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ]; }
990 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
991 ,
typename I4 ,
typename I5 ,
typename I6 ,
typename I7 >
992 KOKKOS_FORCEINLINE_FUNCTION
994 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 ,
const I7 & i7 )
const
995 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ]; }
1000 KOKKOS_INLINE_FUNCTION
1001 static size_t memory_span(
typename Traits::array_layout
const & layout )
1004 typedef std::integral_constant< unsigned , 0 > padding ;
1008 const unsigned static_dim = StokhosStorageStaticDimension;
1010 return handle_type::memory_span( offset.span(), static_dim );
1013 const size_t sacado_size =
1015 return handle_type::memory_span( offset.span(), sacado_size );
1020 KOKKOS_INLINE_FUNCTION ~ViewMapping() = default ;
1028 KOKKOS_INLINE_FUNCTION ViewMapping(
const ViewMapping & ) = default ;
1029 KOKKOS_INLINE_FUNCTION ViewMapping & operator = (
const ViewMapping & ) = default ;
1031 KOKKOS_INLINE_FUNCTION ViewMapping( ViewMapping && ) = default ;
1032 KOKKOS_INLINE_FUNCTION ViewMapping & operator = ( ViewMapping && ) = default ;
1034 template<
class ... P >
1035 KOKKOS_INLINE_FUNCTION
1037 ( ViewCtorProp< P ... >
const & prop
1038 ,
typename Traits::array_layout
const & layout
1041 , m_impl_offset( std::integral_constant< unsigned , 0 >()
1046 m_impl_handle.set( ( (ViewCtorProp<void,pointer_type>
const &) prop ).value,
1047 m_impl_offset.span(), m_sacado_size.value );
1055 template<
class ... P >
1056 SharedAllocationRecord<> *
1058 ,
typename Traits::array_layout
const & layout )
1060 typedef ViewCtorProp< P... > ctor_prop ;
1063 typedef typename Traits::memory_space memory_space ;
1064 typedef typename handle_type::template ConstructDestructFunctor<execution_space> functor_type ;
1065 typedef SharedAllocationRecord< memory_space , functor_type > record_type ;
1068 typedef std::integral_constant< unsigned , 0 > padding ;
1074 const size_t alloc_size =
1075 handle_type::memory_span( m_impl_offset.span(), m_sacado_size.value );
1078 record_type *
const record =
1079 record_type::allocate( ( (ViewCtorProp<void,memory_space>
const &) prop ).value
1080 , ( (ViewCtorProp<void,std::string>
const &) prop ).value
1087 m_impl_handle.set( reinterpret_cast< pointer_type >( record->data() ),
1088 m_impl_offset.span(), m_sacado_size.value );
1092 record->m_destroy = m_impl_handle.create_functor(
1093 ( (ViewCtorProp<void,execution_space>
const &) prop).value
1094 , ctor_prop::initialize
1095 , m_impl_offset.span()
1096 , m_sacado_size.value );
1099 record->m_destroy.construct_shared_allocation();
1135 template<
class DstTraits ,
class SrcTraits >
1136 class ViewMapping< DstTraits , SrcTraits ,
1137 typename std::enable_if<(
1138 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1139 , typename SrcTraits::memory_space >::assignable
1142 std::is_same< typename DstTraits::specialize
1143 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1146 std::is_same< typename SrcTraits::specialize
1147 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1149 , typename DstTraits::specialize
1154 enum { is_assignable =
true };
1157 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1158 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1160 KOKKOS_INLINE_FUNCTION
static
1167 std::is_same<
typename DstTraits::array_layout
1168 , Kokkos::LayoutLeft >::value ||
1169 std::is_same<
typename DstTraits::array_layout
1170 , Kokkos::LayoutRight >::value ||
1171 std::is_same<
typename DstTraits::array_layout
1172 , Kokkos::LayoutStride >::value
1176 std::is_same<
typename SrcTraits::array_layout
1177 , Kokkos::LayoutLeft >::value ||
1178 std::is_same<
typename SrcTraits::array_layout
1179 , Kokkos::LayoutRight >::value ||
1180 std::is_same<
typename SrcTraits::array_layout
1181 , Kokkos::LayoutStride >::value
1183 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1186 std::is_same<
typename DstTraits::array_layout
1187 ,
typename SrcTraits::array_layout >::value ||
1188 std::is_same<
typename DstTraits::array_layout
1189 , Kokkos::LayoutStride >::value ||
1190 (
unsigned(DstTraits::rank) == 0 &&
unsigned(SrcTraits::rank) == 0 ) ||
1191 (
unsigned(DstTraits::rank) == 1 &&
unsigned(SrcTraits::rank) == 1 ) ,
1192 "View assignment must have compatible layout" );
1198 ,
typename SrcTraits::const_value_type >::value ,
1199 "View assignment must have same value type or const = non-const" );
1202 ViewDimensionAssignable
1203 <
typename DstType::offset_type::dimension_type
1204 ,
typename SrcType::offset_type::dimension_type >::value ,
1205 "View assignment must have compatible dimensions" );
1207 dst.m_impl_handle = src.m_impl_handle ;
1208 dst.m_impl_offset = src.m_impl_offset ;
1209 dst.m_stride = src.m_stride ;
1210 dst.m_sacado_size = src.m_sacado_size ;
1219 template<
class DstTraits ,
class SrcTraits >
1220 class ViewMapping< DstTraits , SrcTraits ,
1221 typename std::enable_if<(
1222 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1223 , typename SrcTraits::memory_space >::assignable
1226 std::is_same< typename DstTraits::specialize , void >::value
1229 std::is_same< typename SrcTraits::specialize
1230 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1233 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)+1
1235 , typename DstTraits::specialize
1240 enum { is_assignable =
true };
1243 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1244 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1246 KOKKOS_INLINE_FUNCTION
static
1253 std::is_same<
typename DstTraits::array_layout
1254 , Kokkos::LayoutLeft >::value ||
1255 std::is_same<
typename DstTraits::array_layout
1256 , Kokkos::LayoutRight >::value ||
1257 std::is_same<
typename DstTraits::array_layout
1258 , Kokkos::LayoutStride >::value
1262 std::is_same<
typename SrcTraits::array_layout
1263 , Kokkos::LayoutLeft >::value ||
1264 std::is_same<
typename SrcTraits::array_layout
1265 , Kokkos::LayoutRight >::value ||
1266 std::is_same<
typename SrcTraits::array_layout
1267 , Kokkos::LayoutStride >::value
1269 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1272 std::is_same<
typename DstTraits::array_layout
1273 ,
typename SrcTraits::array_layout >::value ||
1274 std::is_same<
typename DstTraits::array_layout
1275 , Kokkos::LayoutStride >::value ,
1276 "View assignment must have compatible layout" );
1279 std::is_same<
typename DstTraits::scalar_array_type
1280 ,
typename SrcTraits::scalar_array_type >::value ||
1281 std::is_same<
typename DstTraits::scalar_array_type
1282 ,
typename SrcTraits::const_scalar_array_type >::value ,
1283 "View assignment must have same value type or const = non-const" );
1286 ViewDimensionAssignable<
1287 typename DstType::offset_type::dimension_type,
1288 typename SrcType::array_offset_type::dimension_type >::value,
1289 "View assignment must have compatible dimensions" );
1291 if ( src.m_stride != 1 ) {
1292 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > cannot assign with non-unit stride ******\n\n");
1296 dims[0] = src.m_impl_offset.dimension_0();
1297 dims[1] = src.m_impl_offset.dimension_1();
1298 dims[2] = src.m_impl_offset.dimension_2();
1299 dims[3] = src.m_impl_offset.dimension_3();
1300 dims[4] = src.m_impl_offset.dimension_4();
1301 dims[5] = src.m_impl_offset.dimension_5();
1302 dims[6] = src.m_impl_offset.dimension_6();
1303 dims[7] = src.m_impl_offset.dimension_7();
1304 unsigned rank = SrcTraits::dimension::rank;
1305 unsigned sacado_size = src.m_sacado_size.value;
1306 if (std::is_same<typename SrcTraits::array_layout, LayoutLeft>::value) {
1308 for (
unsigned i=rank; i>0; --i)
1309 dims[i] = dims[i-1];
1310 dims[0] = sacado_size;
1313 dims[rank] = sacado_size;
1315 typedef typename DstType::offset_type dst_offset_type;
1316 dst.m_impl_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1317 typename DstTraits::array_layout(
1318 dims[0] , dims[1] , dims[2] , dims[3] ,
1319 dims[4] , dims[5] , dims[6] , dims[7] ) );
1320 dst.m_impl_handle = src.m_impl_handle.scalar_ptr ;
1330 template<
class DstTraits ,
class SrcTraits >
1331 class ViewMapping< DstTraits , SrcTraits ,
1332 typename std::enable_if<(
1333 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1334 , typename SrcTraits::memory_space >::assignable
1337 std::is_same< typename DstTraits::specialize , void >::value
1340 std::is_same< typename SrcTraits::specialize
1341 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1344 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)
1346 , typename DstTraits::specialize
1351 enum { is_assignable =
true };
1354 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1355 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1357 KOKKOS_INLINE_FUNCTION
static
1364 std::is_same<
typename DstTraits::array_layout
1365 , Kokkos::LayoutLeft >::value ||
1366 std::is_same<
typename DstTraits::array_layout
1367 , Kokkos::LayoutRight >::value ||
1368 std::is_same<
typename DstTraits::array_layout
1369 , Kokkos::LayoutStride >::value
1373 std::is_same<
typename SrcTraits::array_layout
1374 , Kokkos::LayoutLeft >::value ||
1375 std::is_same<
typename SrcTraits::array_layout
1376 , Kokkos::LayoutRight >::value ||
1377 std::is_same<
typename SrcTraits::array_layout
1378 , Kokkos::LayoutStride >::value
1380 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1383 std::is_same<
typename DstTraits::array_layout
1384 ,
typename SrcTraits::array_layout >::value ||
1385 std::is_same<
typename DstTraits::array_layout
1386 , Kokkos::LayoutStride >::value ,
1387 "View assignment must have compatible layout" );
1394 "View assignment must have same value type or const = non-const" );
1397 ViewDimensionAssignable<
1398 typename DstType::offset_type::dimension_type,
1399 typename SrcType::offset_type::dimension_type >::value,
1400 "View assignment must have compatible dimensions" );
1402 if ( src.m_stride != 1 ) {
1403 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > cannot assign with non-unit stride ******\n\n");
1407 dims[0] = src.m_impl_offset.dimension_0();
1408 dims[1] = src.m_impl_offset.dimension_1();
1409 dims[2] = src.m_impl_offset.dimension_2();
1410 dims[3] = src.m_impl_offset.dimension_3();
1411 dims[4] = src.m_impl_offset.dimension_4();
1412 dims[5] = src.m_impl_offset.dimension_5();
1413 dims[6] = src.m_impl_offset.dimension_6();
1414 dims[7] = src.m_impl_offset.dimension_7();
1415 unsigned rank = SrcTraits::dimension::rank;
1416 unsigned sacado_size = src.m_sacado_size.value;
1417 if (std::is_same<typename DstTraits::array_layout, LayoutLeft>::value) {
1418 dims[0] = dims[0]*sacado_size;
1422 dims[rank-1] = dims[rank-1]*sacado_size;
1425 typedef typename DstType::offset_type dst_offset_type;
1426 dst.m_impl_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1427 typename DstTraits::array_layout(
1428 dims[0] , dims[1] , dims[2] , dims[3] ,
1429 dims[4] , dims[5] , dims[6] , dims[7] ) );
1430 dst.m_impl_handle = src.m_impl_handle.scalar_ptr ;
1444 template<
class DataType,
class ... P ,
class Arg0,
class ... Args >
1446 < typename std::enable_if<(
1448 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::specialize
1449 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1452 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1453 , Kokkos::LayoutLeft >::value ||
1454 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1455 , Kokkos::LayoutRight >::value ||
1456 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1457 , Kokkos::LayoutStride >::value
1459 && !Sacado::MP::is_vector_partition<Arg0>::value
1461 , Kokkos::ViewTraits<DataType,P...>
1472 , R0 = bool(is_integral_extent<0,Arg0,Args...>::value)
1473 , R1 = bool(is_integral_extent<1,Arg0,Args...>::value)
1474 , R2 = bool(is_integral_extent<2,Arg0,Args...>::value)
1475 , R3 = bool(is_integral_extent<3,Arg0,Args...>::value)
1476 , R4 = bool(is_integral_extent<4,Arg0,Args...>::value)
1477 , R5 = bool(is_integral_extent<5,Arg0,Args...>::value)
1478 , R6 = bool(is_integral_extent<6,Arg0,Args...>::value)
1482 enum { rank = unsigned(R0) + unsigned(R1) + unsigned(R2) + unsigned(R3)
1483 + unsigned(R4) + unsigned(R5) + unsigned(R6) };
1486 enum { R0_rev = ( 0 == SrcTraits::rank ? RZ : (
1487 1 == SrcTraits::rank ? R0 : (
1488 2 == SrcTraits::rank ? R1 : (
1489 3 == SrcTraits::rank ? R2 : (
1490 4 == SrcTraits::rank ? R3 : (
1491 5 == SrcTraits::rank ? R4 : (
1492 6 == SrcTraits::rank ? R5 : R6 ))))))) };
1495 typedef typename std::conditional<
1501 ( rank <= 2 && R0 && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutLeft >::value )
1505 ( rank <= 2 && R0_rev && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutRight >::value )
1506 ),
typename SrcTraits::array_layout , Kokkos::LayoutStride
1511 typedef typename std::conditional< rank == 0 , sacado_mp_vector_type ,
1512 typename std::conditional< rank == 1 , sacado_mp_vector_type * ,
1513 typename std::conditional< rank == 2 , sacado_mp_vector_type ** ,
1514 typename std::conditional< rank == 3 , sacado_mp_vector_type *** ,
1515 typename std::conditional< rank == 4 , sacado_mp_vector_type **** ,
1516 typename std::conditional< rank == 5 , sacado_mp_vector_type ***** ,
1517 typename std::conditional< rank == 6 , sacado_mp_vector_type ****** ,
1518 sacado_mp_vector_type *******
1524 typedef Kokkos::ViewTraits
1527 ,
typename SrcTraits::device_type
1530 typedef Kokkos::View
1533 ,
typename SrcTraits::device_type
1534 ,
typename SrcTraits::memory_traits >
type ;
1539 template<
class DstTraits >
1540 KOKKOS_INLINE_FUNCTION
1541 static void assign( ViewMapping< DstTraits , typename DstTraits::specialize > & dst
1542 , ViewMapping< SrcTraits , typename SrcTraits::specialize >
const & src
1543 , Arg0 arg0, Args ... args )
1546 ViewMapping< DstTraits , traits_type , typename DstTraits::specialize >::is_assignable ,
1547 "Subview destination type must be compatible with subview derived type" );
1549 typedef ViewMapping< DstTraits , typename DstTraits::specialize > DstType ;
1550 typedef typename DstType::offset_type dst_offset_type ;
1552 const SubviewExtents< SrcTraits::rank , rank >
1553 extents( src.m_impl_offset.m_dim , arg0 , args... );
1555 const size_t offset = src.m_impl_offset( extents.domain_offset(0)
1556 , extents.domain_offset(1)
1557 , extents.domain_offset(2)
1558 , extents.domain_offset(3)
1559 , extents.domain_offset(4)
1560 , extents.domain_offset(5)
1561 , extents.domain_offset(6)
1562 , extents.domain_offset(7) );
1564 dst.m_impl_offset = dst_offset_type( src.m_impl_offset , extents );
1565 dst.m_impl_handle.value_ptr = src.m_impl_handle.value_ptr + offset;
1566 dst.m_impl_handle.scalar_ptr =
1567 src.m_impl_handle.scalar_ptr + offset * src.m_stride * src.m_sacado_size.value;
1568 dst.m_stride = src.m_stride;
1569 dst.m_sacado_size = src.m_sacado_size;
1586 template<
class DataType,
class ...P,
unsigned Size >
1589 ViewTraits<DataType,P...> ,
1590 Sacado::MP::VectorPartition<Size> >
1594 enum { is_assignable =
true };
1597 typedef ViewMapping< src_traits , typename src_traits::specialize >
src_type ;
1609 typedef ViewMapping< dst_traits , typename dst_traits::specialize >
dst_type ;
1611 KOKKOS_INLINE_FUNCTION
static
1614 ,
const Sacado::MP::VectorPartition<Size> & part )
1618 static_assert( storage_type::is_static,
1619 "For performance reasons, partitioned assignment is only implemented for statically-sized MP::Vector types" );
1621 unsigned len = part.end - part.begin;
1622 if ( Size != len || Size == 0 ) {
1623 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > Invalid size in partitioned view assignment ******\n\n");
1626 dst.m_impl_handle.value_ptr =
1629 dst.m_impl_handle.scalar_ptr = src.m_impl_handle.scalar_ptr +
1630 (part.begin / len) * src.m_stride * src.m_sacado_size.value ;
1631 dst.m_impl_offset = src.m_impl_offset ;
1632 dst.m_stride = src.m_stride * src.m_sacado_size.value / Size ;
1633 dst.m_sacado_size = len ;
1642 template<
unsigned Size,
typename D,
typename ... P >
1643 KOKKOS_INLINE_FUNCTION
1644 typename Kokkos::Impl::ViewMapping< void,
typename Kokkos::ViewTraits<
D,P...>, Sacado::MP::VectorPartition<Size> >::type
1646 const unsigned beg )
1648 typedef Kokkos::ViewTraits<
D,P...> traits;
1649 typedef typename Kokkos::Impl::ViewMapping< void, traits, Sacado::MP::VectorPartition<Size> >::type DstViewType;
1650 const Sacado::MP::VectorPartition<Size> part( beg , beg+Size );
1651 return DstViewType(src, part);
1664 #if defined( KOKKOS_ENABLE_CUDA )
1665 template<
class OutputView >
1666 struct StokhosViewFill< OutputView ,
1667 typename std::enable_if< std::is_same< typename OutputView::specialize,
1668 Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&
1669 std::is_same< typename OutputView::execution_space,
1670 Cuda >::value >::type >
1672 typedef typename OutputView::const_value_type const_value_type ;
1674 typedef typename OutputView::size_type size_type ;
1676 template <
unsigned VectorLength>
1679 const OutputView output;
1680 const_value_type input;
1682 Kernel(
const OutputView & arg_out , const_value_type & arg_in ) :
1683 output(arg_out), input(arg_in) {}
1685 typedef typename Kokkos::TeamPolicy< execution_space >::member_type team_member ;
1687 KOKKOS_INLINE_FUNCTION
1688 void operator()(
const team_member & dev )
const
1690 const size_type tidx = dev.team_rank() % VectorLength;
1691 const size_type tidy = dev.team_rank() / VectorLength;
1692 const size_type nrow = dev.team_size() / VectorLength;
1695 const size_type i0 = dev.league_rank() * nrow + tidy;
1696 if ( i0 >= output.extent(0) )
return;
1698 for ( size_type i1 = 0 ; i1 < output.extent(1) ; ++i1 ) {
1699 for ( size_type i2 = 0 ; i2 < output.extent(2) ; ++i2 ) {
1700 for ( size_type i3 = 0 ; i3 < output.extent(3) ; ++i3 ) {
1701 for ( size_type i4 = 0 ; i4 < output.extent(4) ; ++i4 ) {
1702 for ( size_type i5 = 0 ; i5 < output.extent(5) ; ++i5 ) {
1703 for ( size_type i6 = 0 ; i6 < output.extent(6) ; ++i6 ) {
1704 for ( size_type i7 = 0 ; i7 < output.extent(7) ; ++i7 ) {
1705 for ( size_type is = tidx ; is < nvec ; is+=VectorLength ) {
1706 output.access(i0,i1,i2,i3,i4,i5,i6,i7).fastAccessCoeff(is) =
1707 input.fastAccessCoeff(is) ;
1712 StokhosViewFill(
const OutputView & output , const_value_type & input )
1715 deep_copy( output , input.fastAccessCoeff(0) );
1721 const unsigned vector_length =
1725 const size_type block_size = 256;
1727 const size_type rows_per_block = block_size / vector_length;
1728 const size_type
n = output.extent(0);
1729 const size_type league_size = ( n + rows_per_block-1 ) / rows_per_block;
1730 const size_type team_size = rows_per_block * vector_length;
1731 Kokkos::TeamPolicy< execution_space > config( league_size, team_size );
1733 parallel_for( config, Kernel<vector_length>(output, input) );
1734 execution_space::fence();
1751 struct ViewSpecializeSacadoFad;
1759 template<
class DstTraits ,
class SrcTraits >
1760 class ViewMapping< DstTraits , SrcTraits ,
1761 typename std::enable_if<(
1762 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1763 , typename SrcTraits::memory_space >::assignable
1766 std::is_same< typename DstTraits::specialize
1767 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1770 std::is_same< typename SrcTraits::specialize
1771 , ViewSpecializeSacadoFad >::value
1773 , typename DstTraits::specialize
1778 enum { is_assignable =
true };
1781 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1782 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcFadType ;
1784 template<
class DstType >
1785 KOKKOS_INLINE_FUNCTION
static
1792 std::is_same<
typename DstTraits::array_layout
1793 , Kokkos::LayoutLeft >::value ||
1794 std::is_same<
typename DstTraits::array_layout
1795 , Kokkos::LayoutRight >::value ||
1796 std::is_same<
typename DstTraits::array_layout
1797 , Kokkos::LayoutStride >::value
1801 std::is_same<
typename SrcTraits::array_layout
1802 , Kokkos::LayoutLeft >::value ||
1803 std::is_same<
typename SrcTraits::array_layout
1804 , Kokkos::LayoutRight >::value ||
1805 std::is_same<
typename SrcTraits::array_layout
1806 , Kokkos::LayoutStride >::value
1808 ,
"View of FAD requires LayoutLeft, LayoutRight, or LayoutStride" );
1811 std::is_same<
typename DstTraits::array_layout
1812 ,
typename SrcTraits::array_layout >::value ||
1813 std::is_same<
typename DstTraits::array_layout
1814 , Kokkos::LayoutStride >::value ,
1815 "View assignment must have compatible layout" );
1818 std::is_same<
typename DstTraits::data_type
1819 ,
typename SrcTraits::scalar_array_type >::value ||
1820 std::is_same<
typename DstTraits::data_type
1821 ,
typename SrcTraits::const_scalar_array_type >::value ,
1822 "View assignment must have same value type or const = non-const" );
1825 ViewDimensionAssignable
1826 <
typename DstType::offset_type::dimension_type
1827 ,
typename SrcFadType::array_offset_type::dimension_type >::value ,
1828 "View assignment must have compatible dimensions" );
1830 typedef typename DstType::offset_type dst_offset_type ;
1832 dst.m_impl_offset = dst_offset_type( src.m_array_offset );
1833 dst.m_impl_handle.assign(src.m_impl_handle) ;
1837 static_assert( DstType::is_static,
1838 "Destination view must be statically allocated" );
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_5() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_4() const
storage_type::template apply_N< Size > storage_apply
ViewDataType< const_scalar_type, scalar_dimension >::type const_scalar_array_type
sacado_mp_vector_type::storage_type stokhos_storage_type
KOKKOS_INLINE_FUNCTION constexpr size_t stride_5() const
Kokkos::Impl::SharedAllocationTracker TrackType
Sacado::ValueType< value_type >::type scalar_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_7() const
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::specialize, Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutStride >::value)&&!Sacado::MP::is_vector_partition< Arg0 >::value)>::type, Kokkos::ViewTraits< DataType, P...>, Arg0, Args... >::assign static KOKKOS_INLINE_FUNCTION void assign(ViewMapping< DstTraits, typename DstTraits::specialize > &dst, ViewMapping< SrcTraits, typename SrcTraits::specialize > const &src, Arg0 arg0, Args...args)
ViewOffset< typename array_dimension::template prepend< 0 >::type, typename Traits::array_layout, void > prepend_offset_type
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::specialize, Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutStride >::value)&&!Sacado::MP::is_vector_partition< Arg0 >::value)>::type, Kokkos::ViewTraits< DataType, P...>, Arg0, Args... >::SrcTraits Kokkos::ViewTraits< DataType, P...> SrcTraits
KOKKOS_INLINE_FUNCTION MPVectorAllocation & operator=(const MPVectorAllocation< T, true > &a)
Stokhos::StandardStorage< int, double > storage_type
void destroy_shared_allocation()
ViewDataType< scalar_type, scalar_dimension >::type scalar_array_type
sacado_mp_vector_type & reference_type
KOKKOS_INLINE_FUNCTION constexpr size_t stride_2() const
KOKKOS_INLINE_FUNCTION constexpr pointer_type data() const
Raw data access.
ScalarType non_const_scalar_type
VectorConstruct< ExecSpace > VectorFunctorType
view_type::array_type::value_type flat_value_type
VectorFunctorType m_vector_functor
ViewTraits< strided_data_type, P...> dst_traits
std::add_const< intrinsic_scalar_type >::type const_intrinsic_scalar_type
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
View< flat_data_type, P...> type
static KOKKOS_INLINE_FUNCTION size_t memory_span(typename Traits::array_layout const &layout)
Span, in bytes, of the required memory.
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_4() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_7() const
ViewMapping< dst_traits, typename dst_traits::specialize > dst_type
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1) const
ViewDataType< value_type, dimension >::type type
static KOKKOS_INLINE_FUNCTION constexpr size_t memory_span(const size_t span, const unsigned vector_size)
array_analysis::const_value_type const_value_type
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
KOKKOS_INLINE_FUNCTION MPVectorAllocation & operator=(const MPVectorAllocation< T, false > &a)
Kokkos::DefaultExecutionSpace execution_space
Sacado::MP::Vector< strided_storage_type > strided_value_type
Kokkos::Impl::SharedAllocationTracker TrackType
Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type > ScalarFunctorType
stokhos_storage_type::value_type intrinsic_scalar_type
KOKKOS_INLINE_FUNCTION MPVectorAllocation()
Sacado::integral_nonzero< unsigned, StokhosStorageStaticDimension > sacado_size_type
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3, const I4 &i4, const I5 &i5, const I6 &i6) const
std::conditional< std::is_same< ArrayLayout, Kokkos::LayoutLeft >::value, prepend_scalar_dimension, append_scalar_dimension >::type scalar_dimension
ConstructDestructFunctor< ExecSpace > create_functor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size) const
KOKKOS_INLINE_FUNCTION void set(value_type *ptr, const size_t span, const unsigned vector_size)
array_analysis::non_const_value_type non_const_value_type
handle_type m_impl_handle
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< View< T, P...> >::value, unsigned >::type dimension_scalar(const View< T, P...> &view)
KOKKOS_INLINE_FUNCTION constexpr size_t extent(const iType &r) const
ViewOffset< typename array_dimension::template append< StokhosStorageStaticDimension >::type, typename Traits::array_layout, void > append_offset_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_0() const
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_6() const
ViewDataType< const_value_type, dimension >::type const_type
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
Traits::value_type sacado_mp_vector_type
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::specialize, Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutStride >::value)&&!Sacado::MP::is_vector_partition< Arg0 >::value)>::type, Kokkos::ViewTraits< DataType, P...>, Arg0, Args... >::data_type std::conditional< rank==0, sacado_mp_vector_type, typename std::conditional< rank==1, sacado_mp_vector_type *, typename std::conditional< rank==2, sacado_mp_vector_type **, typename std::conditional< rank==3, sacado_mp_vector_type ***, typename std::conditional< rank==4, sacado_mp_vector_type ****, typename std::conditional< rank==5, sacado_mp_vector_type *****, typename std::conditional< rank==6, sacado_mp_vector_type ******, sacado_mp_vector_type ******* >::type >::type >::type >::type >::type >::type >::type data_type
sacado_mp_vector_type * pointer_type
Pointer to underlying memory type.
KOKKOS_INLINE_FUNCTION void set(value_type *ptr, const size_t span, const unsigned vector_size)
KOKKOS_FORCEINLINE_FUNCTION constexpr unsigned dimension_scalar() const
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< std::is_integral< I0 >::value &&!std::is_same< typename Traits::array_layout, Kokkos::LayoutStride >::value, reference_type >::type reference(const I0 &i0) const
ViewArrayAnalysis< typename Traits::data_type > array_analysis
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
ViewMapping< src_traits, typename src_traits::specialize > src_type
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcFadType &src, const TrackType &)
Kokkos::Experimental::Impl::MPVectorAllocation< sacado_mp_vector_type > handle_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_2() const
KOKKOS_INLINE_FUNCTION void assign(T *ptr)
void construct_shared_allocation()
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
StorageType::value_type ScalarType
VectorConstruct(const ExecSpace &space, value_type *p, scalar_type *sp, const size_t span, const unsigned vector_size)
SharedAllocationRecord * allocate_shared(ViewCtorProp< P... > const &prop, typename Traits::array_layout const &layout)
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_1() const
void construct_shared_allocation()
void destroy_shared_allocation()
View< strided_data_type, P...> type
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::specialize, Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutStride >::value)&&!Sacado::MP::is_vector_partition< Arg0 >::value)>::type, Kokkos::ViewTraits< DataType, P...>, Arg0, Args... >::sacado_mp_vector_type SrcTraits::value_type sacado_mp_vector_type
sacado_size_type m_sacado_size
static KOKKOS_INLINE_FUNCTION constexpr size_t memory_span(const size_t span, const unsigned vector_size)
Kokkos::Impl::SharedAllocationTracker TrackType
std::conditional< is_const, const ScalarType, ScalarType >::type scalar_type
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< std::is_integral< I0 >::value &&std::is_same< typename Traits::array_layout, Kokkos::LayoutStride >::value, reference_type >::type reference(const I0 &i0) const
KOKKOS_INLINE_FUNCTION bool is_constant(const T &x)
void deep_copy(const Stokhos::CrsMatrix< ValueType, DstDevice, Layout > &dst, const Stokhos::CrsMatrix< ValueType, SrcDevice, Layout > &src)
KOKKOS_INLINE_FUNCTION constexpr size_t span() const
Span of the mapped range : [ data() .. data() + span() )
Kokkos::Impl::SharedAllocationTracker TrackType
ViewDataType< strided_value_type, src_dimension >::type strided_data_type
KOKKOS_INLINE_FUNCTION constexpr size_t stride_1() const
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2) const
ConstructDestructFunctor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size, scalar_type *scalar_ptr, value_type *value_ptr)
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_3() const
ConstructDestructFunctor< ExecSpace > create_functor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size) const
src_type::offset_type::dimension_type src_dimension
Kokkos::Experimental::Impl::ViewMPVectorContiguous specialize
KOKKOS_INLINE_FUNCTION Kokkos::Impl::ViewMapping< void, typename Kokkos::ViewTraits< D, P...>, Sacado::MP::VectorPartition< Size > >::type partition(const Kokkos::View< D, P...> &src, const unsigned beg)
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3, const I4 &i4, const I5 &i5, const I6 &i6, const I7 &i7) const
KOKKOS_INLINE_FUNCTION constexpr bool span_is_contiguous() const
Is the mapped range span contiguous.
ConstructDestructFunctor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size, scalar_type *scalar_ptr)
std::conditional< std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft >::value, prepend_offset_type, append_offset_type >::type array_offset_type
ViewDataType< non_const_scalar_type, scalar_dimension >::type non_const_scalar_array_type
static KOKKOS_INLINE_FUNCTION void assign(dst_type &dst, const src_type &src, const Sacado::MP::VectorPartition< Size > &part)
KOKKOS_INLINE_FUNCTION void stride(iType *const s) const
KOKKOS_FORCEINLINE_FUNCTION reference_type reference() const
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcFadType
ViewTraits< DataType, P...> src_traits
offset_type m_impl_offset
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3, const I4 &i4) const
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::specialize, Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutStride >::value)&&!Sacado::MP::is_vector_partition< Arg0 >::value)>::type, Kokkos::ViewTraits< DataType, P...>, Arg0, Args... >::type Kokkos::View< data_type, array_layout, typename SrcTraits::device_type, typename SrcTraits::memory_traits > type
array_analysis::value_type value_type
Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type > FunctorType
ViewOffset< typename Traits::dimension, typename Traits::array_layout, void > offset_type
KOKKOS_INLINE_FUNCTION constexpr size_t stride_0() const
KOKKOS_INLINE_FUNCTION MPVectorAllocation()
ViewArrayAnalysis< DataType > array_analysis
Sacado::ValueType< value_type >::type scalar_type
array_analysis::dimension::template prepend< 0 >::type prepend_scalar_dimension
const ScalarType const_scalar_type
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
Kokkos::Impl::ViewDataType< flat_value_type, dimension >::type flat_data_type
storage_apply::type strided_storage_type
std::false_type is_regular
array_analysis::dimension array_dimension
KOKKOS_INLINE_FUNCTION void assign(T *ptr)
KOKKOS_INLINE_FUNCTION constexpr size_t stride_3() const
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::specialize, Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutStride >::value)&&!Sacado::MP::is_vector_partition< Arg0 >::value)>::type, Kokkos::ViewTraits< DataType, P...>, Arg0, Args... >::traits_type Kokkos::ViewTraits< data_type, array_layout, typename SrcTraits::device_type, typename SrcTraits::memory_traits > traits_type
array_analysis::dimension dimension
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3) const
Stokhos::CrsMatrix< ValueType, Device, Layout >::HostMirror create_mirror(const Stokhos::CrsMatrix< ValueType, Device, Layout > &A)
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3, const I4 &i4, const I5 &i5) const
ScalarFunctorType m_scalar_functor
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
mp_vector_type::storage_type storage_type
array_analysis::dimension::template append< DimVector >::type append_scalar_dimension
src_traits::value_type mp_vector_type
KOKKOS_INLINE_FUNCTION constexpr size_t stride_6() const
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::specialize, Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&(std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::ViewTraits< DataType, P...>::array_layout, Kokkos::LayoutStride >::value)&&!Sacado::MP::is_vector_partition< Arg0 >::value)>::type, Kokkos::ViewTraits< DataType, P...>, Arg0, Args... >::array_layout std::conditional< ((rank==0)||(rank<=2 &&R0 &&std::is_same< typename SrcTraits::array_layout, Kokkos::LayoutLeft >::value)||(rank<=2 &&R0_rev &&std::is_same< typename SrcTraits::array_layout, Kokkos::LayoutRight >::value)), typename SrcTraits::array_layout, Kokkos::LayoutStride >::type array_layout
ViewDataType< non_const_value_type, dimension >::type non_const_type
KOKKOS_INLINE_FUNCTION constexpr Traits::array_layout layout() const
view_type::traits::dimension dimension
KOKKOS_INLINE_FUNCTION ViewMapping()