42#ifndef KOKKOS_EXPERIMENTAL_VIEW_MP_VECTOR_CONTIGUOUS_HPP
43#define KOKKOS_EXPERIMENTAL_VIEW_MP_VECTOR_CONTIGUOUS_HPP
50#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
51#define KOKKOS_IMPL_PUBLIC_INCLUDE
52#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
54#include "Kokkos_Layout.hpp"
55#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
56#undef KOKKOS_IMPL_PUBLIC_INCLUDE
57#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
66namespace Experimental {
71template<
class ... Args >
74template<
class D ,
class ... P ,
class ... Args >
77 std::is_same<
typename Kokkos::ViewTraits<D,P...>::specialize
80 ( (
sizeof...(Args) == 0 ) ||
90template <
typename T,
typename ... P>
94 std::is_same<
typename view_type::specialize,
98template <
typename T,
typename ... P>
103 return view.impl_map().dimension_scalar();
110#include "Sacado_Traits.hpp"
113#include "Kokkos_Core.hpp"
117template <
typename D,
typename ... P>
119 typename
std::enable_if< is_view_mp_vector< View<D,P...> >::value >::type > {
121 typedef typename view_type::traits::dimension
dimension;
123 typedef typename Kokkos::Impl::ViewDataType< flat_value_type , dimension >::type
flat_data_type;
127template<
class T ,
class ... P >
129typename 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,
134 typename Kokkos::View<T,P...>::HostMirror>::type
137 typedef View<T,P...> src_type ;
138 typedef typename src_type::HostMirror dst_type ;
140 typename src_type::array_layout layout = src.layout();
143 return dst_type(std::string(src.label()).append(
"_mirror"), layout);
146template<
class T ,
class ... P >
148typename std::enable_if<
149 std::is_same<
typename ViewTraits<T,P...>::specialize ,
151 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
152 Kokkos::LayoutStride >::value,
153 typename Kokkos::View<T,P...>::HostMirror>::type
156 typedef View<T,P...> src_type ;
157 typedef typename src_type::HostMirror dst_type ;
159 Kokkos::LayoutStride layout ;
161 layout.dimension[0] = src.extent(0);
162 layout.dimension[1] = src.extent(1);
163 layout.dimension[2] = src.extent(2);
164 layout.dimension[3] = src.extent(3);
165 layout.dimension[4] = src.extent(4);
166 layout.dimension[5] = src.extent(5);
167 layout.dimension[6] = src.extent(6);
168 layout.dimension[7] = src.extent(7);
170 layout.stride[0] = src.stride_0();
171 layout.stride[1] = src.stride_1();
172 layout.stride[2] = src.stride_2();
173 layout.stride[3] = src.stride_3();
174 layout.stride[4] = src.stride_4();
175 layout.stride[5] = src.stride_5();
176 layout.stride[6] = src.stride_6();
177 layout.stride[7] = src.stride_7();
181 return dst_type(std::string(src.label()).append(
"_mirror"), layout);
184template<
class Space,
class T,
class ... P,
typename Enabled>
185typename std::enable_if<
186 std::is_same<
typename ViewTraits<T,P...>::specialize ,
188 typename Impl::MirrorType<Space,T,P ...>::view_type>::type
191 typedef View<T,P...> src_type ;
192 typename src_type::array_layout layout = src.layout();
197template<
class T ,
class ... P >
199typename std::enable_if<
200 std::is_same<
typename ViewTraits<T,P...>::specialize ,
202 !std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
203 Kokkos::LayoutStride >::value,
204 typename Kokkos::View<T,P...>::HostMirror>::type
206 const Kokkos::View<T,P...> & src)
208 typedef View<T,P...> src_type ;
209 typedef typename src_type::HostMirror dst_type ;
211 typename src_type::array_layout layout = src.layout();
215 Kokkos::view_alloc(std::string(src.label()).append(
"_mirror"), wi), layout);
218template<
class T ,
class ... P >
220typename std::enable_if<
221 std::is_same<
typename ViewTraits<T,P...>::specialize ,
223 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
224 Kokkos::LayoutStride >::value,
225 typename Kokkos::View<T,P...>::HostMirror>::type
227 const Kokkos::View<T,P...> & src)
229 typedef View<T,P...> src_type ;
230 typedef typename src_type::HostMirror dst_type ;
232 Kokkos::LayoutStride layout ;
234 layout.dimension[0] = src.extent(0);
235 layout.dimension[1] = src.extent(1);
236 layout.dimension[2] = src.extent(2);
237 layout.dimension[3] = src.extent(3);
238 layout.dimension[4] = src.extent(4);
239 layout.dimension[5] = src.extent(5);
240 layout.dimension[6] = src.extent(6);
241 layout.dimension[7] = src.extent(7);
243 layout.stride[0] = src.stride_0();
244 layout.stride[1] = src.stride_1();
245 layout.stride[2] = src.stride_2();
246 layout.stride[3] = src.stride_3();
247 layout.stride[4] = src.stride_4();
248 layout.stride[5] = src.stride_5();
249 layout.stride[6] = src.stride_6();
250 layout.stride[7] = src.stride_7();
255 Kokkos::view_alloc(std::string(src.label()).append(
"_mirror"), wi), layout);
258template<
class Space,
class T,
class ... P,
typename Enable>
259typename std::enable_if<
260 std::is_same<
typename ViewTraits<T,P...>::specialize ,
262 typename Impl::MirrorType<Space,T,P ...>::view_type>::type
264 const Space&,
const Kokkos::View<T,P...> & src)
266 typedef View<T,P...> src_type ;
267 typename src_type::array_layout layout = src.layout();
270 Kokkos::view_alloc(src.label(), wi), layout);
273template <
class Space,
class T,
class... P>
274typename Impl::MirrorViewType<Space, T, P...>::view_type
276 const Space&,
const Kokkos::View<T, P...>& src,
277 std::string
const& name,
278 typename std::enable_if<
279 std::is_same<
typename ViewTraits<T, P...>::specialize,
285 "Kokkos::create_mirror_view_and_copy: fence before returning src view");
289template <
class Space,
class T,
class... P>
290typename Impl::MirrorViewType<Space, T, P...>::view_type
292 const Space&,
const Kokkos::View<T, P...>& src,
293 std::string
const& name,
294 typename std::enable_if<
295 std::is_same<
typename ViewTraits<T, P...>::specialize,
299 using src_type =
View<T,P...>;
301 std::string label = name.empty() ? src.label() : name;
302 typename src_type::array_layout layout = src.layout();
304 auto mirror =
typename Mirror::non_const_type{
305 view_alloc(WithoutInitializing, label), layout};
311template<
class DT,
class ... DP >
313 const View<DT,DP...> & view ,
314 const typename View<DT,DP...>::array_type::value_type & value
315 ,
typename std::enable_if<(
316 std::is_same<
typename ViewTraits<DT,DP...>::specialize
321 std::is_same<
typename ViewTraits<DT,DP...>::value_type ,
322 typename ViewTraits<DT,DP...>::non_const_value_type >::value
323 ,
"Can only deep copy into non-const type" );
330template<
class DT,
class ... DP >
332 const View<DT,DP...> & view ,
333 const typename View<DT,DP...>::value_type & value
334 ,
typename std::enable_if<(
335 std::is_same<
typename ViewTraits<DT,DP...>::specialize
340 std::is_same<
typename ViewTraits<DT,DP...>::value_type ,
341 typename ViewTraits<DT,DP...>::non_const_value_type >::value
342 ,
"Can only deep copy into non-const type" );
355template<
class ExecSpace ,
class DT,
class ... DP >
358 const View<DT,DP...> & view ,
359 const typename View<DT,DP...>::array_type::value_type & value
360 ,
typename std::enable_if<(
361 Kokkos::is_execution_space< ExecSpace >::value &&
362 std::is_same<
typename ViewTraits<DT,DP...>::specialize
367 std::is_same<
typename ViewTraits<DT,DP...>::value_type ,
368 typename ViewTraits<DT,DP...>::non_const_value_type >::value
369 ,
"Can only deep copy into non-const type" );
376template<
class ExecSpace ,
class DT,
class ... DP >
379 const View<DT,DP...> & view ,
380 const typename View<DT,DP...>::value_type & value
381 ,
typename std::enable_if<(
382 Kokkos::is_execution_space< ExecSpace >::value &&
383 std::is_same<
typename ViewTraits<DT,DP...>::specialize
388 std::is_same<
typename ViewTraits<DT,DP...>::value_type ,
389 typename ViewTraits<DT,DP...>::non_const_value_type >::value
390 ,
"Can only deep copy into non-const type" );
403template<
class ExecSpace,
class DT ,
class ... DP ,
class ST ,
class ... SP >
406 const View<DT,DP...> & dst ,
407 const View<ST,SP...> & src
408 ,
typename std::enable_if<(
409 std::is_same<
typename ViewTraits<DT,DP...>::specialize
412 std::is_same<
typename ViewTraits<ST,SP...>::specialize
417 std::is_same<
typename ViewTraits<DT,DP...>::value_type ,
418 typename ViewTraits<DT,DP...>::non_const_value_type >::value
419 ,
"Deep copy destination must be non-const" );
422 ( unsigned(ViewTraits<DT,DP...>::rank) ==
423 unsigned(ViewTraits<ST,SP...>::rank) )
424 ,
"Deep copy destination and source must have same rank" );
444template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
447 const View<ST,SP...> & src
448 ,
typename std::enable_if<(
449 std::is_same<
typename ViewTraits<DT,DP...>::specialize
452 std::is_same<
typename ViewTraits<ST,SP...>::specialize
464template <
unsigned N,
typename... Args>
465KOKKOS_FUNCTION std::enable_if_t<
466 N ==
View<Args...>::Rank &&
467 std::is_same<
typename ViewTraits<Args...>::specialize,
476template <
unsigned N,
typename T,
typename... Args>
478 N !=
View<T, Args...>::Rank &&
479 std::is_same<
typename ViewTraits<T, Args...>::specialize,
481 View<
typename RankDataType<
typename View<T, Args...>::value_type, N>::type,
484 Kokkos::Impl::throw_runtime_exception(
485 "Trying to get at a View of the wrong rank");
496template<
class DataType ,
class ArrayLayout ,
typename StorageType >
497struct ViewDataAnalysis< DataType
499 ,
Sacado::MP::Vector< StorageType > >
505 static const int DimVector = StorageType::static_size;
519 ViewDataType< value_type , dimension >::type
type ;
521 ViewDataType< const_value_type , dimension >::type
const_type ;
528 enum { is_const = std::is_same< value_type , const_value_type >::value };
532 std::conditional< is_const , const ScalarType , ScalarType >::type
540 typedef typename array_analysis::dimension::
541 template prepend<0>::type
543 typedef typename array_analysis::dimension::
544 template append<DimVector>::type
546 typedef typename std::conditional<
547 std::is_same< ArrayLayout, Kokkos::LayoutLeft>::value,
558 ViewDataType< const_scalar_type , scalar_dimension >::type
562 ViewDataType< non_const_scalar_type , scalar_dimension >::type
572namespace Experimental {
575 template <
class ValueType,
576 bool is_static = Sacado::IsStaticallySized<ValueType>::value >
582template <
class ValueType>
590 KOKKOS_INLINE_FUNCTION
591 static constexpr size_t
596 KOKKOS_INLINE_FUNCTION
599 template <
typename T>
600 KOKKOS_INLINE_FUNCTION
602 value_ptr = a.value_ptr;
603 scalar_ptr = a.scalar_ptr;
607 KOKKOS_INLINE_FUNCTION
613 template <
class ExecSpace>
614 struct ConstructDestructFunctor {
615 typedef Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type >
FunctorType ;
621 ConstructDestructFunctor&
operator=(
const ConstructDestructFunctor&) =
default;
624 const bool initialize,
626 const unsigned vector_size,
628 m_functor( space , scalar_ptr , span*vector_size ,
"Stokhos_MP_VectorContig_ConstructDestructFunctor1" ),
629 m_initialize(initialize) {}
633 m_functor.construct_shared_allocation();
638 m_functor.destroy_shared_allocation();
643 template <
class ExecSpace>
644 inline ConstructDestructFunctor<ExecSpace>
646 const bool initialize,
648 const unsigned vector_size)
const {
649 return ConstructDestructFunctor<ExecSpace>(space, initialize, span, vector_size, scalar_ptr);
653 template <
typename T>
654 KOKKOS_INLINE_FUNCTION
656 value_ptr =
reinterpret_cast<value_type*
>(ptr);
667template <
class ValueType>
675 KOKKOS_INLINE_FUNCTION
676 static constexpr size_t
681 KOKKOS_INLINE_FUNCTION
684 template <
typename T>
685 KOKKOS_INLINE_FUNCTION
687 value_ptr = a.value_ptr;
688 scalar_ptr = a.scalar_ptr;
695 KOKKOS_INLINE_FUNCTION
698 scalar_ptr =
reinterpret_cast<scalar_type*
>(ptr+span);
701 template <
class ExecSpace>
702 struct VectorConstruct {
711 VectorConstruct&
operator=(
const VectorConstruct&) =
default;
718 const unsigned vector_size) :
719 m_space(space), m_p(p), m_sp(sp), m_span(span), m_vector_size(vector_size) {}
722 if ( ! m_space.in_parallel() ) {
723 typedef Kokkos::RangePolicy< ExecSpace > PolicyType ;
724 const Kokkos::Impl::ParallelFor< VectorConstruct , PolicyType >
725 closure( *
this , PolicyType( 0 , m_span ) );
730 for (
size_t i = 0 ; i < m_span ; ++i )
operator()(i);
734 KOKKOS_INLINE_FUNCTION
735 void operator() (
const size_t i)
const {
736 new (m_p+i)
value_type(m_vector_size, m_sp+i*m_vector_size,
false);
740 template <
class ExecSpace>
741 struct ConstructDestructFunctor {
750 ConstructDestructFunctor&
operator=(
const ConstructDestructFunctor&) =
default;
753 const bool initialize,
755 const unsigned vector_size,
758 m_scalar_functor( space , scalar_ptr , span*vector_size ,
"Stokhos_MP_VectorContig_ConstructDestructFunctor2" ),
759 m_vector_functor( space , value_ptr , scalar_ptr , span , vector_size ),
760 m_initialize(initialize) {}
765 m_scalar_functor.construct_shared_allocation();
777 m_vector_functor.execute();
784 m_scalar_functor.destroy_shared_allocation();
789 template <
class ExecSpace>
790 inline ConstructDestructFunctor<ExecSpace>
792 const bool initialize,
794 const unsigned vector_size)
const {
795 return ConstructDestructFunctor<ExecSpace>(space, initialize, span, vector_size, scalar_ptr, value_ptr);
800 template <
typename T>
801 KOKKOS_INLINE_FUNCTION
803 value_ptr =
reinterpret_cast<value_type*
>(ptr);
805 scalar_ptr = value_ptr->coeff();
816template<
class Traits >
817class ViewMapping< Traits ,
818 typename
std::enable_if<
819 ( std::is_same< typename Traits::specialize
820 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
822 ( std::is_same< typename Traits::array_layout
823 , Kokkos::LayoutLeft >::value
825 std::is_same< typename Traits::array_layout
826 , Kokkos::LayoutRight >::value
828 std::is_same< typename Traits::array_layout
829 , Kokkos::LayoutStride >::value
832 , typename Traits::specialize
837 template< class ,
class ... >
friend class ViewMapping ;
838 template< class ,
class ... >
friend class Kokkos::View ;
846 enum { StokhosStorageStaticDimension = stokhos_storage_type::static_size };
847 typedef Sacado::integral_nonzero< unsigned , StokhosStorageStaticDimension >
sacado_size_type;
851 typedef ViewOffset<
typename Traits::dimension
852 ,
typename Traits::array_layout
860 typedef ViewOffset<
typename array_dimension::
861 template append<StokhosStorageStaticDimension>::type,
862 typename Traits::array_layout,
865 typedef ViewOffset<
typename array_dimension::
866 template prepend<0>::type,
867 typename Traits::array_layout,
870 typedef typename std::conditional<
871 std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft>::value,
905 enum { Rank = Traits::dimension::rank };
908 enum { Sacado_Rank = std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft >::value ? 0 : Rank+1 };
911 template<
typename iType >
912 KOKKOS_INLINE_FUNCTION
constexpr size_t extent(
const iType & r )
const
913 {
return m_impl_offset.m_dim.extent(r); }
915 KOKKOS_INLINE_FUNCTION
constexpr
916 typename Traits::array_layout
layout()
const
917 {
return m_impl_offset.layout(); }
920 {
return m_impl_offset.dimension_0(); }
922 {
return m_impl_offset.dimension_1(); }
924 {
return m_impl_offset.dimension_2(); }
926 {
return m_impl_offset.dimension_3(); }
928 {
return m_impl_offset.dimension_4(); }
930 {
return m_impl_offset.dimension_5(); }
932 {
return m_impl_offset.dimension_6(); }
934 {
return m_impl_offset.dimension_7(); }
942 KOKKOS_INLINE_FUNCTION
constexpr size_t stride_0()
const
943 {
return m_impl_offset.stride_0(); }
944 KOKKOS_INLINE_FUNCTION
constexpr size_t stride_1()
const
945 {
return m_impl_offset.stride_1(); }
946 KOKKOS_INLINE_FUNCTION
constexpr size_t stride_2()
const
947 {
return m_impl_offset.stride_2(); }
948 KOKKOS_INLINE_FUNCTION
constexpr size_t stride_3()
const
949 {
return m_impl_offset.stride_3(); }
950 KOKKOS_INLINE_FUNCTION
constexpr size_t stride_4()
const
951 {
return m_impl_offset.stride_4(); }
952 KOKKOS_INLINE_FUNCTION
constexpr size_t stride_5()
const
953 {
return m_impl_offset.stride_5(); }
954 KOKKOS_INLINE_FUNCTION
constexpr size_t stride_6()
const
955 {
return m_impl_offset.stride_6(); }
956 KOKKOS_INLINE_FUNCTION
constexpr size_t stride_7()
const
957 {
return m_impl_offset.stride_7(); }
959 template<
typename iType >
960 KOKKOS_INLINE_FUNCTION
void stride( iType *
const s )
const
961 { m_impl_offset.stride(s); }
965 {
return m_sacado_size.value; }
968 static const bool is_static = stokhos_storage_type::is_static ;
971 static const bool is_contiguous =
true;
983 KOKKOS_INLINE_FUNCTION
constexpr size_t span()
const
984 {
return m_impl_offset.span(); }
988 {
return m_impl_offset.span_is_contiguous() && (m_stride == 1); }
992 {
return m_impl_handle.value_ptr ; }
996 KOKKOS_FORCEINLINE_FUNCTION
998 {
return *m_impl_handle.value_ptr; }
1001 template<
typename I0 >
1002 KOKKOS_FORCEINLINE_FUNCTION
1004 std::enable_if< std::is_integral<I0>::value &&
1005 ! std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
1006 , reference_type >::type
1008 {
return m_impl_handle.value_ptr[m_stride * i0]; }
1011 template<
typename I0 >
1012 KOKKOS_FORCEINLINE_FUNCTION
1014 std::enable_if< std::is_integral<I0>::value &&
1015 std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
1016 , reference_type >::type
1018 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0) ]; }
1020 template<
typename I0 ,
typename I1 >
1021 KOKKOS_FORCEINLINE_FUNCTION
1023 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1) ]; }
1025 template<
typename I0 ,
typename I1 ,
typename I2 >
1026 KOKKOS_FORCEINLINE_FUNCTION
1028 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2) ]; }
1030 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3 >
1031 KOKKOS_FORCEINLINE_FUNCTION
1033 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3) ]; }
1035 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1037 KOKKOS_FORCEINLINE_FUNCTION
1039 ,
const I4 & i4 )
const
1040 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4) ]; }
1042 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1043 ,
typename I4 ,
typename I5 >
1044 KOKKOS_FORCEINLINE_FUNCTION
1046 ,
const I4 & i4 ,
const I5 & i5 )
const
1047 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5) ]; }
1049 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1050 ,
typename I4 ,
typename I5 ,
typename I6 >
1051 KOKKOS_FORCEINLINE_FUNCTION
1053 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 )
const
1054 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ]; }
1056 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1057 ,
typename I4 ,
typename I5 ,
typename I6 ,
typename I7 >
1058 KOKKOS_FORCEINLINE_FUNCTION
1060 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 ,
const I7 & i7 )
const
1061 {
return m_impl_handle.value_ptr[ m_stride * m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ]; }
1066 KOKKOS_INLINE_FUNCTION
1067 static size_t memory_span(
typename Traits::array_layout
const & layout )
1070 typedef std::integral_constant< unsigned , 0 > padding ;
1074 const unsigned static_dim = StokhosStorageStaticDimension;
1076 return handle_type::memory_span( offset.span(), static_dim );
1079 const size_t sacado_size =
1081 return handle_type::memory_span( offset.span(), sacado_size );
1094 KOKKOS_DEFAULTED_FUNCTION
ViewMapping(
const ViewMapping & ) = default ;
1095 KOKKOS_DEFAULTED_FUNCTION ViewMapping & operator = (
const ViewMapping & ) = default ;
1098 KOKKOS_DEFAULTED_FUNCTION ViewMapping & operator = ( ViewMapping && ) = default ;
1100 template<
class ... P >
1101 KOKKOS_INLINE_FUNCTION
1103 ( ViewCtorProp< P ... >
const & prop
1104 ,
typename Traits::array_layout
const & layout
1107 , m_impl_offset(
std::integral_constant< unsigned , 0 >()
1112 m_impl_handle.set( ( (ViewCtorProp<void,pointer_type>
const &) prop ).value,
1113 m_impl_offset.span(), m_sacado_size.value );
1117 KOKKOS_INLINE_FUNCTION
1119 { m_impl_handle.set( arg_ptr, m_impl_offset.span(), m_sacado_size.value ); }
1126 template<
class ... P >
1127 SharedAllocationRecord<> *
1129 ,
typename Traits::array_layout
const & layout )
1131 typedef ViewCtorProp< P... > ctor_prop ;
1134 typedef typename Traits::memory_space memory_space ;
1135 typedef typename handle_type::template ConstructDestructFunctor<execution_space> functor_type ;
1136 typedef SharedAllocationRecord< memory_space , functor_type > record_type ;
1139 typedef std::integral_constant< unsigned , 0 > padding ;
1145 const size_t alloc_size =
1146 handle_type::memory_span( m_impl_offset.span(), m_sacado_size.value );
1149 record_type *
const record =
1150 record_type::allocate( ( (ViewCtorProp<void,memory_space>
const &) prop ).value
1151 , ( (ViewCtorProp<void,std::string>
const &) prop ).value
1158 m_impl_handle.set(
reinterpret_cast< pointer_type >( record->data() ),
1159 m_impl_offset.span(), m_sacado_size.value );
1163 record->m_destroy = m_impl_handle.create_functor(
1164 ( (ViewCtorProp<void,execution_space>
const &) prop).value
1165 , ctor_prop::initialize
1166 , m_impl_offset.span()
1167 , m_sacado_size.value );
1170 record->m_destroy.construct_shared_allocation();
1176 template<
class ... P >
1177 SharedAllocationRecord<> *
1179 ,
typename Traits::array_layout
const & layout
1182 return allocate_shared(prop, layout);
1215template<
class DstTraits ,
class SrcTraits >
1216class ViewMapping< DstTraits , SrcTraits ,
1217 typename
std::enable_if<(
1218 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1219 , typename SrcTraits::memory_space >::assignable
1222 std::is_same< typename DstTraits::specialize
1223 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1226 std::is_same< typename SrcTraits::specialize
1227 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1229 , typename DstTraits::specialize
1234 enum { is_assignable =
true };
1235 enum { is_assignable_data_type =
true };
1238 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1239 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1241 KOKKOS_INLINE_FUNCTION
static
1248 std::is_same<
typename DstTraits::array_layout
1249 , Kokkos::LayoutLeft >::value ||
1250 std::is_same<
typename DstTraits::array_layout
1251 , Kokkos::LayoutRight >::value ||
1252 std::is_same<
typename DstTraits::array_layout
1253 , Kokkos::LayoutStride >::value
1257 std::is_same<
typename SrcTraits::array_layout
1258 , Kokkos::LayoutLeft >::value ||
1259 std::is_same<
typename SrcTraits::array_layout
1260 , Kokkos::LayoutRight >::value ||
1261 std::is_same<
typename SrcTraits::array_layout
1262 , Kokkos::LayoutStride >::value
1264 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1267 std::is_same<
typename DstTraits::array_layout
1268 ,
typename SrcTraits::array_layout >::value ||
1269 std::is_same<
typename DstTraits::array_layout
1270 , Kokkos::LayoutStride >::value ||
1271 ( unsigned(DstTraits::rank) == 0 && unsigned(SrcTraits::rank) == 0 ) ||
1272 (
unsigned(DstTraits::rank) == 1 && unsigned(SrcTraits::rank) == 1 ) ,
1273 "View assignment must have compatible layout" );
1276 std::is_same<
typename DstTraits::value_type
1277 ,
typename SrcTraits::value_type >::value ||
1278 std::is_same<
typename DstTraits::value_type
1279 ,
typename SrcTraits::const_value_type >::value ,
1280 "View assignment must have same value type or const = non-const" );
1283 ViewDimensionAssignable
1284 <
typename DstType::offset_type::dimension_type
1285 ,
typename SrcType::offset_type::dimension_type >::value ,
1286 "View assignment must have compatible dimensions" );
1288 dst.m_impl_handle = src.m_impl_handle ;
1289 dst.m_impl_offset = src.m_impl_offset ;
1290 dst.m_stride = src.m_stride ;
1291 dst.m_sacado_size = src.m_sacado_size ;
1300template<
class DstTraits ,
class SrcTraits >
1301class ViewMapping< DstTraits , SrcTraits ,
1302 typename
std::enable_if<(
1303 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1304 , typename SrcTraits::memory_space >::assignable
1307 std::is_same< typename DstTraits::specialize , void >::value
1310 std::is_same< typename SrcTraits::specialize
1311 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1314 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)+1
1316 , typename DstTraits::specialize
1321 enum { is_assignable =
true };
1322 enum { is_assignable_data_type =
true };
1325 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1326 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1328 KOKKOS_INLINE_FUNCTION
static
1335 std::is_same<
typename DstTraits::array_layout
1336 , Kokkos::LayoutLeft >::value ||
1337 std::is_same<
typename DstTraits::array_layout
1338 , Kokkos::LayoutRight >::value ||
1339 std::is_same<
typename DstTraits::array_layout
1340 , Kokkos::LayoutStride >::value
1344 std::is_same<
typename SrcTraits::array_layout
1345 , Kokkos::LayoutLeft >::value ||
1346 std::is_same<
typename SrcTraits::array_layout
1347 , Kokkos::LayoutRight >::value ||
1348 std::is_same<
typename SrcTraits::array_layout
1349 , Kokkos::LayoutStride >::value
1351 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1354 std::is_same<
typename DstTraits::array_layout
1355 ,
typename SrcTraits::array_layout >::value ||
1356 std::is_same<
typename DstTraits::array_layout
1357 , Kokkos::LayoutStride >::value ,
1358 "View assignment must have compatible layout" );
1361 std::is_same<
typename DstTraits::scalar_array_type
1362 ,
typename SrcTraits::scalar_array_type >::value ||
1363 std::is_same<
typename DstTraits::scalar_array_type
1364 ,
typename SrcTraits::const_scalar_array_type >::value ,
1365 "View assignment must have same value type or const = non-const" );
1368 ViewDimensionAssignable<
1369 typename DstType::offset_type::dimension_type,
1370 typename SrcType::array_offset_type::dimension_type >::value,
1371 "View assignment must have compatible dimensions" );
1373 if ( src.m_stride != 1 ) {
1374 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > cannot assign with non-unit stride ******\n\n");
1378 dims[0] = src.m_impl_offset.dimension_0();
1379 dims[1] = src.m_impl_offset.dimension_1();
1380 dims[2] = src.m_impl_offset.dimension_2();
1381 dims[3] = src.m_impl_offset.dimension_3();
1382 dims[4] = src.m_impl_offset.dimension_4();
1383 dims[5] = src.m_impl_offset.dimension_5();
1384 dims[6] = src.m_impl_offset.dimension_6();
1385 dims[7] = src.m_impl_offset.dimension_7();
1386 unsigned rank = SrcTraits::dimension::rank;
1387 unsigned sacado_size = src.m_sacado_size.value;
1388 if (std::is_same<typename SrcTraits::array_layout, LayoutLeft>::value) {
1390 for (
unsigned i=rank; i>0; --i)
1391 dims[i] = dims[i-1];
1392 dims[0] = sacado_size;
1395 dims[rank] = sacado_size;
1397 typedef typename DstType::offset_type dst_offset_type;
1398 dst.m_impl_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1399 typename DstTraits::array_layout(
1400 dims[0] , dims[1] , dims[2] , dims[3] ,
1401 dims[4] , dims[5] , dims[6] , dims[7] ) );
1402 dst.m_impl_handle = src.m_impl_handle.scalar_ptr ;
1412template<
class DstTraits ,
class SrcTraits >
1413class ViewMapping< DstTraits , SrcTraits ,
1414 typename
std::enable_if<(
1415 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1416 , typename SrcTraits::memory_space >::assignable
1419 std::is_same< typename DstTraits::specialize , void >::value
1422 std::is_same< typename SrcTraits::specialize
1423 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1426 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)
1428 , typename DstTraits::specialize
1433 enum { is_assignable =
true };
1434 enum { is_assignable_data_type =
true };
1437 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1438 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1440 KOKKOS_INLINE_FUNCTION
static
1447 std::is_same<
typename DstTraits::array_layout
1448 , Kokkos::LayoutLeft >::value ||
1449 std::is_same<
typename DstTraits::array_layout
1450 , Kokkos::LayoutRight >::value ||
1451 std::is_same<
typename DstTraits::array_layout
1452 , Kokkos::LayoutStride >::value
1456 std::is_same<
typename SrcTraits::array_layout
1457 , Kokkos::LayoutLeft >::value ||
1458 std::is_same<
typename SrcTraits::array_layout
1459 , Kokkos::LayoutRight >::value ||
1460 std::is_same<
typename SrcTraits::array_layout
1461 , Kokkos::LayoutStride >::value
1463 ,
"View of MP::Vector requires LayoutLeft, LayoutRight, or LayoutStride" );
1466 std::is_same<
typename DstTraits::array_layout
1467 ,
typename SrcTraits::array_layout >::value ||
1468 std::is_same<
typename DstTraits::array_layout
1469 , Kokkos::LayoutStride >::value ,
1470 "View assignment must have compatible layout" );
1473 std::is_same<
typename DstTraits::value_type
1474 ,
typename SrcTraits::non_const_value_type::value_type >::value ||
1475 std::is_same<
typename DstTraits::value_type
1476 ,
const typename SrcTraits::non_const_value_type::value_type >::value ,
1477 "View assignment must have same value type or const = non-const" );
1480 ViewDimensionAssignable<
1481 typename DstType::offset_type::dimension_type,
1482 typename SrcType::offset_type::dimension_type >::value,
1483 "View assignment must have compatible dimensions" );
1485 if ( src.m_stride != 1 ) {
1486 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > cannot assign with non-unit stride ******\n\n");
1490 dims[0] = src.m_impl_offset.dimension_0();
1491 dims[1] = src.m_impl_offset.dimension_1();
1492 dims[2] = src.m_impl_offset.dimension_2();
1493 dims[3] = src.m_impl_offset.dimension_3();
1494 dims[4] = src.m_impl_offset.dimension_4();
1495 dims[5] = src.m_impl_offset.dimension_5();
1496 dims[6] = src.m_impl_offset.dimension_6();
1497 dims[7] = src.m_impl_offset.dimension_7();
1498 unsigned rank = SrcTraits::dimension::rank;
1499 unsigned sacado_size = src.m_sacado_size.value;
1500 if (std::is_same<typename DstTraits::array_layout, LayoutLeft>::value) {
1501 dims[0] = dims[0]*sacado_size;
1505 dims[rank-1] = dims[rank-1]*sacado_size;
1508 typedef typename DstType::offset_type dst_offset_type;
1509 dst.m_impl_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1510 typename DstTraits::array_layout(
1511 dims[0] , dims[1] , dims[2] , dims[3] ,
1512 dims[4] , dims[5] , dims[6] , dims[7] ) );
1513 dst.m_impl_handle = src.m_impl_handle.scalar_ptr ;
1527template<
class DataType,
class ... P ,
class Arg0,
class ... Args >
1529 < typename
std::enable_if<(
1531 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::specialize
1532 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1535 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1536 , Kokkos::LayoutLeft >::value ||
1537 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1538 , Kokkos::LayoutRight >::value ||
1539 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1540 , Kokkos::LayoutStride >::value
1542 && !Sacado::MP::is_vector_partition<Arg0>::value
1544 , Kokkos::ViewTraits<DataType,P...>
1555 , R0 = bool(is_integral_extent<0,Arg0,Args...>::value)
1556 , R1 = bool(is_integral_extent<1,Arg0,Args...>::value)
1557 , R2 = bool(is_integral_extent<2,Arg0,Args...>::value)
1558 , R3 = bool(is_integral_extent<3,Arg0,Args...>::value)
1559 , R4 = bool(is_integral_extent<4,Arg0,Args...>::value)
1560 , R5 = bool(is_integral_extent<5,Arg0,Args...>::value)
1561 , R6 = bool(is_integral_extent<6,Arg0,Args...>::value)
1565 enum { rank = unsigned(R0) + unsigned(R1) + unsigned(R2) + unsigned(R3)
1566 + unsigned(R4) + unsigned(R5) + unsigned(R6) };
1569 enum { R0_rev = ( 0 == SrcTraits::rank ? RZ : (
1570 1 == SrcTraits::rank ? R0 : (
1571 2 == SrcTraits::rank ? R1 : (
1572 3 == SrcTraits::rank ? R2 : (
1573 4 == SrcTraits::rank ? R3 : (
1574 5 == SrcTraits::rank ? R4 : (
1575 6 == SrcTraits::rank ? R5 : R6 ))))))) };
1578 typedef typename std::conditional<
1584 ( rank <= 2 && R0 && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutLeft >::value )
1588 ( rank <= 2 && R0_rev && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutRight >::value )
1589 ),
typename SrcTraits::array_layout , Kokkos::LayoutStride
1602 >::type >::type >::type >::type >::type >::type >::type
1607 typedef Kokkos::ViewTraits
1610 ,
typename SrcTraits::device_type
1613 typedef Kokkos::View
1616 ,
typename SrcTraits::device_type
1617 ,
typename SrcTraits::memory_traits >
type ;
1622 template<
class DstTraits >
1623 KOKKOS_INLINE_FUNCTION
1624 static void assign( ViewMapping< DstTraits , typename DstTraits::specialize > & dst
1625 , ViewMapping< SrcTraits , typename SrcTraits::specialize >
const & src
1626 , Arg0 arg0, Args ... args )
1629 ViewMapping< DstTraits , traits_type , typename DstTraits::specialize >::is_assignable ,
1630 "Subview destination type must be compatible with subview derived type" );
1632 typedef ViewMapping< DstTraits , typename DstTraits::specialize > DstType ;
1633 typedef typename DstType::offset_type dst_offset_type ;
1635 const SubviewExtents< SrcTraits::rank , rank >
1636 extents( src.m_impl_offset.m_dim , arg0 , args... );
1638 const size_t offset = src.m_impl_offset( extents.domain_offset(0)
1639 , extents.domain_offset(1)
1640 , extents.domain_offset(2)
1641 , extents.domain_offset(3)
1642 , extents.domain_offset(4)
1643 , extents.domain_offset(5)
1644 , extents.domain_offset(6)
1645 , extents.domain_offset(7) );
1647 dst.m_impl_offset = dst_offset_type( src.m_impl_offset , extents );
1648 dst.m_impl_handle.value_ptr = src.m_impl_handle.value_ptr + offset;
1649 dst.m_impl_handle.scalar_ptr =
1650 src.m_impl_handle.scalar_ptr + offset * src.m_stride * src.m_sacado_size.value;
1651 dst.m_stride = src.m_stride;
1652 dst.m_sacado_size = src.m_sacado_size;
1669template<
class DataType,
class ...P,
unsigned Size >
1672 ViewTraits<DataType,P...> ,
1673 Sacado::MP::VectorPartition<Size> >
1677 enum { is_assignable =
true };
1678 enum { is_assignable_data_type =
true };
1681 typedef ViewMapping< src_traits , typename src_traits::specialize >
src_type ;
1693 typedef ViewMapping< dst_traits , typename dst_traits::specialize >
dst_type ;
1695 KOKKOS_INLINE_FUNCTION
static
1698 ,
const Sacado::MP::VectorPartition<Size> & part )
1702 static_assert( storage_type::is_static,
1703 "For performance reasons, partitioned assignment is only implemented for statically-sized MP::Vector types" );
1705 unsigned len = part.end - part.begin;
1706 if ( Size != len || Size == 0 ) {
1707 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::MP::Vector ... > Invalid size in partitioned view assignment ******\n\n");
1710 dst.m_impl_handle.value_ptr =
1713 dst.m_impl_handle.scalar_ptr = src.m_impl_handle.scalar_ptr +
1714 (part.begin / len) * src.m_stride * src.m_sacado_size.value ;
1715 dst.m_impl_offset = src.m_impl_offset ;
1716 dst.m_stride = src.m_stride * src.m_sacado_size.value / Size ;
1717 dst.m_sacado_size = len ;
1726template<
unsigned Size,
typename D,
typename ... P >
1727KOKKOS_INLINE_FUNCTION
1728typename Kokkos::Impl::ViewMapping< void,
typename Kokkos::ViewTraits<D,P...>, Sacado::MP::VectorPartition<Size> >::type
1730 const unsigned beg )
1732 typedef Kokkos::ViewTraits<D,P...> traits;
1733 typedef typename Kokkos::Impl::ViewMapping< void, traits, Sacado::MP::VectorPartition<Size> >::type DstViewType;
1734 const Sacado::MP::VectorPartition<Size> part( beg , beg+Size );
1735 return DstViewType(src, part);
1748#if defined( KOKKOS_ENABLE_CUDA )
1749template<
class OutputView >
1750struct StokhosViewFill< OutputView ,
1751 typename
std::enable_if< std::is_same< typename OutputView::specialize,
1752 Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value &&
1753 std::is_same< typename OutputView::execution_space,
1754 Cuda >::value >::type >
1758 typedef typename OutputView::size_type size_type ;
1760 template <
unsigned VectorLength>
1763 const OutputView output;
1764 const_value_type input;
1766 Kernel(
const OutputView & arg_out , const_value_type & arg_in ) :
1767 output(arg_out), input(arg_in) {}
1769 typedef typename Kokkos::TeamPolicy< execution_space >::member_type team_member ;
1771 KOKKOS_INLINE_FUNCTION
1772 void operator()(
const team_member & dev )
const
1774 const size_type tidx = dev.team_rank() % VectorLength;
1775 const size_type tidy = dev.team_rank() / VectorLength;
1776 const size_type nrow = dev.team_size() / VectorLength;
1779 const size_type i0 = dev.league_rank() * nrow + tidy;
1780 if ( i0 >= output.extent(0) )
return;
1782 for ( size_type i1 = 0 ; i1 < output.extent(1) ; ++i1 ) {
1783 for ( size_type i2 = 0 ; i2 < output.extent(2) ; ++i2 ) {
1784 for ( size_type i3 = 0 ; i3 < output.extent(3) ; ++i3 ) {
1785 for ( size_type i4 = 0 ; i4 < output.extent(4) ; ++i4 ) {
1786 for ( size_type i5 = 0 ; i5 < output.extent(5) ; ++i5 ) {
1787 for ( size_type i6 = 0 ; i6 < output.extent(6) ; ++i6 ) {
1788 for ( size_type i7 = 0 ; i7 < output.extent(7) ; ++i7 ) {
1789 for ( size_type is = tidx ; is < nvec ; is+=VectorLength ) {
1790 output.access(i0,i1,i2,i3,i4,i5,i6,i7).fastAccessCoeff(is) =
1791 input.fastAccessCoeff(is) ;
1804 typedef typename OutputView::array_type::value_type
scalar_type;
1805 const unsigned vector_length =
1809 const size_type block_size = 256;
1811 const size_type rows_per_block = block_size / vector_length;
1812 const size_type n =
output.extent(0);
1813 const size_type league_size = ( n + rows_per_block-1 ) / rows_per_block;
1814 const size_type team_size = rows_per_block * vector_length;
1815 Kokkos::TeamPolicy< execution_space > config( league_size, team_size );
1817 parallel_for( config, Kernel<vector_length>(
output,
input) );
1835struct ViewSpecializeSacadoFad;
1843template<
class DstTraits ,
class SrcTraits >
1844class ViewMapping< DstTraits , SrcTraits ,
1845 typename
std::enable_if<(
1846 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1847 , typename SrcTraits::memory_space >::assignable
1850 std::is_same< typename DstTraits::specialize
1851 , Kokkos::Experimental::Impl::ViewMPVectorContiguous >::value
1854 std::is_same< typename SrcTraits::specialize
1855 , ViewSpecializeSacadoFad >::value
1857 , typename DstTraits::specialize
1862 enum { is_assignable =
true };
1863 enum { is_assignable_data_type =
true };
1866 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1867 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcFadType ;
1869 template<
class DstType >
1870 KOKKOS_INLINE_FUNCTION
static
1877 std::is_same<
typename DstTraits::array_layout
1878 , Kokkos::LayoutLeft >::value ||
1879 std::is_same<
typename DstTraits::array_layout
1880 , Kokkos::LayoutRight >::value ||
1881 std::is_same<
typename DstTraits::array_layout
1882 , Kokkos::LayoutStride >::value
1886 std::is_same<
typename SrcTraits::array_layout
1887 , Kokkos::LayoutLeft >::value ||
1888 std::is_same<
typename SrcTraits::array_layout
1889 , Kokkos::LayoutRight >::value ||
1890 std::is_same<
typename SrcTraits::array_layout
1891 , Kokkos::LayoutStride >::value
1893 ,
"View of FAD requires LayoutLeft, LayoutRight, or LayoutStride" );
1896 std::is_same<
typename DstTraits::array_layout
1897 ,
typename SrcTraits::array_layout >::value ||
1898 std::is_same<
typename DstTraits::array_layout
1899 , Kokkos::LayoutStride >::value ,
1900 "View assignment must have compatible layout" );
1903 std::is_same<
typename DstTraits::data_type
1904 ,
typename SrcTraits::scalar_array_type >::value ||
1905 std::is_same<
typename DstTraits::data_type
1906 ,
typename SrcTraits::const_scalar_array_type >::value ,
1907 "View assignment must have same value type or const = non-const" );
1910 ViewDimensionAssignable
1911 <
typename DstType::offset_type::dimension_type
1912 ,
typename SrcFadType::array_offset_type::dimension_type >::value ,
1913 "View assignment must have compatible dimensions" );
1915 typedef typename DstType::offset_type dst_offset_type ;
1917 dst.m_impl_offset = dst_offset_type( src.m_array_offset );
1918 dst.m_impl_handle.assign(src.m_impl_handle) ;
1922 static_assert( DstType::is_static,
1923 "Destination view must be statically allocated" );
Kokkos::DefaultExecutionSpace execution_space
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
Kokkos::Impl::SharedAllocationTracker TrackType
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
Kokkos::Impl::SharedAllocationTracker TrackType
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
Kokkos::Impl::SharedAllocationTracker TrackType
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcFadType
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcFadType &src, const TrackType &)
Kokkos::Impl::SharedAllocationTracker TrackType
KOKKOS_INLINE_FUNCTION constexpr size_t span() const
Span of the mapped range : [ data() .. data() + span() )
SharedAllocationRecord * allocate_shared(ViewCtorProp< P... > const &prop, typename Traits::array_layout const &layout)
ViewOffset< typename array_dimension::template prepend< 0 >::type, typename Traits::array_layout, void > prepend_offset_type
KOKKOS_FORCEINLINE_FUNCTION reference_type reference() const
sacado_size_type m_sacado_size
KOKKOS_INLINE_FUNCTION constexpr bool span_is_contiguous() const
Is the mapped range span contiguous.
handle_type m_impl_handle
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_INLINE_FUNCTION constexpr size_t stride_4() const
KOKKOS_INLINE_FUNCTION ViewMapping(ViewCtorProp< P ... > const &prop, typename Traits::array_layout const &layout)
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3, const I4 &i4) const
KOKKOS_FORCEINLINE_FUNCTION constexpr unsigned dimension_scalar() const
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_7() const
KOKKOS_INLINE_FUNCTION constexpr size_t extent(const iType &r) const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_2() const
KOKKOS_INLINE_FUNCTION void stride(iType *const s) const
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1) const
ViewOffset< typename Traits::dimension, typename Traits::array_layout, void > offset_type
ViewOffset< typename array_dimension::template append< StokhosStorageStaticDimension >::type, typename Traits::array_layout, void > append_offset_type
Kokkos::Experimental::Impl::MPVectorAllocation< sacado_mp_vector_type > handle_type
sacado_mp_vector_type & reference_type
SharedAllocationRecord * allocate_shared(ViewCtorProp< P... > const &prop, typename Traits::array_layout const &layout, bool)
std::false_type is_regular
array_analysis::dimension array_dimension
static KOKKOS_INLINE_FUNCTION size_t memory_span(typename Traits::array_layout const &layout)
Span, in bytes, of the required memory.
KOKKOS_DEFAULTED_FUNCTION ~ViewMapping()=default
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_3() const
KOKKOS_DEFAULTED_FUNCTION ViewMapping(const ViewMapping &)=default
std::conditional< std::is_same< typenameTraits::array_layout, Kokkos::LayoutLeft >::value, prepend_offset_type, append_offset_type >::type array_offset_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_2() 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
Sacado::integral_nonzero< unsigned, StokhosStorageStaticDimension > sacado_size_type
std::add_const< intrinsic_scalar_type >::type const_intrinsic_scalar_type
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< std::is_integral< I0 >::value &&!std::is_same< typenameTraits::array_layout, Kokkos::LayoutStride >::value, reference_type >::type reference(const I0 &i0) const
Traits::value_type sacado_mp_vector_type
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< std::is_integral< I0 >::value &&std::is_same< typenameTraits::array_layout, Kokkos::LayoutStride >::value, reference_type >::type reference(const I0 &i0) const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_7() const
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
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3) const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_0() const
ViewArrayAnalysis< typename Traits::data_type > array_analysis
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_1() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_1() const
KOKKOS_DEFAULTED_FUNCTION ViewMapping(ViewMapping &&)=default
offset_type m_impl_offset
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_4() const
KOKKOS_INLINE_FUNCTION constexpr pointer_type data() const
Raw data access.
KOKKOS_INLINE_FUNCTION constexpr size_t stride_6() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_3() const
stokhos_storage_type::value_type intrinsic_scalar_type
KOKKOS_INLINE_FUNCTION ViewMapping()
KOKKOS_INLINE_FUNCTION constexpr Traits::array_layout layout() const
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_5() const
KOKKOS_INLINE_FUNCTION void assign_data(pointer_type arg_ptr)
Assign data.
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 I3 &i3, const I4 &i4, const I5 &i5, const I6 &i6, const I7 &i7) const
sacado_mp_vector_type::storage_type stokhos_storage_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_6() const
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_0() const
src_type::offset_type::dimension_type src_dimension
ViewMapping< dst_traits, typename dst_traits::specialize > dst_type
ViewDataType< strided_value_type, src_dimension >::type strided_data_type
src_traits::value_type mp_vector_type
storage_apply::type strided_storage_type
static KOKKOS_INLINE_FUNCTION void assign(dst_type &dst, const src_type &src, const Sacado::MP::VectorPartition< Size > &part)
ViewTraits< DataType, P... > src_traits
View< strided_data_type, P... > type
storage_type::template apply_N< Size > storage_apply
ViewMapping< src_traits, typename src_traits::specialize > src_type
Sacado::MP::Vector< strided_storage_type > strided_value_type
ViewTraits< strided_data_type, P... > dst_traits
mp_vector_type::storage_type storage_type
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)
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 Kokkos::Impl::ViewMapping< void, typenameKokkos::ViewTraits< D, P... >, Sacado::MP::VectorPartition< Size > >::type partition(const Kokkos::View< D, P... > &src, const unsigned beg)
void deep_copy(const Stokhos::CrsMatrix< ValueType, DstDevice, Layout > &dst, const Stokhos::CrsMatrix< ValueType, SrcDevice, Layout > &src)
Stokhos::CrsMatrix< ValueType, Device, Layout >::HostMirror create_mirror(const Stokhos::CrsMatrix< ValueType, Device, Layout > &A)
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)
KOKKOS_INLINE_FUNCTION bool is_constant(const T &x)
void destroy_shared_allocation()
ConstructDestructFunctor & operator=(const ConstructDestructFunctor &)=default
VectorFunctorType m_vector_functor
VectorConstruct< ExecSpace > VectorFunctorType
ConstructDestructFunctor(const ConstructDestructFunctor &)=default
ConstructDestructFunctor()=default
Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type > ScalarFunctorType
void construct_shared_allocation()
ConstructDestructFunctor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size, scalar_type *scalar_ptr, value_type *value_ptr)
ScalarFunctorType m_scalar_functor
VectorConstruct(const VectorConstruct &)=default
VectorConstruct(const ExecSpace &space, value_type *p, scalar_type *sp, const size_t span, const unsigned vector_size)
VectorConstruct & operator=(const VectorConstruct &)=default
VectorConstruct()=default
Sacado::ValueType< value_type >::type scalar_type
KOKKOS_INLINE_FUNCTION void assign(T *ptr)
ConstructDestructFunctor< ExecSpace > create_functor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size) const
KOKKOS_INLINE_FUNCTION MPVectorAllocation()
KOKKOS_INLINE_FUNCTION void set(value_type *ptr, const size_t span, const unsigned vector_size)
KOKKOS_INLINE_FUNCTION MPVectorAllocation & operator=(const MPVectorAllocation< T, false > &a)
static KOKKOS_INLINE_FUNCTION constexpr size_t memory_span(const size_t span, const unsigned vector_size)
ConstructDestructFunctor & operator=(const ConstructDestructFunctor &)=default
ConstructDestructFunctor()=default
ConstructDestructFunctor(const ConstructDestructFunctor &)=default
Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type > FunctorType
void destroy_shared_allocation()
ConstructDestructFunctor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size, scalar_type *scalar_ptr)
void construct_shared_allocation()
ConstructDestructFunctor< ExecSpace > create_functor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned vector_size) const
KOKKOS_INLINE_FUNCTION MPVectorAllocation()
Sacado::ValueType< value_type >::type scalar_type
KOKKOS_INLINE_FUNCTION MPVectorAllocation & operator=(const MPVectorAllocation< T, true > &a)
static KOKKOS_INLINE_FUNCTION constexpr size_t memory_span(const size_t span, const unsigned vector_size)
KOKKOS_INLINE_FUNCTION void set(value_type *ptr, const size_t span, const unsigned vector_size)
KOKKOS_INLINE_FUNCTION void assign(T *ptr)
Kokkos::Impl::ViewDataType< flat_value_type, dimension >::type flat_data_type
view_type::array_type::value_type flat_value_type
View< flat_data_type, P... > type
View< D, P... > view_type
view_type::traits::dimension dimension
OutputView::const_value_type const_value_type
OutputView::execution_space execution_space
StokhosViewFill(const OutputView &arg_out, const_value_type &arg_in)
array_analysis::const_value_type const_value_type
std::conditional< std::is_same< ArrayLayout, Kokkos::LayoutLeft >::value, prepend_scalar_dimension, append_scalar_dimension >::type scalar_dimension
const ScalarType const_scalar_type
array_analysis::dimension::template append< DimVector >::type append_scalar_dimension
ViewDataType< scalar_type, scalar_dimension >::type scalar_array_type
Kokkos::Experimental::Impl::ViewMPVectorContiguous specialize
ViewDataType< value_type, dimension >::type type
StorageType::value_type ScalarType
ViewArrayAnalysis< DataType > array_analysis
ScalarType non_const_scalar_type
array_analysis::value_type value_type
array_analysis::dimension::template prepend< 0 >::type prepend_scalar_dimension
ViewDataType< non_const_scalar_type, scalar_dimension >::type non_const_scalar_array_type
ViewDataType< non_const_value_type, dimension >::type non_const_type
array_analysis::non_const_value_type non_const_value_type
ViewDataType< const_scalar_type, scalar_dimension >::type const_scalar_array_type
std::conditional< is_const, constScalarType, ScalarType >::type scalar_type
ViewDataType< const_value_type, dimension >::type const_type
array_analysis::dimension dimension
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::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
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
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, typenamestd::conditional< rank==1, sacado_mp_vector_type *, typenamestd::conditional< rank==2, sacado_mp_vector_type **, typenamestd::conditional< rank==3, sacado_mp_vector_type ***, typenamestd::conditional< rank==4, sacado_mp_vector_type ****, typenamestd::conditional< rank==5, sacado_mp_vector_type *****, typenamestd::conditional< rank==6, sacado_mp_vector_type ******, sacado_mp_vector_type ******* >::type >::type >::type >::type >::type >::type >::type 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 ... >::SrcTraits Kokkos::ViewTraits< DataType, P... > SrcTraits
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)
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< typenameSrcTraits::array_layout, Kokkos::LayoutLeft >::value)||(rank<=2 &&R0_rev &&std::is_same< typenameSrcTraits::array_layout, Kokkos::LayoutRight >::value)), typenameSrcTraits::array_layout, Kokkos::LayoutStride >::type array_layout
View< T, P... > view_type