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>
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
202 template<
class ExecSpace,
class DT ,
class ... DP ,
class ST ,
class ... SP >
205 const View<DT,DP...> & dst ,
206 const View<ST,SP...> & src
207 ,
typename std::enable_if<(
208 std::is_same<
typename ViewTraits<DT,DP...>::specialize
211 std::is_same<
typename ViewTraits<ST,SP...>::specialize
219 #include "Kokkos_Core.hpp" 223 template <
typename D,
typename ... P>
225 typename
std::enable_if< is_view_mp_vector< View<D,P...> >::value >
::type > {
227 typedef typename view_type::traits::dimension
dimension;
229 typedef typename Kokkos::Impl::ViewDataType< flat_value_type , dimension >::type
flat_data_type;
233 template<
class T ,
class ... P >
235 typename Kokkos::View<T,P...>::HostMirror
237 ,
typename std::enable_if<
238 std::is_same<
typename ViewTraits<T,P...>::specialize ,
241 ! std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
242 , Kokkos::LayoutStride >::value
246 typedef View<T,P...> src_type ;
247 typedef typename src_type::HostMirror dst_type ;
249 typename src_type::array_layout layout = src.layout();
252 return dst_type(std::string(src.label()).append(
"_mirror"), layout);
255 template<
class T ,
class ... P >
257 typename Kokkos::View<T,P...>::HostMirror
259 ,
typename std::enable_if<
260 std::is_same<
typename ViewTraits<T,P...>::specialize ,
263 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
264 , Kokkos::LayoutStride >::value
268 typedef View<T,P...> src_type ;
269 typedef typename src_type::HostMirror dst_type ;
271 Kokkos::LayoutStride layout ;
273 layout.dimension[0] = src.extent(0);
274 layout.dimension[1] = src.extent(1);
275 layout.dimension[2] = src.extent(2);
276 layout.dimension[3] = src.extent(3);
277 layout.dimension[4] = src.extent(4);
278 layout.dimension[5] = src.extent(5);
279 layout.dimension[6] = src.extent(6);
280 layout.dimension[7] = src.extent(7);
282 layout.stride[0] = src.stride_0();
283 layout.stride[1] = src.stride_1();
284 layout.stride[2] = src.stride_2();
285 layout.stride[3] = src.stride_3();
286 layout.stride[4] = src.stride_4();
287 layout.stride[5] = src.stride_5();
288 layout.stride[6] = src.stride_6();
289 layout.stride[7] = src.stride_7();
293 return dst_type(std::string(src.label()).append(
"_mirror"), layout);
296 template<
class Space,
class T,
class ... P>
297 typename Impl::MirrorType<Space,T,P ...>::view_type
299 ,
typename std::enable_if<
300 std::is_same<
typename ViewTraits<T,P...>::specialize ,
303 typedef View<T,P...> src_type ;
304 typename src_type::array_layout layout = src.layout();
310 template<
class DT,
class ... DP >
312 const View<DT,DP...> & view ,
314 ,
typename std::enable_if<(
315 std::is_same<
typename ViewTraits<DT,DP...>::specialize
321 typename ViewTraits<DT,DP...>::non_const_value_type >::value
322 ,
"Can only deep copy into non-const type" );
329 template<
class DT,
class ... DP >
331 const View<DT,DP...> & view ,
333 ,
typename std::enable_if<(
334 std::is_same<
typename ViewTraits<DT,DP...>::specialize
340 typename ViewTraits<DT,DP...>::non_const_value_type >::value
341 ,
"Can only deep copy into non-const type" );
354 template<
class ExecSpace ,
class DT,
class ... DP >
357 const View<DT,DP...> & view ,
359 ,
typename std::enable_if<(
360 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
361 std::is_same<
typename ViewTraits<DT,DP...>::specialize
367 typename ViewTraits<DT,DP...>::non_const_value_type >::value
368 ,
"Can only deep copy into non-const type" );
375 template<
class ExecSpace ,
class DT,
class ... DP >
378 const View<DT,DP...> & view ,
380 ,
typename std::enable_if<(
381 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
382 std::is_same<
typename ViewTraits<DT,DP...>::specialize
388 typename ViewTraits<DT,DP...>::non_const_value_type >::value
389 ,
"Can only deep copy into non-const type" );
402 template<
class ExecSpace,
class DT ,
class ... DP ,
class ST ,
class ... SP >
405 const View<DT,DP...> & dst ,
406 const View<ST,SP...> & src
407 ,
typename std::enable_if<(
408 std::is_same<
typename ViewTraits<DT,DP...>::specialize
411 std::is_same<
typename ViewTraits<ST,SP...>::specialize
417 typename ViewTraits<DT,DP...>::non_const_value_type >::value
418 ,
"Deep copy destination must be non-const" );
421 (
unsigned(ViewTraits<DT,DP...>::rank) ==
422 unsigned(ViewTraits<ST,SP...>::rank) )
423 ,
"Deep copy destination and source must have same rank" );
443 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
446 const View<ST,SP...> & src
447 ,
typename std::enable_if<(
448 std::is_same<
typename ViewTraits<DT,DP...>::specialize
451 std::is_same<
typename ViewTraits<ST,SP...>::specialize
466 template<
class DataType ,
class ArrayLayout ,
typename StorageType >
467 struct ViewDataAnalysis< DataType
469 ,
Sacado::MP::Vector< StorageType > >
475 static const int DimVector = StorageType::static_size;
489 ViewDataType< value_type , dimension >::type
type ;
491 ViewDataType< const_value_type , dimension >::type
const_type ;
498 enum { is_const = std::is_same< value_type , const_value_type >::value };
502 std::conditional< is_const , const ScalarType , ScalarType >::type
510 typedef typename array_analysis::dimension::
511 template prepend<0>::type
513 typedef typename array_analysis::dimension::
514 template append<DimVector>::type
516 typedef typename std::conditional<
517 std::is_same< ArrayLayout, Kokkos::LayoutLeft>::value,
528 ViewDataType< const_scalar_type , scalar_dimension >::type
532 ViewDataType< non_const_scalar_type , scalar_dimension >::type
542 namespace Experimental {
545 template <
class ValueType,
546 bool is_static = Sacado::IsStaticallySized<ValueType>::value >
552 template <
class ValueType>
560 KOKKOS_INLINE_FUNCTION
561 static constexpr
size_t 566 KOKKOS_INLINE_FUNCTION
569 template <
typename T>
570 KOKKOS_INLINE_FUNCTION
572 value_ptr = a.value_ptr;
573 scalar_ptr = a.scalar_ptr;
577 KOKKOS_INLINE_FUNCTION
578 void set(
value_type* ptr,
const size_t span,
const unsigned vector_size) {
583 template <
class ExecSpace>
584 struct ConstructDestructFunctor {
585 typedef Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type >
FunctorType ;
589 ConstructDestructFunctor() =
default;
590 ConstructDestructFunctor(
const ConstructDestructFunctor&) =
default;
591 ConstructDestructFunctor& operator=(
const ConstructDestructFunctor&) =
default;
594 const bool initialize,
596 const unsigned vector_size,
598 m_functor( space , scalar_ptr , span*vector_size ,
"Stokhos_MP_VectorContig_ConstructDestructFunctor1" ),
599 m_initialize(initialize) {}
603 m_functor.construct_shared_allocation();
608 m_functor.destroy_shared_allocation();
613 template <
class ExecSpace>
614 inline ConstructDestructFunctor<ExecSpace>
616 const bool initialize,
618 const unsigned vector_size)
const {
619 return ConstructDestructFunctor<ExecSpace>(space, initialize, span, vector_size, scalar_ptr);
623 template <
typename T>
624 KOKKOS_INLINE_FUNCTION
626 value_ptr =
reinterpret_cast<value_type*
>(ptr);
637 template <
class ValueType>
645 KOKKOS_INLINE_FUNCTION
646 static constexpr
size_t 651 KOKKOS_INLINE_FUNCTION
654 template <
typename T>
655 KOKKOS_INLINE_FUNCTION
657 value_ptr = a.value_ptr;
658 scalar_ptr = a.scalar_ptr;
665 KOKKOS_INLINE_FUNCTION
666 void set(
value_type* ptr,
const size_t span,
const unsigned vector_size) {
668 scalar_ptr =
reinterpret_cast<scalar_type*
>(ptr+span);
671 template <
class ExecSpace>
672 struct VectorConstruct {
679 VectorConstruct() =
default;
680 VectorConstruct(
const VectorConstruct&) =
default;
681 VectorConstruct& operator=(
const VectorConstruct&) =
default;
688 const unsigned vector_size) :
689 m_space(space), m_p(p), m_sp(sp), m_span(span), m_vector_size(vector_size) {}
692 if ( ! m_space.in_parallel() ) {
693 typedef Kokkos::RangePolicy< ExecSpace > PolicyType ;
694 const Kokkos::Impl::ParallelFor< VectorConstruct , PolicyType >
695 closure( *
this , PolicyType( 0 , m_span ) );
700 for (
size_t i = 0 ; i < m_span ; ++i )
operator()(i);
704 KOKKOS_INLINE_FUNCTION
705 void operator() (
const size_t i)
const {
706 new (m_p+i)
value_type(m_vector_size, m_sp+i*m_vector_size,
false);
710 template <
class ExecSpace>
711 struct ConstructDestructFunctor {
718 ConstructDestructFunctor() =
default;
719 ConstructDestructFunctor(
const ConstructDestructFunctor&) =
default;
720 ConstructDestructFunctor& operator=(
const ConstructDestructFunctor&) =
default;
723 const bool initialize,
725 const unsigned vector_size,
728 m_scalar_functor( space , scalar_ptr , span*vector_size ,
"Stokhos_MP_VectorContig_ConstructDestructFunctor2" ),
729 m_vector_functor( space , value_ptr , scalar_ptr , span , vector_size ),
730 m_initialize(initialize) {}
735 m_scalar_functor.construct_shared_allocation();
747 m_vector_functor.execute();
754 m_scalar_functor.destroy_shared_allocation();
759 template <
class ExecSpace>
760 inline ConstructDestructFunctor<ExecSpace>
762 const bool initialize,
764 const unsigned vector_size)
const {
765 return ConstructDestructFunctor<ExecSpace>(space, initialize, span, vector_size, scalar_ptr, value_ptr);
770 template <
typename T>
771 KOKKOS_INLINE_FUNCTION
773 value_ptr =
reinterpret_cast<value_type*
>(ptr);
775 scalar_ptr = value_ptr->coeff();
786 template<
class Traits >
787 class ViewMapping< Traits ,
788 typename
std::enable_if<
789 ( std::is_same< typename Traits::specialize
790 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
792 ( std::is_same< typename Traits::array_layout
793 , Kokkos::LayoutLeft >::value
795 std::is_same< typename Traits::array_layout
796 , Kokkos::LayoutRight >::value
798 std::is_same< typename Traits::array_layout
799 , Kokkos::LayoutStride >::value
802 , typename Traits::specialize
807 template< class ,
class ... >
friend class ViewMapping ;
808 template< class ,
class ... >
friend class Kokkos::View ;
816 enum { StokhosStorageStaticDimension = stokhos_storage_type::static_size };
817 typedef Sacado::integral_nonzero< unsigned , StokhosStorageStaticDimension >
sacado_size_type;
821 typedef ViewOffset<
typename Traits::dimension
822 ,
typename Traits::array_layout
830 typedef ViewOffset<
typename array_dimension::
831 template append<StokhosStorageStaticDimension>::type,
832 typename Traits::array_layout,
835 typedef ViewOffset<
typename array_dimension::
836 template prepend<0>::type,
837 typename Traits::array_layout,
840 typedef typename std::conditional<
841 std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft>::value,
875 enum { Rank = Traits::dimension::rank };
878 enum { Sacado_Rank = std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft >::value ? 0 : Rank+1 };
881 template<
typename iType >
882 KOKKOS_INLINE_FUNCTION constexpr
size_t extent(
const iType & r )
const 883 {
return m_impl_offset.m_dim.extent(r); }
885 KOKKOS_INLINE_FUNCTION constexpr
886 typename Traits::array_layout
layout()
const 887 {
return m_impl_offset.layout(); }
890 {
return m_impl_offset.dimension_0(); }
892 {
return m_impl_offset.dimension_1(); }
894 {
return m_impl_offset.dimension_2(); }
896 {
return m_impl_offset.dimension_3(); }
898 {
return m_impl_offset.dimension_4(); }
900 {
return m_impl_offset.dimension_5(); }
902 {
return m_impl_offset.dimension_6(); }
904 {
return m_impl_offset.dimension_7(); }
912 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_0()
const 913 {
return m_impl_offset.stride_0(); }
914 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_1()
const 915 {
return m_impl_offset.stride_1(); }
916 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_2()
const 917 {
return m_impl_offset.stride_2(); }
918 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_3()
const 919 {
return m_impl_offset.stride_3(); }
920 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_4()
const 921 {
return m_impl_offset.stride_4(); }
922 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_5()
const 923 {
return m_impl_offset.stride_5(); }
924 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_6()
const 925 {
return m_impl_offset.stride_6(); }
926 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_7()
const 927 {
return m_impl_offset.stride_7(); }
929 template<
typename iType >
930 KOKKOS_INLINE_FUNCTION
void stride( iType *
const s )
const 931 { m_impl_offset.stride(s); }
935 {
return m_sacado_size.value; }
938 static const bool is_static = stokhos_storage_type::is_static ;
941 static const bool is_contiguous =
true;
953 KOKKOS_INLINE_FUNCTION constexpr
size_t span()
const 954 {
return m_impl_offset.span(); }
958 {
return m_impl_offset.span_is_contiguous() && (m_stride == 1); }
962 {
return m_impl_handle.value_ptr ; }
966 KOKKOS_FORCEINLINE_FUNCTION
968 {
return *m_impl_handle.value_ptr; }
971 template<
typename I0 >
972 KOKKOS_FORCEINLINE_FUNCTION
974 std::enable_if< std::is_integral<I0>::value &&
975 ! std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
976 , reference_type >::type
978 {
return m_impl_handle.value_ptr[m_stride * i0]; }
981 template<
typename I0 >
982 KOKKOS_FORCEINLINE_FUNCTION
984 std::enable_if< std::is_integral<I0>::value &&
985 std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
986 , reference_type >::type
988 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0) ]; }
990 template<
typename I0 ,
typename I1 >
991 KOKKOS_FORCEINLINE_FUNCTION
993 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1) ]; }
995 template<
typename I0 ,
typename I1 ,
typename I2 >
996 KOKKOS_FORCEINLINE_FUNCTION
998 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2) ]; }
1000 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3 >
1001 KOKKOS_FORCEINLINE_FUNCTION
1003 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3) ]; }
1005 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1007 KOKKOS_FORCEINLINE_FUNCTION
1009 ,
const I4 & i4 )
const 1010 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4) ]; }
1012 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1013 ,
typename I4 ,
typename I5 >
1014 KOKKOS_FORCEINLINE_FUNCTION
1016 ,
const I4 & i4 ,
const I5 & i5 )
const 1017 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5) ]; }
1019 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1020 ,
typename I4 ,
typename I5 ,
typename I6 >
1021 KOKKOS_FORCEINLINE_FUNCTION
1023 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 )
const 1024 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ]; }
1026 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1027 ,
typename I4 ,
typename I5 ,
typename I6 ,
typename I7 >
1028 KOKKOS_FORCEINLINE_FUNCTION
1030 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 ,
const I7 & i7 )
const 1031 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ]; }
1036 KOKKOS_INLINE_FUNCTION
1037 static size_t memory_span(
typename Traits::array_layout
const & layout )
1040 typedef std::integral_constant< unsigned , 0 > padding ;
1044 const unsigned static_dim = StokhosStorageStaticDimension;
1046 return handle_type::memory_span( offset.span(), static_dim );
1049 const size_t sacado_size =
1051 return handle_type::memory_span( offset.span(), sacado_size );
1056 KOKKOS_DEFAULTED_FUNCTION ~ViewMapping() = default ;
1064 KOKKOS_DEFAULTED_FUNCTION ViewMapping(
const ViewMapping & ) = default ;
1065 KOKKOS_DEFAULTED_FUNCTION ViewMapping & operator = (
const ViewMapping & ) = default ;
1067 KOKKOS_DEFAULTED_FUNCTION ViewMapping( ViewMapping && ) = default ;
1068 KOKKOS_DEFAULTED_FUNCTION ViewMapping & operator = ( ViewMapping && ) = default ;
1070 template<
class ... P >
1071 KOKKOS_INLINE_FUNCTION
1073 ( ViewCtorProp< P ... >
const & prop
1074 ,
typename Traits::array_layout
const & layout
1077 , m_impl_offset( std::integral_constant< unsigned , 0 >()
1082 m_impl_handle.set( ( (ViewCtorProp<void,pointer_type>
const &) prop ).value,
1083 m_impl_offset.span(), m_sacado_size.value );
1087 KOKKOS_INLINE_FUNCTION
1089 { m_impl_handle.set( arg_ptr, m_impl_offset.span(), m_sacado_size.value ); }
1096 template<
class ... P >
1097 SharedAllocationRecord<> *
1099 ,
typename Traits::array_layout
const & layout )
1101 typedef ViewCtorProp< P... > ctor_prop ;
1104 typedef typename Traits::memory_space memory_space ;
1105 typedef typename handle_type::template ConstructDestructFunctor<execution_space> functor_type ;
1106 typedef SharedAllocationRecord< memory_space , functor_type > record_type ;
1109 typedef std::integral_constant< unsigned , 0 > padding ;
1115 const size_t alloc_size =
1116 handle_type::memory_span( m_impl_offset.span(), m_sacado_size.value );
1119 record_type *
const record =
1120 record_type::allocate( ( (ViewCtorProp<void,memory_space>
const &) prop ).value
1121 , ( (ViewCtorProp<void,std::string>
const &) prop ).value
1128 m_impl_handle.set( reinterpret_cast< pointer_type >( record->data() ),
1129 m_impl_offset.span(), m_sacado_size.value );
1133 record->m_destroy = m_impl_handle.create_functor(
1134 ( (ViewCtorProp<void,execution_space>
const &) prop).value
1135 , ctor_prop::initialize
1136 , m_impl_offset.span()
1137 , m_sacado_size.value );
1140 record->m_destroy.construct_shared_allocation();
1176 template<
class DstTraits ,
class SrcTraits >
1177 class ViewMapping< DstTraits , SrcTraits ,
1178 typename
std::enable_if<(
1179 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1180 , typename SrcTraits::memory_space >::assignable
1183 std::is_same< typename DstTraits::specialize
1184 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1187 std::is_same< typename SrcTraits::specialize
1188 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1190 , typename DstTraits::specialize
1195 enum { is_assignable =
true };
1196 enum { is_assignable_data_type =
true };
1199 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1200 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1202 KOKKOS_INLINE_FUNCTION
static 1209 std::is_same<
typename DstTraits::array_layout
1210 , Kokkos::LayoutLeft >::value ||
1211 std::is_same<
typename DstTraits::array_layout
1212 , Kokkos::LayoutRight >::value ||
1213 std::is_same<
typename DstTraits::array_layout
1214 , Kokkos::LayoutStride >::value
1218 std::is_same<
typename SrcTraits::array_layout
1219 , Kokkos::LayoutLeft >::value ||
1220 std::is_same<
typename SrcTraits::array_layout
1221 , Kokkos::LayoutRight >::value ||
1222 std::is_same<
typename SrcTraits::array_layout
1223 , Kokkos::LayoutStride >::value
1225 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1228 std::is_same<
typename DstTraits::array_layout
1229 ,
typename SrcTraits::array_layout >::value ||
1230 std::is_same<
typename DstTraits::array_layout
1231 , Kokkos::LayoutStride >::value ||
1232 (
unsigned(DstTraits::rank) == 0 &&
unsigned(SrcTraits::rank) == 0 ) ||
1233 (
unsigned(DstTraits::rank) == 1 &&
unsigned(SrcTraits::rank) == 1 ) ,
1234 "View assignment must have compatible layout" );
1240 ,
typename SrcTraits::const_value_type >::value ,
1241 "View assignment must have same value type or const = non-const" );
1244 ViewDimensionAssignable
1245 <
typename DstType::offset_type::dimension_type
1246 ,
typename SrcType::offset_type::dimension_type >::value ,
1247 "View assignment must have compatible dimensions" );
1249 dst.m_impl_handle = src.m_impl_handle ;
1250 dst.m_impl_offset = src.m_impl_offset ;
1251 dst.m_stride = src.m_stride ;
1252 dst.m_sacado_size = src.m_sacado_size ;
1261 template<
class DstTraits ,
class SrcTraits >
1262 class ViewMapping< DstTraits , SrcTraits ,
1263 typename
std::enable_if<(
1264 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1265 , typename SrcTraits::memory_space >::assignable
1268 std::is_same< typename DstTraits::specialize , void >::value
1271 std::is_same< typename SrcTraits::specialize
1272 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1275 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)+1
1277 , typename DstTraits::specialize
1282 enum { is_assignable =
true };
1283 enum { is_assignable_data_type =
true };
1286 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1287 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1289 KOKKOS_INLINE_FUNCTION
static 1296 std::is_same<
typename DstTraits::array_layout
1297 , Kokkos::LayoutLeft >::value ||
1298 std::is_same<
typename DstTraits::array_layout
1299 , Kokkos::LayoutRight >::value ||
1300 std::is_same<
typename DstTraits::array_layout
1301 , Kokkos::LayoutStride >::value
1305 std::is_same<
typename SrcTraits::array_layout
1306 , Kokkos::LayoutLeft >::value ||
1307 std::is_same<
typename SrcTraits::array_layout
1308 , Kokkos::LayoutRight >::value ||
1309 std::is_same<
typename SrcTraits::array_layout
1310 , Kokkos::LayoutStride >::value
1312 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1315 std::is_same<
typename DstTraits::array_layout
1316 ,
typename SrcTraits::array_layout >::value ||
1317 std::is_same<
typename DstTraits::array_layout
1318 , Kokkos::LayoutStride >::value ,
1319 "View assignment must have compatible layout" );
1322 std::is_same<
typename DstTraits::scalar_array_type
1323 ,
typename SrcTraits::scalar_array_type >::value ||
1324 std::is_same<
typename DstTraits::scalar_array_type
1325 ,
typename SrcTraits::const_scalar_array_type >::value ,
1326 "View assignment must have same value type or const = non-const" );
1329 ViewDimensionAssignable<
1330 typename DstType::offset_type::dimension_type,
1331 typename SrcType::array_offset_type::dimension_type >::value,
1332 "View assignment must have compatible dimensions" );
1334 if ( src.m_stride != 1 ) {
1335 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > cannot assign with non-unit stride ******\n\n");
1339 dims[0] = src.m_impl_offset.dimension_0();
1340 dims[1] = src.m_impl_offset.dimension_1();
1341 dims[2] = src.m_impl_offset.dimension_2();
1342 dims[3] = src.m_impl_offset.dimension_3();
1343 dims[4] = src.m_impl_offset.dimension_4();
1344 dims[5] = src.m_impl_offset.dimension_5();
1345 dims[6] = src.m_impl_offset.dimension_6();
1346 dims[7] = src.m_impl_offset.dimension_7();
1347 unsigned rank = SrcTraits::dimension::rank;
1348 unsigned sacado_size = src.m_sacado_size.value;
1349 if (std::is_same<typename SrcTraits::array_layout, LayoutLeft>::value) {
1351 for (
unsigned i=rank; i>0; --i)
1352 dims[i] = dims[i-1];
1353 dims[0] = sacado_size;
1356 dims[rank] = sacado_size;
1358 typedef typename DstType::offset_type dst_offset_type;
1359 dst.m_impl_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1360 typename DstTraits::array_layout(
1361 dims[0] , dims[1] , dims[2] , dims[3] ,
1362 dims[4] , dims[5] , dims[6] , dims[7] ) );
1363 dst.m_impl_handle = src.m_impl_handle.scalar_ptr ;
1373 template<
class DstTraits ,
class SrcTraits >
1374 class ViewMapping< DstTraits , SrcTraits ,
1375 typename
std::enable_if<(
1376 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1377 , typename SrcTraits::memory_space >::assignable
1380 std::is_same< typename DstTraits::specialize , void >::value
1383 std::is_same< typename SrcTraits::specialize
1384 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1387 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)
1389 , typename DstTraits::specialize
1394 enum { is_assignable =
true };
1395 enum { is_assignable_data_type =
true };
1398 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1399 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1401 KOKKOS_INLINE_FUNCTION
static 1408 std::is_same<
typename DstTraits::array_layout
1409 , Kokkos::LayoutLeft >::value ||
1410 std::is_same<
typename DstTraits::array_layout
1411 , Kokkos::LayoutRight >::value ||
1412 std::is_same<
typename DstTraits::array_layout
1413 , Kokkos::LayoutStride >::value
1417 std::is_same<
typename SrcTraits::array_layout
1418 , Kokkos::LayoutLeft >::value ||
1419 std::is_same<
typename SrcTraits::array_layout
1420 , Kokkos::LayoutRight >::value ||
1421 std::is_same<
typename SrcTraits::array_layout
1422 , Kokkos::LayoutStride >::value
1424 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1427 std::is_same<
typename DstTraits::array_layout
1428 ,
typename SrcTraits::array_layout >::value ||
1429 std::is_same<
typename DstTraits::array_layout
1430 , Kokkos::LayoutStride >::value ,
1431 "View assignment must have compatible layout" );
1438 "View assignment must have same value type or const = non-const" );
1441 ViewDimensionAssignable<
1442 typename DstType::offset_type::dimension_type,
1443 typename SrcType::offset_type::dimension_type >::value,
1444 "View assignment must have compatible dimensions" );
1446 if ( src.m_stride != 1 ) {
1447 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > cannot assign with non-unit stride ******\n\n");
1451 dims[0] = src.m_impl_offset.dimension_0();
1452 dims[1] = src.m_impl_offset.dimension_1();
1453 dims[2] = src.m_impl_offset.dimension_2();
1454 dims[3] = src.m_impl_offset.dimension_3();
1455 dims[4] = src.m_impl_offset.dimension_4();
1456 dims[5] = src.m_impl_offset.dimension_5();
1457 dims[6] = src.m_impl_offset.dimension_6();
1458 dims[7] = src.m_impl_offset.dimension_7();
1459 unsigned rank = SrcTraits::dimension::rank;
1460 unsigned sacado_size = src.m_sacado_size.value;
1461 if (std::is_same<typename DstTraits::array_layout, LayoutLeft>::value) {
1462 dims[0] = dims[0]*sacado_size;
1466 dims[rank-1] = dims[rank-1]*sacado_size;
1469 typedef typename DstType::offset_type dst_offset_type;
1470 dst.m_impl_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1471 typename DstTraits::array_layout(
1472 dims[0] , dims[1] , dims[2] , dims[3] ,
1473 dims[4] , dims[5] , dims[6] , dims[7] ) );
1474 dst.m_impl_handle = src.m_impl_handle.scalar_ptr ;
1488 template<
class DataType,
class ... P ,
class Arg0,
class ... Args >
1490 < typename
std::enable_if<(
1492 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::specialize
1493 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1496 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1497 , Kokkos::LayoutLeft >::value ||
1498 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1499 , Kokkos::LayoutRight >::value ||
1500 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1501 , Kokkos::LayoutStride >::value
1503 && !Sacado::MP::is_vector_partition<Arg0>::value
1505 , Kokkos::ViewTraits<DataType,P...>
1516 , R0 = bool(is_integral_extent<0,Arg0,Args...>::value)
1517 , R1 = bool(is_integral_extent<1,Arg0,Args...>::value)
1518 , R2 = bool(is_integral_extent<2,Arg0,Args...>::value)
1519 , R3 = bool(is_integral_extent<3,Arg0,Args...>::value)
1520 , R4 = bool(is_integral_extent<4,Arg0,Args...>::value)
1521 , R5 = bool(is_integral_extent<5,Arg0,Args...>::value)
1522 , R6 = bool(is_integral_extent<6,Arg0,Args...>::value)
1526 enum { rank = unsigned(R0) + unsigned(R1) + unsigned(R2) + unsigned(R3)
1527 + unsigned(R4) + unsigned(R5) + unsigned(R6) };
1530 enum { R0_rev = ( 0 == SrcTraits::rank ? RZ : (
1531 1 == SrcTraits::rank ? R0 : (
1532 2 == SrcTraits::rank ? R1 : (
1533 3 == SrcTraits::rank ? R2 : (
1534 4 == SrcTraits::rank ? R3 : (
1535 5 == SrcTraits::rank ? R4 : (
1536 6 == SrcTraits::rank ? R5 : R6 ))))))) };
1539 typedef typename std::conditional<
1545 ( rank <= 2 && R0 && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutLeft >::value )
1549 ( rank <= 2 && R0_rev && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutRight >::value )
1550 ),
typename SrcTraits::array_layout , Kokkos::LayoutStride
1568 typedef Kokkos::ViewTraits
1571 ,
typename SrcTraits::device_type
1574 typedef Kokkos::View
1577 ,
typename SrcTraits::device_type
1578 ,
typename SrcTraits::memory_traits >
type ;
1583 template<
class DstTraits >
1584 KOKKOS_INLINE_FUNCTION
1585 static void assign( ViewMapping< DstTraits , typename DstTraits::specialize > & dst
1586 , ViewMapping< SrcTraits , typename SrcTraits::specialize >
const & src
1587 , Arg0 arg0, Args ... args )
1590 ViewMapping< DstTraits , traits_type , typename DstTraits::specialize >::is_assignable ,
1591 "Subview destination type must be compatible with subview derived type" );
1593 typedef ViewMapping< DstTraits , typename DstTraits::specialize > DstType ;
1594 typedef typename DstType::offset_type dst_offset_type ;
1596 const SubviewExtents< SrcTraits::rank , rank >
1597 extents( src.m_impl_offset.m_dim , arg0 , args... );
1599 const size_t offset = src.m_impl_offset( extents.domain_offset(0)
1600 , extents.domain_offset(1)
1601 , extents.domain_offset(2)
1602 , extents.domain_offset(3)
1603 , extents.domain_offset(4)
1604 , extents.domain_offset(5)
1605 , extents.domain_offset(6)
1606 , extents.domain_offset(7) );
1608 dst.m_impl_offset = dst_offset_type( src.m_impl_offset , extents );
1609 dst.m_impl_handle.value_ptr = src.m_impl_handle.value_ptr + offset;
1610 dst.m_impl_handle.scalar_ptr =
1611 src.m_impl_handle.scalar_ptr + offset * src.m_stride * src.m_sacado_size.value;
1612 dst.m_stride = src.m_stride;
1613 dst.m_sacado_size = src.m_sacado_size;
1630 template<
class DataType,
class ...P,
unsigned Size >
1633 ViewTraits<DataType,P...> ,
1634 Sacado::MP::VectorPartition<Size> >
1638 enum { is_assignable =
true };
1639 enum { is_assignable_data_type =
true };
1642 typedef ViewMapping< src_traits , typename src_traits::specialize >
src_type ;
1654 typedef ViewMapping< dst_traits , typename dst_traits::specialize >
dst_type ;
1656 KOKKOS_INLINE_FUNCTION
static 1659 ,
const Sacado::MP::VectorPartition<Size> & part )
1663 static_assert( storage_type::is_static,
1664 "For performance reasons, partitioned assignment is only implemented for statically-sized MP::Vector types" );
1666 unsigned len = part.end - part.begin;
1667 if ( Size != len || Size == 0 ) {
1668 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > Invalid size in partitioned view assignment ******\n\n");
1671 dst.m_impl_handle.value_ptr =
1674 dst.m_impl_handle.scalar_ptr = src.m_impl_handle.scalar_ptr +
1675 (part.begin / len) * src.m_stride * src.m_sacado_size.value ;
1676 dst.m_impl_offset = src.m_impl_offset ;
1677 dst.m_stride = src.m_stride * src.m_sacado_size.value / Size ;
1678 dst.m_sacado_size = len ;
1687 template<
unsigned Size,
typename D,
typename ... P >
1688 KOKKOS_INLINE_FUNCTION
1689 typename Kokkos::Impl::ViewMapping< void,
typename Kokkos::ViewTraits<D,P...>, Sacado::MP::VectorPartition<Size> >::type
1691 const unsigned beg )
1693 typedef Kokkos::ViewTraits<D,P...> traits;
1694 typedef typename Kokkos::Impl::ViewMapping< void, traits, Sacado::MP::VectorPartition<Size> >::type DstViewType;
1695 const Sacado::MP::VectorPartition<Size> part( beg , beg+Size );
1696 return DstViewType(src, part);
1709 #if defined( KOKKOS_ENABLE_CUDA ) 1710 template<
class OutputView >
1711 struct StokhosViewFill< OutputView ,
1712 typename
std::enable_if< std::is_same< typename OutputView::specialize,
1713 Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&
1714 std::is_same< typename OutputView::execution_space,
1715 Cuda >::value >::type >
1719 typedef typename OutputView::size_type size_type ;
1721 template <
unsigned VectorLength>
1730 typedef typename Kokkos::TeamPolicy< execution_space >::member_type team_member ;
1732 KOKKOS_INLINE_FUNCTION
1733 void operator()(
const team_member & dev )
const 1735 const size_type tidx = dev.team_rank() % VectorLength;
1736 const size_type tidy = dev.team_rank() / VectorLength;
1737 const size_type nrow = dev.team_size() / VectorLength;
1740 const size_type i0 = dev.league_rank() * nrow + tidy;
1741 if ( i0 >=
output.extent(0) )
return;
1743 for ( size_type i1 = 0 ; i1 <
output.extent(1) ; ++i1 ) {
1744 for ( size_type i2 = 0 ; i2 <
output.extent(2) ; ++i2 ) {
1745 for ( size_type i3 = 0 ; i3 <
output.extent(3) ; ++i3 ) {
1746 for ( size_type i4 = 0 ; i4 <
output.extent(4) ; ++i4 ) {
1747 for ( size_type i5 = 0 ; i5 <
output.extent(5) ; ++i5 ) {
1748 for ( size_type i6 = 0 ; i6 <
output.extent(6) ; ++i6 ) {
1749 for ( size_type i7 = 0 ; i7 <
output.extent(7) ; ++i7 ) {
1750 for ( size_type is = tidx ; is < nvec ; is+=VectorLength ) {
1751 output.access(i0,i1,i2,i3,i4,i5,i6,i7).fastAccessCoeff(is) =
1752 input.fastAccessCoeff(is) ;
1766 const unsigned vector_length =
1770 const size_type block_size = 256;
1772 const size_type rows_per_block = block_size / vector_length;
1773 const size_type n =
output.extent(0);
1774 const size_type league_size = ( n + rows_per_block-1 ) / rows_per_block;
1775 const size_type team_size = rows_per_block * vector_length;
1776 Kokkos::TeamPolicy< execution_space > config( league_size, team_size );
1778 parallel_for( config, Kernel<vector_length>(
output,
input) );
1796 struct ViewSpecializeSacadoFad;
1804 template<
class DstTraits ,
class SrcTraits >
1805 class ViewMapping< DstTraits , SrcTraits ,
1806 typename
std::enable_if<(
1807 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1808 , typename SrcTraits::memory_space >::assignable
1811 std::is_same< typename DstTraits::specialize
1812 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1815 std::is_same< typename SrcTraits::specialize
1816 , ViewSpecializeSacadoFad >::value
1818 , typename DstTraits::specialize
1823 enum { is_assignable =
true };
1824 enum { is_assignable_data_type =
true };
1827 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1828 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcFadType ;
1830 template<
class DstType >
1831 KOKKOS_INLINE_FUNCTION
static 1838 std::is_same<
typename DstTraits::array_layout
1839 , Kokkos::LayoutLeft >::value ||
1840 std::is_same<
typename DstTraits::array_layout
1841 , Kokkos::LayoutRight >::value ||
1842 std::is_same<
typename DstTraits::array_layout
1843 , Kokkos::LayoutStride >::value
1847 std::is_same<
typename SrcTraits::array_layout
1848 , Kokkos::LayoutLeft >::value ||
1849 std::is_same<
typename SrcTraits::array_layout
1850 , Kokkos::LayoutRight >::value ||
1851 std::is_same<
typename SrcTraits::array_layout
1852 , Kokkos::LayoutStride >::value
1854 ,
"View of FAD requires LayoutLeft, LayoutRight, or LayoutStride" );
1857 std::is_same<
typename DstTraits::array_layout
1858 ,
typename SrcTraits::array_layout >::value ||
1859 std::is_same<
typename DstTraits::array_layout
1860 , Kokkos::LayoutStride >::value ,
1861 "View assignment must have compatible layout" );
1864 std::is_same<
typename DstTraits::data_type
1865 ,
typename SrcTraits::scalar_array_type >::value ||
1866 std::is_same<
typename DstTraits::data_type
1867 ,
typename SrcTraits::const_scalar_array_type >::value ,
1868 "View assignment must have same value type or const = non-const" );
1871 ViewDimensionAssignable
1872 <
typename DstType::offset_type::dimension_type
1873 ,
typename SrcFadType::array_offset_type::dimension_type >::value ,
1874 "View assignment must have compatible dimensions" );
1876 typedef typename DstType::offset_type dst_offset_type ;
1878 dst.m_impl_offset = dst_offset_type( src.m_array_offset );
1879 dst.m_impl_handle.assign(src.m_impl_handle) ;
1883 static_assert( DstType::is_static,
1884 "Destination view must be statically allocated" );
std::add_const< intrinsic_scalar_type >::type const_intrinsic_scalar_type
ViewDataType< const_scalar_type, scalar_dimension >::type const_scalar_array_type
std::false_type is_regular
Kokkos::Impl::SharedAllocationTracker TrackType
static KOKKOS_INLINE_FUNCTION void assign(dst_type &dst, const src_type &src, const Sacado::MP::VectorPartition< Size > &part)
Sacado::ValueType< value_type >::type scalar_type
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 MPVectorAllocation & operator=(const MPVectorAllocation< T, true > &a)
mp_vector_type::storage_type storage_type
Stokhos::StandardStorage< int, double > storage_type
void destroy_shared_allocation()
ViewDataType< scalar_type, scalar_dimension >::type scalar_array_type
ViewMapping< src_traits, typename src_traits::specialize > src_type
Sacado::integral_nonzero< unsigned, StokhosStorageStaticDimension > sacado_size_type
ScalarType non_const_scalar_type
VectorConstruct< ExecSpace > VectorFunctorType
VectorFunctorType m_vector_functor
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
KOKKOS_INLINE_FUNCTION constexpr bool span_is_contiguous() const
Is the mapped range span contiguous.
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
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_1() const
Kokkos::Impl::SharedAllocationTracker TrackType
Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type > ScalarFunctorType
KOKKOS_INLINE_FUNCTION MPVectorAllocation()
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_0() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_2() 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
View< strided_data_type, P... > type
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
std::conditional< std::is_same< ArrayLayout, Kokkos::LayoutLeft >::value, prepend_scalar_dimension, append_scalar_dimension >::type scalar_dimension
ViewOffset< typename array_dimension::template append< StokhosStorageStaticDimension >::type, typename Traits::array_layout, void > append_offset_type
array_analysis::non_const_value_type non_const_value_type
KOKKOS_INLINE_FUNCTION void stride(iType *const s) 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 ... >::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
ViewMapping< dst_traits, typename dst_traits::specialize > dst_type
view_type::array_type::value_type flat_value_type
sacado_size_type m_sacado_size
KOKKOS_INLINE_FUNCTION void assign_data(pointer_type arg_ptr)
Assign data.
ViewDataType< const_value_type, dimension >::type const_type
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
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)
View< D, P... > view_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_5() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_0() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_7() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_4() const
KOKKOS_INLINE_FUNCTION constexpr pointer_type data() const
Raw data access.
ConstructDestructFunctor< ExecSpace > create_functor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size) const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_6() const
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
Sacado::MP::Vector< strided_storage_type > strided_value_type
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcFadType &src, const TrackType &)
OutputView::const_value_type const_value_type
KOKKOS_INLINE_FUNCTION void assign(T *ptr)
handle_type m_impl_handle
ViewTraits< DataType, P... > src_traits
void construct_shared_allocation()
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
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
Kokkos::Impl::ViewDataType< flat_value_type, dimension >::type flat_data_type
sacado_mp_vector_type * pointer_type
Pointer to underlying memory type.
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2) const
StorageType::value_type ScalarType
VectorConstruct(const ExecSpace &space, value_type *p, scalar_type *sp, const size_t span, const unsigned vector_size)
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_6() const
static KOKKOS_INLINE_FUNCTION size_t memory_span(typename Traits::array_layout const &layout)
Span, in bytes, of the required memory.
void construct_shared_allocation()
void destroy_shared_allocation()
stokhos_storage_type::value_type intrinsic_scalar_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 ... >::traits_type Kokkos::ViewTraits< data_type, array_layout, typename SrcTraits::device_type, typename SrcTraits::memory_traits > traits_type
storage_apply::type strided_storage_type
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
Traits::value_type sacado_mp_vector_type
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< View< T, P... > >::value, unsigned >::type dimension_scalar(const View< T, P... > &view)
View< flat_data_type, P... > type
src_traits::value_type mp_vector_type
OutputView::execution_space execution_space
KOKKOS_INLINE_FUNCTION void operator()(const size_t i0) const
offset_type m_impl_offset
KOKKOS_INLINE_FUNCTION constexpr size_t stride_3() const
KOKKOS_INLINE_FUNCTION bool is_constant(const T &x)
sacado_mp_vector_type & reference_type
void deep_copy(const Stokhos::CrsMatrix< ValueType, DstDevice, Layout > &dst, const Stokhos::CrsMatrix< ValueType, SrcDevice, Layout > &src)
array_analysis::dimension array_dimension
ViewArrayAnalysis< typename Traits::data_type > array_analysis
Kokkos::Impl::SharedAllocationTracker TrackType
StokhosViewFill(const OutputView &arg_out, const_value_type &arg_in)
KOKKOS_INLINE_FUNCTION constexpr Traits::array_layout layout() const
src_type::offset_type::dimension_type src_dimension
ViewOffset< typename Traits::dimension, typename Traits::array_layout, void > offset_type
Kokkos::Experimental::Impl::MPVectorAllocation< sacado_mp_vector_type > handle_type
ConstructDestructFunctor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size, scalar_type *scalar_ptr, value_type *value_ptr)
storage_type::template apply_N< Size > storage_apply
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
SharedAllocationRecord * allocate_shared(ViewCtorProp< P... > const &prop, typename Traits::array_layout const &layout)
Kokkos::Experimental::Impl::ViewMPVectorContiguous specialize
KOKKOS_INLINE_FUNCTION constexpr size_t stride_5() const
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
ConstructDestructFunctor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size, scalar_type *scalar_ptr)
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_7() const
ViewDataType< non_const_scalar_type, scalar_dimension >::type non_const_scalar_array_type
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcFadType
KOKKOS_FORCEINLINE_FUNCTION constexpr unsigned dimension_scalar() const
view_type::traits::dimension dimension
KOKKOS_INLINE_FUNCTION constexpr size_t stride_1() 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 ... >::SrcTraits Kokkos::ViewTraits< DataType, P... > SrcTraits
array_analysis::value_type value_type
Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type > FunctorType
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_3() const
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1) const
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
KOKKOS_FORCEINLINE_FUNCTION reference_type reference() const
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3) const
KOKKOS_INLINE_FUNCTION MPVectorAllocation()
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3, const I4 &i4) const
ViewArrayAnalysis< DataType > array_analysis
Sacado::ValueType< value_type >::type scalar_type
std::conditional< std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft >::value, prepend_offset_type, append_offset_type >::type array_offset_type
array_analysis::dimension::template prepend< 0 >::type prepend_scalar_dimension
const ScalarType const_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
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
KOKKOS_INLINE_FUNCTION ViewMapping()
ViewOffset< typename array_dimension::template prepend< 0 >::type, typename Traits::array_layout, void > prepend_offset_type
ViewDataType< strided_value_type, src_dimension >::type strided_data_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 ... >::type Kokkos::View< data_type, array_layout, typename SrcTraits::device_type, typename SrcTraits::memory_traits > type
KOKKOS_INLINE_FUNCTION void assign(T *ptr)
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
array_analysis::dimension dimension
Stokhos::CrsMatrix< ValueType, Device, Layout >::HostMirror create_mirror(const Stokhos::CrsMatrix< ValueType, Device, Layout > &A)
ScalarFunctorType m_scalar_functor
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
KOKKOS_INLINE_FUNCTION constexpr size_t span() const
Span of the mapped range : [ data() .. data() + span() )
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_4() const
array_analysis::dimension::template append< DimVector >::type append_scalar_dimension
sacado_mp_vector_type::storage_type stokhos_storage_type
ConstructDestructFunctor< ExecSpace > create_functor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size) const
KOKKOS_INLINE_FUNCTION constexpr size_t extent(const iType &r) const
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_2() const
View< T, P... > view_type
ViewDataType< non_const_value_type, dimension >::type non_const_type
ViewTraits< strided_data_type, P... > dst_traits