10 #ifndef KOKKOS_EXPERIMENTAL_VIEW_MP_VECTOR_CONTIGUOUS_HPP
11 #define KOKKOS_EXPERIMENTAL_VIEW_MP_VECTOR_CONTIGUOUS_HPP
18 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
19 #define KOKKOS_IMPL_PUBLIC_INCLUDE
20 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
22 #include "Kokkos_Layout.hpp"
23 #ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
24 #undef KOKKOS_IMPL_PUBLIC_INCLUDE
25 #undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
34 namespace Experimental {
39 template<
class ... Args >
42 template<
class D ,
class ... P ,
class ... Args >
45 std::is_same<
typename Kokkos::ViewTraits<
D,P...>::specialize
48 ( (
sizeof...(Args) == 0 ) ||
58 template <
typename T,
typename ... P>
61 static const bool value =
62 std::is_same<
typename view_type::specialize,
66 template <
typename T,
typename ... P>
67 KOKKOS_INLINE_FUNCTION
71 return view.impl_map().dimension_scalar();
78 #include "Sacado_Traits.hpp"
81 #include "Kokkos_Core.hpp"
85 template <
typename D,
typename ... P>
87 typename std::enable_if< is_view_mp_vector< View<D,P...> >::value >
::type > {
89 typedef typename view_type::traits::dimension
dimension;
91 typedef typename Kokkos::Impl::ViewDataType< flat_value_type , dimension >::type
flat_data_type;
95 template <
class T,
class... P,
class... ViewCtorArgs>
97 const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop,
98 const View<T, P...>& src,
99 typename std::enable_if_t<
100 std::is_same_v<
typename ViewTraits<T, P...>::specialize,
104 static_assert(std::is_same_v<
typename ViewTraits<T, P...>::array_layout, LayoutLeft> ||
105 std::is_same_v<
typename ViewTraits<T, P...>::array_layout, LayoutRight> ||
106 std::is_same_v<
typename ViewTraits<T, P...>::array_layout, LayoutStride>);
108 using src_type =
View<T, P...>;
110 auto layout = [&] () {
111 if constexpr ( ! std::is_same_v<
typename ViewTraits<T, P...>::array_layout, LayoutStride>) {
116 for (
int idx = 0; idx <= 7; ++idx) {
117 layout.dimension[idx] = src.extent(idx);
118 layout.stride [idx] = src.stride(idx);
127 const auto prop_copy = Impl::with_properties_if_unset(
128 arg_prop, std::string(src.label()).append(
"_mirror"));
130 if constexpr (Impl::ViewCtorProp<ViewCtorArgs...>::has_memory_space){
131 return typename Impl::MirrorViewType<
typename Impl::ViewCtorProp<ViewCtorArgs...>::memory_space, T, P ...>::dest_view_type(prop_copy, layout);
133 return typename View<T, P...>::HostMirror(prop_copy, layout);
137 template <
class T,
class... P>
139 const View<T, P...>& src,
140 typename std::enable_if_t<
141 std::is_same_v<
typename ViewTraits<T, P...>::specialize,
148 template <
class Space,
class T,
class... P,
typename Enable>
151 const View<T, P...>& src,
152 typename std::enable_if_t<
153 std::is_same_v<
typename ViewTraits<T, P...>::specialize,
160 template <
class T,
class... P>
162 Impl::WithoutInitializing_t wi,
163 const View<T, P...>& src,
164 typename std::enable_if_t<
165 std::is_same_v<
typename ViewTraits<T, P...>::specialize,
172 template <
class Space,
class T,
class... P,
typename Enable>
174 Impl::WithoutInitializing_t wi,
176 const View<T, P...>& src,
177 typename std::enable_if_t<
178 std::is_same_v<
typename ViewTraits<T, P...>::specialize,
185 template <
class T,
class... P,
class... ViewCtorArgs>
187 const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop,
188 const Kokkos::View<T, P...>& src,
189 typename std::enable_if_t<
190 std::is_same_v<
typename ViewTraits<T, P...>::specialize,
197 template <
class Space,
class T,
class... P>
198 typename Impl::MirrorViewType<Space, T, P...>::view_type
200 const Space&,
const Kokkos::View<T, P...>& src,
201 std::string
const& name,
202 typename std::enable_if<
203 std::is_same<
typename ViewTraits<T, P...>::specialize,
209 "Kokkos::create_mirror_view_and_copy: fence before returning src view");
213 template <
class Space,
class T,
class... P>
214 typename Impl::MirrorViewType<Space, T, P...>::view_type
216 const Space&,
const Kokkos::View<T, P...>& src,
217 std::string
const& name,
218 typename std::enable_if<
219 std::is_same<
typename ViewTraits<T, P...>::specialize,
223 using src_type =
View<T,P...>;
225 std::string label = name.empty() ? src.label() : name;
226 typename src_type::array_layout layout = src.layout();
228 auto mirror =
typename Mirror::non_const_type{
229 view_alloc(WithoutInitializing, label), layout};
235 template<
class DT,
class ... DP >
237 const View<DT,DP...> & view ,
239 ,
typename std::enable_if<(
240 std::is_same<
typename ViewTraits<DT,DP...>::specialize
246 typename ViewTraits<DT,DP...>::non_const_value_type >::value
247 ,
"Can only deep copy into non-const type" );
254 template<
class DT,
class ... DP >
256 const View<DT,DP...> & view ,
258 ,
typename std::enable_if<(
259 std::is_same<
typename ViewTraits<DT,DP...>::specialize
265 typename ViewTraits<DT,DP...>::non_const_value_type >::value
266 ,
"Can only deep copy into non-const type" );
279 template<
class ExecSpace ,
class DT,
class ... DP >
282 const View<DT,DP...> & view ,
284 ,
typename std::enable_if<(
285 Kokkos::is_execution_space< ExecSpace >::value &&
286 std::is_same<
typename ViewTraits<DT,DP...>::specialize
292 typename ViewTraits<DT,DP...>::non_const_value_type >::value
293 ,
"Can only deep copy into non-const type" );
300 template<
class ExecSpace ,
class DT,
class ... DP >
303 const View<DT,DP...> & view ,
305 ,
typename std::enable_if<(
306 Kokkos::is_execution_space< ExecSpace >::value &&
307 std::is_same<
typename ViewTraits<DT,DP...>::specialize
313 typename ViewTraits<DT,DP...>::non_const_value_type >::value
314 ,
"Can only deep copy into non-const type" );
327 template<
class ExecSpace,
class DT ,
class ... DP ,
class ST ,
class ... SP >
330 const View<DT,DP...> & dst ,
331 const View<ST,SP...> & src
332 ,
typename std::enable_if<(
333 std::is_same<
typename ViewTraits<DT,DP...>::specialize
336 std::is_same<
typename ViewTraits<ST,SP...>::specialize
342 typename ViewTraits<DT,DP...>::non_const_value_type >::value
343 ,
"Deep copy destination must be non-const" );
346 (
unsigned(ViewTraits<DT,DP...>::rank) ==
347 unsigned(ViewTraits<ST,SP...>::rank) )
348 ,
"Deep copy destination and source must have same rank" );
368 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
371 const View<ST,SP...> & src
372 ,
typename std::enable_if<(
373 std::is_same<
typename ViewTraits<DT,DP...>::specialize
376 std::is_same<
typename ViewTraits<ST,SP...>::specialize
388 template <
unsigned N,
typename... Args>
389 KOKKOS_FUNCTION std::enable_if_t<
390 N ==
View<Args...>::rank &&
391 std::is_same<
typename ViewTraits<Args...>::specialize,
400 template <
unsigned N,
typename T,
typename... Args>
402 N !=
View<T, Args...>::rank &&
403 std::is_same<
typename ViewTraits<T, Args...>::specialize,
408 Kokkos::Impl::throw_runtime_exception(
409 "Trying to get at a View of the wrong rank");
420 template<
class DataType ,
class ArrayLayout ,
typename StorageType >
421 struct ViewDataAnalysis< DataType
423 , Sacado::MP::Vector< StorageType > >
429 static const int DimVector = StorageType::static_size;
443 ViewDataType< value_type , dimension >::type
type ;
445 ViewDataType< const_value_type , dimension >::type
const_type ;
452 enum { is_const = std::is_same< value_type , const_value_type >::value };
456 std::conditional< is_const , const ScalarType , ScalarType >::type
464 typedef typename array_analysis::dimension::
465 template prepend<0>::type
467 typedef typename array_analysis::dimension::
468 template append<DimVector>::type
470 typedef typename std::conditional<
471 std::is_same< ArrayLayout, Kokkos::LayoutLeft>::value,
482 ViewDataType< const_scalar_type , scalar_dimension >::type
486 ViewDataType< non_const_scalar_type , scalar_dimension >::type
496 namespace Experimental {
499 template <
class ValueType,
500 bool is_static = Sacado::IsStaticallySized<ValueType>::value >
506 template <
class ValueType>
514 KOKKOS_INLINE_FUNCTION
515 static constexpr
size_t
520 KOKKOS_INLINE_FUNCTION
523 template <
typename T>
524 KOKKOS_INLINE_FUNCTION
526 value_ptr = a.value_ptr;
527 scalar_ptr = a.scalar_ptr;
531 KOKKOS_INLINE_FUNCTION
537 template <
class ExecSpace>
538 struct ConstructDestructFunctor {
539 typedef Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type >
FunctorType ;
543 ConstructDestructFunctor() =
default;
544 ConstructDestructFunctor(
const ConstructDestructFunctor&) =
default;
545 ConstructDestructFunctor& operator=(
const ConstructDestructFunctor&) =
default;
548 const bool initialize,
550 const unsigned vector_size,
552 m_functor( space , scalar_ptr , span*vector_size ,
"Stokhos_MP_VectorContig_ConstructDestructFunctor1" ),
553 m_initialize(initialize) {}
557 m_functor.construct_shared_allocation();
562 m_functor.destroy_shared_allocation();
567 template <
class ExecSpace>
568 inline ConstructDestructFunctor<ExecSpace>
570 const bool initialize,
572 const unsigned vector_size)
const {
573 return ConstructDestructFunctor<ExecSpace>(space, initialize, span, vector_size, scalar_ptr);
577 template <
typename T>
578 KOKKOS_INLINE_FUNCTION
580 value_ptr =
reinterpret_cast<value_type*
>(ptr);
591 template <
class ValueType>
599 KOKKOS_INLINE_FUNCTION
600 static constexpr
size_t
605 KOKKOS_INLINE_FUNCTION
608 template <
typename T>
609 KOKKOS_INLINE_FUNCTION
611 value_ptr = a.value_ptr;
612 scalar_ptr = a.scalar_ptr;
619 KOKKOS_INLINE_FUNCTION
622 scalar_ptr =
reinterpret_cast<scalar_type*
>(ptr+span);
625 template <
class ExecSpace>
626 struct VectorConstruct {
633 VectorConstruct() =
default;
634 VectorConstruct(
const VectorConstruct&) =
default;
635 VectorConstruct& operator=(
const VectorConstruct&) =
default;
642 const unsigned vector_size) :
643 m_space(space), m_p(p), m_sp(sp), m_span(span), m_vector_size(vector_size) {}
646 typedef Kokkos::RangePolicy< ExecSpace > PolicyType ;
647 const Kokkos::Impl::ParallelFor< VectorConstruct , PolicyType >
648 closure( *
this , PolicyType( 0 , m_span ) );
653 KOKKOS_INLINE_FUNCTION
654 void operator() (
const size_t i)
const {
655 new (m_p+i)
value_type(m_vector_size, m_sp+i*m_vector_size,
false);
659 template <
class ExecSpace>
660 struct ConstructDestructFunctor {
667 ConstructDestructFunctor() =
default;
668 ConstructDestructFunctor(
const ConstructDestructFunctor&) =
default;
669 ConstructDestructFunctor& operator=(
const ConstructDestructFunctor&) =
default;
672 const bool initialize,
674 const unsigned vector_size,
677 m_scalar_functor( space , scalar_ptr , span*vector_size ,
"Stokhos_MP_VectorContig_ConstructDestructFunctor2" ),
678 m_vector_functor( space , value_ptr , scalar_ptr , span , vector_size ),
679 m_initialize(initialize) {}
684 m_scalar_functor.construct_shared_allocation();
696 m_vector_functor.execute();
703 m_scalar_functor.destroy_shared_allocation();
708 template <
class ExecSpace>
709 inline ConstructDestructFunctor<ExecSpace>
711 const bool initialize,
713 const unsigned vector_size)
const {
714 return ConstructDestructFunctor<ExecSpace>(space, initialize, span, vector_size, scalar_ptr, value_ptr);
719 template <
typename T>
720 KOKKOS_INLINE_FUNCTION
722 value_ptr =
reinterpret_cast<value_type*
>(ptr);
724 scalar_ptr = value_ptr->coeff();
735 template<
class Traits >
736 class ViewMapping< Traits ,
737 typename std::enable_if<
738 ( std::is_same< typename Traits::specialize
739 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
741 ( std::is_same< typename Traits::array_layout
742 , Kokkos::LayoutLeft >::value
744 std::is_same< typename Traits::array_layout
745 , Kokkos::LayoutRight >::value
747 std::is_same< typename Traits::array_layout
748 , Kokkos::LayoutStride >::value
751 , typename Traits::specialize
756 template< class ,
class ... >
friend class ViewMapping ;
757 template< class ,
class ... >
friend class Kokkos::View ;
765 enum { StokhosStorageStaticDimension = stokhos_storage_type::static_size };
766 typedef Sacado::integral_nonzero< unsigned , StokhosStorageStaticDimension >
sacado_size_type;
770 typedef ViewOffset<
typename Traits::dimension
771 ,
typename Traits::array_layout
779 typedef ViewOffset<
typename array_dimension::
780 template append<StokhosStorageStaticDimension>::type,
781 typename Traits::array_layout,
784 typedef ViewOffset<
typename array_dimension::
785 template prepend<0>::type,
786 typename Traits::array_layout,
789 typedef typename std::conditional<
790 std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft>::value,
824 enum { Rank = Traits::dimension::rank };
827 enum { Sacado_Rank = std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft >::value ? 0 : Rank+1 };
830 template<
typename iType >
831 KOKKOS_INLINE_FUNCTION constexpr
size_t extent(
const iType & r )
const
832 {
return m_impl_offset.m_dim.extent(r); }
834 KOKKOS_INLINE_FUNCTION constexpr
835 typename Traits::array_layout
layout()
const
836 {
return m_impl_offset.layout(); }
839 {
return m_impl_offset.dimension_0(); }
841 {
return m_impl_offset.dimension_1(); }
843 {
return m_impl_offset.dimension_2(); }
845 {
return m_impl_offset.dimension_3(); }
847 {
return m_impl_offset.dimension_4(); }
849 {
return m_impl_offset.dimension_5(); }
851 {
return m_impl_offset.dimension_6(); }
853 {
return m_impl_offset.dimension_7(); }
861 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_0()
const
862 {
return m_impl_offset.stride_0(); }
863 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_1()
const
864 {
return m_impl_offset.stride_1(); }
865 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_2()
const
866 {
return m_impl_offset.stride_2(); }
867 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_3()
const
868 {
return m_impl_offset.stride_3(); }
869 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_4()
const
870 {
return m_impl_offset.stride_4(); }
871 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_5()
const
872 {
return m_impl_offset.stride_5(); }
873 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_6()
const
874 {
return m_impl_offset.stride_6(); }
875 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_7()
const
876 {
return m_impl_offset.stride_7(); }
878 template<
typename iType >
879 KOKKOS_INLINE_FUNCTION
void stride( iType *
const s )
const
880 { m_impl_offset.stride(s); }
884 {
return m_sacado_size.value; }
887 static const bool is_static = stokhos_storage_type::is_static ;
890 static const bool is_contiguous =
true;
902 KOKKOS_INLINE_FUNCTION constexpr
size_t span()
const
903 {
return m_impl_offset.span(); }
907 {
return m_impl_offset.span_is_contiguous() && (m_stride == 1); }
911 {
return m_impl_handle.value_ptr ; }
915 KOKKOS_FORCEINLINE_FUNCTION
917 {
return *m_impl_handle.value_ptr; }
920 template<
typename I0 >
921 KOKKOS_FORCEINLINE_FUNCTION
923 std::enable_if< std::is_integral<I0>::value &&
924 ! std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
925 , reference_type >::type
927 {
return m_impl_handle.value_ptr[m_stride * i0]; }
930 template<
typename I0 >
931 KOKKOS_FORCEINLINE_FUNCTION
933 std::enable_if< std::is_integral<I0>::value &&
934 std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
935 , reference_type >::type
937 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0) ]; }
939 template<
typename I0 ,
typename I1 >
940 KOKKOS_FORCEINLINE_FUNCTION
942 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1) ]; }
944 template<
typename I0 ,
typename I1 ,
typename I2 >
945 KOKKOS_FORCEINLINE_FUNCTION
947 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2) ]; }
949 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3 >
950 KOKKOS_FORCEINLINE_FUNCTION
952 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3) ]; }
954 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
956 KOKKOS_FORCEINLINE_FUNCTION
958 ,
const I4 & i4 )
const
959 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4) ]; }
961 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
962 ,
typename I4 ,
typename I5 >
963 KOKKOS_FORCEINLINE_FUNCTION
965 ,
const I4 & i4 ,
const I5 & i5 )
const
966 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5) ]; }
968 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
969 ,
typename I4 ,
typename I5 ,
typename I6 >
970 KOKKOS_FORCEINLINE_FUNCTION
972 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 )
const
973 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ]; }
975 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
976 ,
typename I4 ,
typename I5 ,
typename I6 ,
typename I7 >
977 KOKKOS_FORCEINLINE_FUNCTION
979 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 ,
const I7 & i7 )
const
980 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ]; }
985 KOKKOS_INLINE_FUNCTION
986 static size_t memory_span(
typename Traits::array_layout
const & layout )
989 typedef std::integral_constant< unsigned , 0 > padding ;
993 const unsigned static_dim = StokhosStorageStaticDimension;
995 return handle_type::memory_span( offset.span(), static_dim );
998 const size_t sacado_size =
1000 return handle_type::memory_span( offset.span(), sacado_size );
1005 KOKKOS_DEFAULTED_FUNCTION ~ViewMapping() = default ;
1013 KOKKOS_DEFAULTED_FUNCTION ViewMapping(
const ViewMapping & ) = default ;
1014 KOKKOS_DEFAULTED_FUNCTION ViewMapping & operator = (
const ViewMapping & ) = default ;
1016 KOKKOS_DEFAULTED_FUNCTION ViewMapping( ViewMapping && ) = default ;
1017 KOKKOS_DEFAULTED_FUNCTION ViewMapping & operator = ( ViewMapping && ) = default ;
1019 template<
class ... P >
1020 KOKKOS_INLINE_FUNCTION
1022 ( ViewCtorProp< P ... >
const & prop
1023 ,
typename Traits::array_layout
const & layout
1026 , m_impl_offset( std::integral_constant< unsigned , 0 >()
1031 m_impl_handle.set( ( (ViewCtorProp<void,pointer_type>
const &) prop ).value,
1032 m_impl_offset.span(), m_sacado_size.value );
1036 KOKKOS_INLINE_FUNCTION
1038 { m_impl_handle.set( arg_ptr, m_impl_offset.span(), m_sacado_size.value ); }
1045 template<
class ... P >
1046 SharedAllocationRecord<> *
1048 ,
typename Traits::array_layout
const & layout )
1050 typedef ViewCtorProp< P... > ctor_prop ;
1053 typedef typename Traits::memory_space memory_space ;
1054 typedef typename handle_type::template ConstructDestructFunctor<execution_space> functor_type ;
1055 typedef SharedAllocationRecord< memory_space , functor_type > record_type ;
1058 typedef std::integral_constant< unsigned , 0 > padding ;
1064 const size_t alloc_size =
1065 handle_type::memory_span( m_impl_offset.span(), m_sacado_size.value );
1068 record_type *
const record =
1069 record_type::allocate( ( (ViewCtorProp<void,memory_space>
const &) prop ).value
1070 , ( (ViewCtorProp<void,std::string>
const &) prop ).value
1077 auto space = ((ViewCtorProp<void,execution_space>
const &) prop).value;
1078 m_impl_handle.set( reinterpret_cast< pointer_type >( record->data() ),
1079 m_impl_offset.span(), m_sacado_size.value );
1083 record->m_destroy = m_impl_handle.create_functor(
1085 , ctor_prop::initialize
1086 , m_impl_offset.span()
1087 , m_sacado_size.value );
1090 record->m_destroy.construct_shared_allocation();
1097 template<
class ... P >
1098 SharedAllocationRecord<> *
1100 ,
typename Traits::array_layout
const & layout
1103 return allocate_shared(prop, layout);
1136 template<
class DstTraits ,
class SrcTraits >
1137 class ViewMapping< DstTraits , SrcTraits ,
1138 typename std::enable_if<(
1139 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1140 , typename SrcTraits::memory_space >::assignable
1143 std::is_same< typename DstTraits::specialize
1144 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1147 std::is_same< typename SrcTraits::specialize
1148 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1150 , typename DstTraits::specialize
1155 enum { is_assignable =
true };
1156 enum { is_assignable_data_type =
true };
1159 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1160 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1162 KOKKOS_INLINE_FUNCTION
static
1169 std::is_same<
typename DstTraits::array_layout
1170 , Kokkos::LayoutLeft >::value ||
1171 std::is_same<
typename DstTraits::array_layout
1172 , Kokkos::LayoutRight >::value ||
1173 std::is_same<
typename DstTraits::array_layout
1174 , Kokkos::LayoutStride >::value
1178 std::is_same<
typename SrcTraits::array_layout
1179 , Kokkos::LayoutLeft >::value ||
1180 std::is_same<
typename SrcTraits::array_layout
1181 , Kokkos::LayoutRight >::value ||
1182 std::is_same<
typename SrcTraits::array_layout
1183 , Kokkos::LayoutStride >::value
1185 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1188 std::is_same<
typename DstTraits::array_layout
1189 ,
typename SrcTraits::array_layout >::value ||
1190 std::is_same<
typename DstTraits::array_layout
1191 , Kokkos::LayoutStride >::value ||
1192 (
unsigned(DstTraits::rank) == 0 &&
unsigned(SrcTraits::rank) == 0 ) ||
1193 (
unsigned(DstTraits::rank) == 1 &&
unsigned(SrcTraits::rank) == 1 ) ,
1194 "View assignment must have compatible layout" );
1200 ,
typename SrcTraits::const_value_type >::value ,
1201 "View assignment must have same value type or const = non-const" );
1204 ViewDimensionAssignable
1205 <
typename DstType::offset_type::dimension_type
1206 ,
typename SrcType::offset_type::dimension_type >::value ,
1207 "View assignment must have compatible dimensions" );
1209 dst.m_impl_handle = src.m_impl_handle ;
1210 dst.m_impl_offset = src.m_impl_offset ;
1211 dst.m_stride = src.m_stride ;
1212 dst.m_sacado_size = src.m_sacado_size ;
1221 template<
class DstTraits ,
class SrcTraits >
1222 class ViewMapping< DstTraits , SrcTraits ,
1223 typename std::enable_if<(
1224 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1225 , typename SrcTraits::memory_space >::assignable
1228 std::is_same< typename DstTraits::specialize , void >::value
1231 std::is_same< typename SrcTraits::specialize
1232 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1235 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)+1
1237 , typename DstTraits::specialize
1242 enum { is_assignable =
true };
1243 enum { is_assignable_data_type =
true };
1246 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1247 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1249 KOKKOS_INLINE_FUNCTION
static
1256 std::is_same<
typename DstTraits::array_layout
1257 , Kokkos::LayoutLeft >::value ||
1258 std::is_same<
typename DstTraits::array_layout
1259 , Kokkos::LayoutRight >::value ||
1260 std::is_same<
typename DstTraits::array_layout
1261 , Kokkos::LayoutStride >::value
1265 std::is_same<
typename SrcTraits::array_layout
1266 , Kokkos::LayoutLeft >::value ||
1267 std::is_same<
typename SrcTraits::array_layout
1268 , Kokkos::LayoutRight >::value ||
1269 std::is_same<
typename SrcTraits::array_layout
1270 , Kokkos::LayoutStride >::value
1272 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1275 std::is_same<
typename DstTraits::array_layout
1276 ,
typename SrcTraits::array_layout >::value ||
1277 std::is_same<
typename DstTraits::array_layout
1278 , Kokkos::LayoutStride >::value ,
1279 "View assignment must have compatible layout" );
1282 std::is_same<
typename DstTraits::scalar_array_type
1283 ,
typename SrcTraits::scalar_array_type >::value ||
1284 std::is_same<
typename DstTraits::scalar_array_type
1285 ,
typename SrcTraits::const_scalar_array_type >::value ,
1286 "View assignment must have same value type or const = non-const" );
1289 ViewDimensionAssignable<
1290 typename DstType::offset_type::dimension_type,
1291 typename SrcType::array_offset_type::dimension_type >::value,
1292 "View assignment must have compatible dimensions" );
1294 if ( src.m_stride != 1 ) {
1295 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > cannot assign with non-unit stride ******\n\n");
1299 dims[0] = src.m_impl_offset.dimension_0();
1300 dims[1] = src.m_impl_offset.dimension_1();
1301 dims[2] = src.m_impl_offset.dimension_2();
1302 dims[3] = src.m_impl_offset.dimension_3();
1303 dims[4] = src.m_impl_offset.dimension_4();
1304 dims[5] = src.m_impl_offset.dimension_5();
1305 dims[6] = src.m_impl_offset.dimension_6();
1306 dims[7] = src.m_impl_offset.dimension_7();
1307 unsigned rank = SrcTraits::dimension::rank;
1308 unsigned sacado_size = src.m_sacado_size.value;
1309 if (std::is_same<typename SrcTraits::array_layout, LayoutLeft>::value) {
1311 for (
unsigned i=rank; i>0; --i)
1312 dims[i] = dims[i-1];
1313 dims[0] = sacado_size;
1316 dims[rank] = sacado_size;
1318 typedef typename DstType::offset_type dst_offset_type;
1319 dst.m_impl_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1320 typename DstTraits::array_layout(
1321 dims[0] , dims[1] , dims[2] , dims[3] ,
1322 dims[4] , dims[5] , dims[6] , dims[7] ) );
1323 dst.m_impl_handle = src.m_impl_handle.scalar_ptr ;
1333 template<
class DstTraits ,
class SrcTraits >
1334 class ViewMapping< DstTraits , SrcTraits ,
1335 typename std::enable_if<(
1336 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1337 , typename SrcTraits::memory_space >::assignable
1340 std::is_same< typename DstTraits::specialize , void >::value
1343 std::is_same< typename SrcTraits::specialize
1344 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1347 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)
1349 , typename DstTraits::specialize
1354 enum { is_assignable =
true };
1355 enum { is_assignable_data_type =
true };
1358 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1359 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1361 KOKKOS_INLINE_FUNCTION
static
1368 std::is_same<
typename DstTraits::array_layout
1369 , Kokkos::LayoutLeft >::value ||
1370 std::is_same<
typename DstTraits::array_layout
1371 , Kokkos::LayoutRight >::value ||
1372 std::is_same<
typename DstTraits::array_layout
1373 , Kokkos::LayoutStride >::value
1377 std::is_same<
typename SrcTraits::array_layout
1378 , Kokkos::LayoutLeft >::value ||
1379 std::is_same<
typename SrcTraits::array_layout
1380 , Kokkos::LayoutRight >::value ||
1381 std::is_same<
typename SrcTraits::array_layout
1382 , Kokkos::LayoutStride >::value
1384 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1387 std::is_same<
typename DstTraits::array_layout
1388 ,
typename SrcTraits::array_layout >::value ||
1389 std::is_same<
typename DstTraits::array_layout
1390 , Kokkos::LayoutStride >::value ,
1391 "View assignment must have compatible layout" );
1398 "View assignment must have same value type or const = non-const" );
1401 ViewDimensionAssignable<
1402 typename DstType::offset_type::dimension_type,
1403 typename SrcType::offset_type::dimension_type >::value,
1404 "View assignment must have compatible dimensions" );
1406 if ( src.m_stride != 1 ) {
1407 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > cannot assign with non-unit stride ******\n\n");
1411 dims[0] = src.m_impl_offset.dimension_0();
1412 dims[1] = src.m_impl_offset.dimension_1();
1413 dims[2] = src.m_impl_offset.dimension_2();
1414 dims[3] = src.m_impl_offset.dimension_3();
1415 dims[4] = src.m_impl_offset.dimension_4();
1416 dims[5] = src.m_impl_offset.dimension_5();
1417 dims[6] = src.m_impl_offset.dimension_6();
1418 dims[7] = src.m_impl_offset.dimension_7();
1419 unsigned rank = SrcTraits::dimension::rank;
1420 unsigned sacado_size = src.m_sacado_size.value;
1421 if (std::is_same<typename DstTraits::array_layout, LayoutLeft>::value) {
1422 dims[0] = dims[0]*sacado_size;
1426 dims[rank-1] = dims[rank-1]*sacado_size;
1429 typedef typename DstType::offset_type dst_offset_type;
1430 dst.m_impl_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1431 typename DstTraits::array_layout(
1432 dims[0] , dims[1] , dims[2] , dims[3] ,
1433 dims[4] , dims[5] , dims[6] , dims[7] ) );
1434 dst.m_impl_handle = src.m_impl_handle.scalar_ptr ;
1448 template<
class DataType,
class ... P ,
class Arg0,
class ... Args >
1450 < typename std::enable_if<(
1452 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::specialize
1453 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1456 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1457 , Kokkos::LayoutLeft >::value ||
1458 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1459 , Kokkos::LayoutRight >::value ||
1460 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1461 , Kokkos::LayoutStride >::value
1463 && !Sacado::MP::is_vector_partition<Arg0>::value
1465 , Kokkos::ViewTraits<DataType,P...>
1476 , R0 = bool(is_integral_extent<0,Arg0,Args...>::value)
1477 , R1 = bool(is_integral_extent<1,Arg0,Args...>::value)
1478 , R2 = bool(is_integral_extent<2,Arg0,Args...>::value)
1479 , R3 = bool(is_integral_extent<3,Arg0,Args...>::value)
1480 , R4 = bool(is_integral_extent<4,Arg0,Args...>::value)
1481 , R5 = bool(is_integral_extent<5,Arg0,Args...>::value)
1482 , R6 = bool(is_integral_extent<6,Arg0,Args...>::value)
1486 enum { rank = unsigned(R0) + unsigned(R1) + unsigned(R2) + unsigned(R3)
1487 + unsigned(R4) + unsigned(R5) + unsigned(R6) };
1490 enum { R0_rev = ( 0 == SrcTraits::rank ? RZ : (
1491 1 == SrcTraits::rank ? R0 : (
1492 2 == SrcTraits::rank ? R1 : (
1493 3 == SrcTraits::rank ? R2 : (
1494 4 == SrcTraits::rank ? R3 : (
1495 5 == SrcTraits::rank ? R4 : (
1496 6 == SrcTraits::rank ? R5 : R6 ))))))) };
1499 typedef typename std::conditional<
1505 ( rank <= 2 && R0 && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutLeft >::value )
1509 ( rank <= 2 && R0_rev && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutRight >::value )
1510 ),
typename SrcTraits::array_layout , Kokkos::LayoutStride
1515 typedef typename std::conditional< rank == 0 , sacado_mp_vector_type ,
1516 typename std::conditional< rank == 1 , sacado_mp_vector_type * ,
1517 typename std::conditional< rank == 2 , sacado_mp_vector_type ** ,
1518 typename std::conditional< rank == 3 , sacado_mp_vector_type *** ,
1519 typename std::conditional< rank == 4 , sacado_mp_vector_type **** ,
1520 typename std::conditional< rank == 5 , sacado_mp_vector_type ***** ,
1521 typename std::conditional< rank == 6 , sacado_mp_vector_type ****** ,
1522 sacado_mp_vector_type *******
1528 typedef Kokkos::ViewTraits
1531 ,
typename SrcTraits::device_type
1534 typedef Kokkos::View
1537 ,
typename SrcTraits::device_type
1538 ,
typename SrcTraits::memory_traits >
type ;
1543 template<
class DstTraits >
1544 KOKKOS_INLINE_FUNCTION
1545 static void assign( ViewMapping< DstTraits , typename DstTraits::specialize > & dst
1546 , ViewMapping< SrcTraits , typename SrcTraits::specialize >
const & src
1547 , Arg0 arg0, Args ... args )
1550 ViewMapping< DstTraits , traits_type , typename DstTraits::specialize >::is_assignable ,
1551 "Subview destination type must be compatible with subview derived type" );
1553 typedef ViewMapping< DstTraits , typename DstTraits::specialize > DstType ;
1554 typedef typename DstType::offset_type dst_offset_type ;
1556 const SubviewExtents< SrcTraits::rank , rank >
1557 extents( src.m_impl_offset.m_dim , arg0 , args... );
1559 const size_t offset = src.m_impl_offset( extents.domain_offset(0)
1560 , extents.domain_offset(1)
1561 , extents.domain_offset(2)
1562 , extents.domain_offset(3)
1563 , extents.domain_offset(4)
1564 , extents.domain_offset(5)
1565 , extents.domain_offset(6)
1566 , extents.domain_offset(7) );
1568 dst.m_impl_offset = dst_offset_type( src.m_impl_offset , extents );
1569 dst.m_impl_handle.value_ptr = src.m_impl_handle.value_ptr + offset;
1570 dst.m_impl_handle.scalar_ptr =
1571 src.m_impl_handle.scalar_ptr + offset * src.m_stride * src.m_sacado_size.value;
1572 dst.m_stride = src.m_stride;
1573 dst.m_sacado_size = src.m_sacado_size;
1590 template<
class DataType,
class ...P,
unsigned Size >
1593 ViewTraits<DataType,P...> ,
1594 Sacado::MP::VectorPartition<Size> >
1598 enum { is_assignable =
true };
1599 enum { is_assignable_data_type =
true };
1602 typedef ViewMapping< src_traits , typename src_traits::specialize >
src_type ;
1614 typedef ViewMapping< dst_traits , typename dst_traits::specialize >
dst_type ;
1616 KOKKOS_INLINE_FUNCTION
static
1619 ,
const Sacado::MP::VectorPartition<Size> & part )
1623 static_assert( storage_type::is_static,
1624 "For performance reasons, partitioned assignment is only implemented for statically-sized MP::Vector types" );
1626 unsigned len = part.end - part.begin;
1627 if ( Size != len || Size == 0 ) {
1628 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > Invalid size in partitioned view assignment ******\n\n");
1631 dst.m_impl_handle.value_ptr =
1634 dst.m_impl_handle.scalar_ptr = src.m_impl_handle.scalar_ptr +
1635 (part.begin / len) * src.m_stride * src.m_sacado_size.value ;
1636 dst.m_impl_offset = src.m_impl_offset ;
1637 dst.m_stride = src.m_stride * src.m_sacado_size.value / Size ;
1638 dst.m_sacado_size = len ;
1647 template<
unsigned Size,
typename D,
typename ... P >
1648 KOKKOS_INLINE_FUNCTION
1649 typename Kokkos::Impl::ViewMapping< void,
typename Kokkos::ViewTraits<
D,P...>, Sacado::MP::VectorPartition<Size> >::type
1651 const unsigned beg )
1653 typedef Kokkos::ViewTraits<
D,P...> traits;
1654 typedef typename Kokkos::Impl::ViewMapping< void, traits, Sacado::MP::VectorPartition<Size> >::type DstViewType;
1655 const Sacado::MP::VectorPartition<Size> part( beg , beg+Size );
1656 return DstViewType(src, part);
1669 #if defined( KOKKOS_ENABLE_CUDA )
1670 template<
class OutputView >
1671 struct StokhosViewFill< OutputView ,
1672 typename std::enable_if< std::is_same< typename OutputView::specialize,
1673 Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&
1674 std::is_same< typename OutputView::execution_space,
1675 Cuda >::value >::type >
1677 typedef typename OutputView::const_value_type const_value_type ;
1679 typedef typename OutputView::size_type size_type ;
1681 template <
unsigned VectorLength>
1684 const OutputView output;
1685 const_value_type input;
1687 Kernel(
const OutputView & arg_out , const_value_type & arg_in ) :
1688 output(arg_out), input(arg_in) {}
1690 typedef typename Kokkos::TeamPolicy< execution_space >::member_type team_member ;
1692 KOKKOS_INLINE_FUNCTION
1693 void operator()(
const team_member & dev )
const
1695 const size_type tidx = dev.team_rank() % VectorLength;
1696 const size_type tidy = dev.team_rank() / VectorLength;
1697 const size_type nrow = dev.team_size() / VectorLength;
1700 const size_type i0 = dev.league_rank() * nrow + tidy;
1701 if ( i0 >= output.extent(0) )
return;
1703 for ( size_type i1 = 0 ; i1 < output.extent(1) ; ++i1 ) {
1704 for ( size_type i2 = 0 ; i2 < output.extent(2) ; ++i2 ) {
1705 for ( size_type i3 = 0 ; i3 < output.extent(3) ; ++i3 ) {
1706 for ( size_type i4 = 0 ; i4 < output.extent(4) ; ++i4 ) {
1707 for ( size_type i5 = 0 ; i5 < output.extent(5) ; ++i5 ) {
1708 for ( size_type i6 = 0 ; i6 < output.extent(6) ; ++i6 ) {
1709 for ( size_type i7 = 0 ; i7 < output.extent(7) ; ++i7 ) {
1710 for ( size_type is = tidx ; is < nvec ; is+=VectorLength ) {
1711 output.access(i0,i1,i2,i3,i4,i5,i6,i7).fastAccessCoeff(is) =
1712 input.fastAccessCoeff(is) ;
1717 StokhosViewFill(
const OutputView & output , const_value_type & input )
1720 deep_copy( output , input.fastAccessCoeff(0) );
1726 const unsigned vector_length =
1730 const size_type block_size = 256;
1732 const size_type rows_per_block = block_size / vector_length;
1733 const size_type
n = output.extent(0);
1734 const size_type league_size = ( n + rows_per_block-1 ) / rows_per_block;
1735 const size_type team_size = rows_per_block * vector_length;
1736 Kokkos::TeamPolicy< execution_space > config( league_size, team_size );
1738 parallel_for( config, Kernel<vector_length>(output, input) );
1756 struct ViewSpecializeSacadoFad;
1764 template<
class DstTraits ,
class SrcTraits >
1765 class ViewMapping< DstTraits , SrcTraits ,
1766 typename std::enable_if<(
1767 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1768 , typename SrcTraits::memory_space >::assignable
1771 std::is_same< typename DstTraits::specialize
1772 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1775 std::is_same< typename SrcTraits::specialize
1776 , ViewSpecializeSacadoFad >::value
1778 , typename DstTraits::specialize
1783 enum { is_assignable =
true };
1784 enum { is_assignable_data_type =
true };
1787 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1788 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcFadType ;
1790 template<
class DstType >
1791 KOKKOS_INLINE_FUNCTION
static
1798 std::is_same<
typename DstTraits::array_layout
1799 , Kokkos::LayoutLeft >::value ||
1800 std::is_same<
typename DstTraits::array_layout
1801 , Kokkos::LayoutRight >::value ||
1802 std::is_same<
typename DstTraits::array_layout
1803 , Kokkos::LayoutStride >::value
1807 std::is_same<
typename SrcTraits::array_layout
1808 , Kokkos::LayoutLeft >::value ||
1809 std::is_same<
typename SrcTraits::array_layout
1810 , Kokkos::LayoutRight >::value ||
1811 std::is_same<
typename SrcTraits::array_layout
1812 , Kokkos::LayoutStride >::value
1814 ,
"View of FAD requires LayoutLeft, LayoutRight, or LayoutStride" );
1817 std::is_same<
typename DstTraits::array_layout
1818 ,
typename SrcTraits::array_layout >::value ||
1819 std::is_same<
typename DstTraits::array_layout
1820 , Kokkos::LayoutStride >::value ,
1821 "View assignment must have compatible layout" );
1824 std::is_same<
typename DstTraits::data_type
1825 ,
typename SrcTraits::scalar_array_type >::value ||
1826 std::is_same<
typename DstTraits::data_type
1827 ,
typename SrcTraits::const_scalar_array_type >::value ,
1828 "View assignment must have same value type or const = non-const" );
1831 ViewDimensionAssignable
1832 <
typename DstType::offset_type::dimension_type
1833 ,
typename SrcFadType::array_offset_type::dimension_type >::value ,
1834 "View assignment must have compatible dimensions" );
1836 typedef typename DstType::offset_type dst_offset_type ;
1838 dst.m_impl_offset = dst_offset_type( src.m_array_offset );
1839 dst.m_impl_handle.assign(src.m_impl_handle) ;
1843 static_assert( DstType::is_static,
1844 "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()
KOKKOS_FUNCTION std::enable_if_t< N==View< Args...>::rank &&std::is_same< typename ViewTraits< Args...>::specialize, Kokkos::Experimental::Impl::ViewPCEContiguous >::value, View< Args...> > as_view_of_rank_n(View< Args...> v)
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
Impl::MirrorViewType< Space, T, P...>::view_type create_mirror_view_and_copy(const Space &, const Kokkos::View< T, P...> &src, std::string const &name="", typename std::enable_if< std::is_same< typename ViewTraits< T, P...>::specialize, Kokkos::Experimental::Impl::ViewPCEContiguous >::value &&Impl::MirrorViewType< Space, T, P...>::is_same_memspace >::type *=nullptr)
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)
KOKKOS_INLINE_FUNCTION void assign_data(pointer_type arg_ptr)
Assign data.
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
SharedAllocationRecord * allocate_shared(ViewCtorProp< P... > const &prop, typename Traits::array_layout const &layout, bool)
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
Stokhos::CrsMatrix< ValueType, Device, Layout >::HostMirror create_mirror_view(const Stokhos::CrsMatrix< ValueType, Device, Layout > &A)
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()