42 #ifndef KOKKOS_EXPERIMENTAL_VIEW_UQ_PCE_CONTIGUOUS_HPP 43 #define KOKKOS_EXPERIMENTAL_VIEW_UQ_PCE_CONTIGUOUS_HPP 45 #include "Sacado_Traits.hpp" 49 #include "Kokkos_Core.hpp" 54 #include "impl/KokkosExp_ViewMapping.hpp" 59 namespace Experimental {
64 template<
class ... Args >
67 template<
class D ,
class ... P ,
class ... Args >
70 std::is_same<
typename Kokkos::ViewTraits<D,P...>::specialize
73 ( (
sizeof...(Args) == 0 ) ||
84 template<
class DT,
class ... DP >
86 const View<DT,DP...> & view ,
88 ,
typename std::enable_if<(
89 std::is_same<
typename ViewTraits<DT,DP...>::specialize
95 typename ViewTraits<DT,DP...>::non_const_value_type >::value
96 ,
"Can only deep copy into non-const type" );
98 typedef View<DT,DP...> view_type;
102 Kokkos::Experimental::Impl::ViewFill< flat_array_type >( view , value );
104 Kokkos::Experimental::Impl::ViewFill< view_type>( view , value );
108 template<
class DT,
class ... DP >
110 const View<DT,DP...> & view ,
112 ,
typename std::enable_if<(
113 std::is_same<
typename ViewTraits<DT,DP...>::specialize
119 typename ViewTraits<DT,DP...>::non_const_value_type >::value
120 ,
"Can only deep copy into non-const type" );
122 Kokkos::Experimental::Impl::ViewFill<
View<DT,DP...> >( view , value );
125 namespace Experimental {
130 template<
class OutputView ,
class InputView >
140 const InputView & arg_in ) :
143 parallel_for(
output.dimension_0() , *this );
144 execution_space::fence();
147 KOKKOS_INLINE_FUNCTION
157 output(i0,i1,i2,i3,i4,i5,i6,i7) =
input(i0,i1,i2,i3,i4,i5,i6,i7) ;
166 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
169 const View<ST,SP...> & src
170 ,
typename std::enable_if<(
171 std::is_same<
typename ViewTraits<DT,DP...>::specialize
174 std::is_same<
typename ViewTraits<ST,SP...>::specialize
180 typename ViewTraits<DT,DP...>::non_const_value_type >::value
181 ,
"Deep copy destination must be non-const" );
184 (
unsigned(ViewTraits<DT,DP...>::rank) ==
185 unsigned(ViewTraits<ST,SP...>::rank) )
186 ,
"Deep copy destination and source must have same rank" );
188 typedef View<DT,DP...> dst_type ;
189 typedef View<ST,SP...> src_type ;
190 typedef typename dst_type::array_type dst_array_type ;
191 typedef typename src_type::array_type src_array_type ;
194 dst_array_type dst_array = dst ;
195 src_array_type src_array = src ;
203 if ( Impl::is_same<
typename dst_type::memory_space ,
204 typename src_type::memory_space >::value ) {
210 typedef View<
typename src_type::non_const_data_type ,
211 typename src_type::array_layout ,
213 typedef typename tmp_src_type::array_type tmp_src_array_type;
214 typedef View<
typename dst_type::non_const_data_type ,
215 typename dst_type::array_layout ,
217 typedef typename tmp_dst_type::array_type tmp_dst_array_type;
225 src_dims[0] = src.dimension_0();
226 src_dims[1] = src.dimension_1();
227 src_dims[2] = src.dimension_2();
228 src_dims[3] = src.dimension_3();
229 src_dims[4] = src.dimension_4();
230 src_dims[5] = src.dimension_5();
231 src_dims[6] = src.dimension_6();
232 src_dims[7] = src.dimension_7();
234 tmp_src_type src_tmp(
235 Experimental::view_alloc(
"src_tmp" , Experimental::WithoutInitializing,
cijk(src) ) ,
236 src_dims[0], src_dims[1], src_dims[2], src_dims[3],
237 src_dims[4], src_dims[5], src_dims[6], src_dims[7] );
239 dst_array_type dst_array = dst ;
240 tmp_src_array_type src_array = src_tmp ;
250 dst_dims[0] = dst.dimension_0();
251 dst_dims[1] = dst.dimension_1();
252 dst_dims[2] = dst.dimension_2();
253 dst_dims[3] = dst.dimension_3();
254 dst_dims[4] = dst.dimension_4();
255 dst_dims[5] = dst.dimension_5();
256 dst_dims[6] = dst.dimension_6();
257 dst_dims[7] = dst.dimension_7();
259 tmp_dst_type dst_tmp(
260 Experimental::view_alloc(
"dst_tmp" , Experimental::WithoutInitializing,
cijk(dst) ) ,
261 dst_dims[0], dst_dims[1], dst_dims[2], dst_dims[3],
262 dst_dims[4], dst_dims[5], dst_dims[6], dst_dims[7] );
263 tmp_dst_array_type dst_array = dst_tmp ;
264 src_array_type src_array = src ;
274 src_dims[0] = src.dimension_0();
275 src_dims[1] = src.dimension_1();
276 src_dims[2] = src.dimension_2();
277 src_dims[3] = src.dimension_3();
278 src_dims[4] = src.dimension_4();
279 src_dims[5] = src.dimension_5();
280 src_dims[6] = src.dimension_6();
281 src_dims[7] = src.dimension_7();
283 tmp_src_type src_tmp(
284 Experimental::view_alloc(
"src_tmp" , Experimental::WithoutInitializing,
cijk(src) ) ,
285 src_dims[0], src_dims[1], src_dims[2], src_dims[3],
286 src_dims[4], src_dims[5], src_dims[6], src_dims[7] );
290 dst_dims[0] = dst.dimension_0();
291 dst_dims[1] = dst.dimension_1();
292 dst_dims[2] = dst.dimension_2();
293 dst_dims[3] = dst.dimension_3();
294 dst_dims[4] = dst.dimension_4();
295 dst_dims[5] = dst.dimension_5();
296 dst_dims[6] = dst.dimension_6();
297 dst_dims[7] = dst.dimension_7();
299 tmp_dst_type dst_tmp(
300 Experimental::view_alloc(
"dst_tmp" , Experimental::WithoutInitializing,
cijk(dst) ) ,
301 dst_dims[0], dst_dims[1], dst_dims[2], dst_dims[3],
302 dst_dims[4], dst_dims[5], dst_dims[6], dst_dims[7] );
303 tmp_dst_array_type dst_array = dst_tmp ;
304 tmp_src_array_type src_array = src_tmp ;
312 template <
typename T,
typename ... P>
316 std::is_same<
typename view_type::specialize,
320 template <
typename D,
typename ... P>
322 typename std::enable_if< is_view_uq_pce< View<D,P...> >::value >
::type > {
324 typedef typename view_type::traits::dimension
dimension;
326 typedef typename Kokkos::Experimental::Impl::ViewDataType< flat_value_type , dimension >::type
flat_data_type;
330 template <
typename ViewType>
332 typename std::enable_if< is_view_uq_pce< ViewType >::value >
::type > {
333 typedef typename ViewType::non_const_value_type::cijk_type
type;
336 template <
typename T,
typename ... P>
337 KOKKOS_INLINE_FUNCTION
341 return view.implementation_map().dimension_scalar();
344 template <
typename view_type>
345 KOKKOS_INLINE_FUNCTION
347 std::enable_if< is_view_uq_pce<view_type>::value,
348 typename CijkType<view_type>::type >::type
350 return view.implementation_map().cijk();
353 template <
typename view_type>
354 KOKKOS_INLINE_FUNCTION
356 std::enable_if< is_view_uq_pce<view_type>::value,
bool >::type
358 return view.implementation_map().is_allocation_contiguous();
361 template <
typename ViewType>
365 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
366 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
368 return ViewType(Experimental::view_alloc(label,
cijk),
369 N0, N1, N2, N3, N4, N5, N6, N7);
372 template <
typename ViewType>
375 const Experimental::Impl::WithoutInitializing_t& init,
377 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
378 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
380 return ViewType(Experimental::view_alloc(label,init,
cijk),
381 N0, N1, N2, N3, N4, N5, N6, N7);
384 template <
typename ViewType>
388 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
389 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
391 return ViewType(Experimental::view_alloc(init.label,
392 Experimental::WithoutInitializing,
394 N0, N1, N2, N3, N4, N5, N6, N7);
397 template <
typename ViewType>
398 typename std::enable_if< is_view_uq_pce<ViewType>::value, ViewType>::type
401 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
402 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
404 size_t N[8] = { N0, N1, N2, N3, N4, N5, N6, N7 };
405 N[ViewType::rank] =
cijk.dimension();
406 ViewType v(Experimental::view_wrap(ptr,
cijk),
407 N[0], N[1], N[2], N[3], N[4], N[5], N[6], N[7]);
422 template<
typename Value,
typename Execution,
typename Memory >
423 struct ViewCtorProp< void ,
Stokhos::CrsProductTensor<Value, Execution, Memory> >
425 ViewCtorProp() = default ;
426 ViewCtorProp(
const ViewCtorProp & ) = default ;
427 ViewCtorProp & operator = (
const ViewCtorProp & ) = default ;
437 template <
typename AllocProp>
443 template<
typename T >
449 template<
typename Value,
typename Execution,
typename Memory >
451 ViewCtorProp<
Stokhos::CrsProductTensor<Value, Execution, Memory> >
457 template<
typename T,
typename ... P >
468 template <
typename CijkType,
typename AllocProp>
469 KOKKOS_INLINE_FUNCTION
470 typename std::enable_if< !Impl::ctor_prop_has_cijk<AllocProp>::value,
477 template <
typename CijkType,
typename AllocProp>
478 KOKKOS_INLINE_FUNCTION
479 typename std::enable_if< Impl::ctor_prop_has_cijk<AllocProp>::value,
483 return ( (
const Impl::ViewCtorProp<void,CijkType>&) prop ).value;
493 namespace Experimental {
496 template<
class DataType ,
class ArrayLayout ,
typename StorageType >
497 struct ViewDataAnalysis< DataType
499 ,
Sacado::UQ::PCE< StorageType > >
518 ViewDataType< value_type , dimension >::type
type ;
520 ViewDataType< const_value_type , dimension >::type
const_type ;
527 enum { is_const = std::is_same< value_type , const_value_type >::value };
531 std::conditional< is_const , const ScalarType , ScalarType >::type
538 typedef typename array_analysis::dimension::
539 template prepend<0>::type
541 typedef typename array_analysis::dimension::
542 template append<0>::type
544 typedef typename std::conditional<
545 std::is_same< ArrayLayout, Kokkos::LayoutLeft>::value,
556 ViewDataType< const_scalar_type , scalar_dimension >::type
560 ViewDataType< non_const_scalar_type , scalar_dimension >::type
571 namespace Experimental {
579 template <
class ValueType>
588 KOKKOS_INLINE_FUNCTION
589 static constexpr
size_t 594 KOKKOS_INLINE_FUNCTION
597 template <
typename T>
598 KOKKOS_INLINE_FUNCTION
608 KOKKOS_INLINE_FUNCTION
609 void set(
value_type* ptr,
const size_t span,
const unsigned pce_size) {
614 template <
class ExecSpace>
632 const unsigned pce_size,
638 if ( !
m_space.in_parallel() ) {
639 typedef Kokkos::RangePolicy< ExecSpace > PolicyType ;
640 const Kokkos::Impl::ParallelFor< PCEConstruct , PolicyType >
641 closure( *
this , PolicyType( 0 ,
m_span ) );
646 for (
size_t i = 0 ; i <
m_span ; ++i )
operator()(i);
650 KOKKOS_INLINE_FUNCTION
656 template <
class ExecSpace>
669 const bool initialize,
671 const unsigned pce_size,
706 template <
class ExecSpace>
707 inline ConstructDestructFunctor<ExecSpace>
709 const bool initialize,
711 const unsigned pce_size,
713 return ConstructDestructFunctor<ExecSpace>(space, initialize, span,
720 template <
typename T>
730 template<
class Traits >
731 class ViewMapping< Traits ,
732 typename std::enable_if<
733 ( std::is_same< typename Traits::specialize
734 , ViewPCEContiguous >::value
736 ( std::is_same< typename Traits::array_layout
737 , Kokkos::LayoutLeft >::value
739 std::is_same< typename Traits::array_layout
740 , Kokkos::LayoutRight >::value
742 std::is_same< typename Traits::array_layout
743 , Kokkos::LayoutStride >::value
749 template< class ,
class ... >
friend class ViewMapping ;
750 template< class ,
class ... >
friend class Kokkos::Experimental::View ;
758 typedef typename sacado_uq_pce_type::cijk_type
cijk_type ;
763 typedef ViewOffset<
typename Traits::dimension
764 ,
typename Traits::array_layout
771 typedef ViewOffset<
typename array_dimension::
772 template append<0>::type,
773 typename Traits::array_layout,
776 typedef ViewOffset<
typename array_dimension::
777 template prepend<0>::type,
778 typename Traits::array_layout,
781 typedef typename std::conditional<
782 std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft>::value,
795 KOKKOS_INLINE_FUNCTION
797 const size_t sz = this->span();
804 return last_coeff == last_coeff_expected;
812 enum { Rank = Traits::dimension::rank };
815 enum { Sacado_Rank = std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft >::value ? 0 : Rank+1 };
818 template<
typename iType >
819 KOKKOS_INLINE_FUNCTION constexpr
size_t extent(
const iType & r )
const 820 {
return m_offset.m_dim.extent(r); }
822 KOKKOS_INLINE_FUNCTION constexpr
823 typename Traits::array_layout
layout()
const 824 {
return m_offset.layout(); }
827 {
return m_offset.dimension_0(); }
829 {
return m_offset.dimension_1(); }
831 {
return m_offset.dimension_2(); }
833 {
return m_offset.dimension_3(); }
835 {
return m_offset.dimension_4(); }
837 {
return m_offset.dimension_5(); }
839 {
return m_offset.dimension_6(); }
841 {
return m_offset.dimension_7(); }
848 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_0()
const 849 {
return m_offset.stride_0(); }
850 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_1()
const 851 {
return m_offset.stride_1(); }
852 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_2()
const 853 {
return m_offset.stride_2(); }
854 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_3()
const 855 {
return m_offset.stride_3(); }
856 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_4()
const 857 {
return m_offset.stride_4(); }
858 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_5()
const 859 {
return m_offset.stride_5(); }
860 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_6()
const 861 {
return m_offset.stride_6(); }
862 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_7()
const 863 {
return m_offset.stride_7(); }
865 template<
typename iType >
866 KOKKOS_INLINE_FUNCTION
void stride( iType *
const s )
const 867 { m_offset.stride(s); }
871 {
return m_sacado_size; }
874 KOKKOS_FORCEINLINE_FUNCTION
879 KOKKOS_FORCEINLINE_FUNCTION
884 KOKKOS_INLINE_FUNCTION
886 {
return m_is_contiguous; }
889 static const bool is_static = false ;
892 static const bool is_contiguous =
true;
904 KOKKOS_INLINE_FUNCTION constexpr
size_t span()
const 905 {
return m_offset.span(); }
909 {
return m_offset.span_is_contiguous() ; }
917 KOKKOS_FORCEINLINE_FUNCTION
922 template<
typename I0 >
923 KOKKOS_FORCEINLINE_FUNCTION
925 std::enable_if< std::is_integral<I0>::value &&
926 ! std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
927 , reference_type >::type
932 template<
typename I0 >
933 KOKKOS_FORCEINLINE_FUNCTION
935 std::enable_if< std::is_integral<I0>::value &&
936 std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
937 , reference_type >::type
939 {
return m_handle.
value_ptr[ m_offset(i0) ]; }
941 template<
typename I0 ,
typename I1 >
942 KOKKOS_FORCEINLINE_FUNCTION
944 {
return m_handle.
value_ptr[ m_offset(i0,i1) ]; }
946 template<
typename I0 ,
typename I1 ,
typename I2 >
947 KOKKOS_FORCEINLINE_FUNCTION
949 {
return m_handle.
value_ptr[ m_offset(i0,i1,i2) ]; }
951 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3 >
952 KOKKOS_FORCEINLINE_FUNCTION
954 {
return m_handle.
value_ptr[ m_offset(i0,i1,i2,i3) ]; }
956 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
958 KOKKOS_FORCEINLINE_FUNCTION
960 ,
const I4 & i4 )
const 961 {
return m_handle.
value_ptr[ m_offset(i0,i1,i2,i3,i4) ]; }
963 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
964 ,
typename I4 ,
typename I5 >
965 KOKKOS_FORCEINLINE_FUNCTION
967 ,
const I4 & i4 ,
const I5 & i5 )
const 968 {
return m_handle.
value_ptr[ m_offset(i0,i1,i2,i3,i4,i5) ]; }
970 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
971 ,
typename I4 ,
typename I5 ,
typename I6 >
972 KOKKOS_FORCEINLINE_FUNCTION
974 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 )
const 975 {
return m_handle.
value_ptr[ m_offset(i0,i1,i2,i3,i4,i5,i6) ]; }
977 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
978 ,
typename I4 ,
typename I5 ,
typename I6 ,
typename I7 >
979 KOKKOS_FORCEINLINE_FUNCTION
981 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 ,
const I7 & i7 )
const 982 {
return m_handle.
value_ptr[ m_offset(i0,i1,i2,i3,i4,i5,i6,i7) ]; }
987 KOKKOS_INLINE_FUNCTION
988 static size_t memory_span(
typename Traits::array_layout
const & layout )
991 typedef std::integral_constant< unsigned , 0 > padding ;
993 unsigned sacado_size =
995 return handle_type::memory_span( offset.span(), sacado_size );
1000 KOKKOS_INLINE_FUNCTION ~ViewMapping() = default ;
1006 m_is_contiguous(
true)
1009 KOKKOS_INLINE_FUNCTION ViewMapping(
const ViewMapping & ) = default ;
1010 KOKKOS_INLINE_FUNCTION ViewMapping & operator = (
const ViewMapping & ) = default ;
1012 KOKKOS_INLINE_FUNCTION ViewMapping( ViewMapping && ) = default ;
1013 KOKKOS_INLINE_FUNCTION ViewMapping & operator = ( ViewMapping && ) = default ;
1015 template<
class ... P >
1016 KOKKOS_INLINE_FUNCTION
1018 ( ViewCtorProp< P ... >
const & prop
1019 ,
typename Traits::array_layout
const & layout
1022 , m_offset( std::integral_constant< unsigned , 0 >() , layout )
1025 m_handle.
set( ( (ViewCtorProp<void,pointer_type>
const &) prop ).value
1026 , m_offset.span(), m_sacado_size );
1027 m_cijk = extract_cijk<cijk_type>(prop);
1028 #ifndef __CUDA_ARCH__ 1029 if (m_cijk.dimension() == 0)
1030 m_cijk = getGlobalCijkTensor<cijk_type>();
1031 if (m_sacado_size == 0)
1032 m_sacado_size = m_cijk.dimension();
1034 m_is_contiguous = this->is_data_contiguous();
1042 template<
class ... P >
1043 SharedAllocationRecord<> *
1045 ,
typename Traits::array_layout
const & layout )
1047 typedef ViewCtorProp< P... > ctor_prop ;
1050 typedef typename Traits::memory_space memory_space ;
1051 typedef typename handle_type::template ConstructDestructFunctor<execution_space> functor_type ;
1052 typedef SharedAllocationRecord< memory_space , functor_type > record_type ;
1055 typedef std::integral_constant< unsigned , 0 > padding ;
1059 m_cijk = extract_cijk<cijk_type>(prop);
1060 if (m_cijk.dimension() == 0)
1061 m_cijk = getGlobalCijkTensor<cijk_type>();
1062 if (m_sacado_size == 0)
1063 m_sacado_size = m_cijk.dimension();
1064 m_is_contiguous =
true;
1066 const size_t alloc_size =
1067 handle_type::memory_span( m_offset.span(), m_sacado_size );
1070 record_type *
const record =
1071 record_type::allocate( ( (ViewCtorProp<void,memory_space>
const &) prop ).value
1072 , ( (ViewCtorProp<void,std::string>
const &) prop ).value
1079 m_handle.
set( reinterpret_cast< pointer_type >( record->data() ),
1080 m_offset.span(), m_sacado_size );
1085 ( (ViewCtorProp<void,execution_space>
const &) prop).value
1086 , ctor_prop::initialize
1092 record->m_destroy.construct_shared_allocation();
1107 namespace Experimental {
1114 template<
class DstTraits ,
class SrcTraits >
1115 class ViewMapping< DstTraits , SrcTraits ,
1116 typename std::enable_if<(
1117 std::is_same< typename DstTraits::memory_space
1118 , typename SrcTraits::memory_space >::value
1121 std::is_same< typename DstTraits::specialize
1122 , ViewPCEContiguous >::value
1125 std::is_same< typename SrcTraits::specialize
1126 , ViewPCEContiguous >::value
1131 enum { is_assignable =
true };
1133 typedef Kokkos::Experimental::Impl::SharedAllocationTracker
TrackType ;
1137 KOKKOS_INLINE_FUNCTION
static 1144 std::is_same<
typename DstTraits::array_layout
1145 , Kokkos::LayoutLeft >::value ||
1146 std::is_same<
typename DstTraits::array_layout
1147 , Kokkos::LayoutRight >::value ||
1148 std::is_same<
typename DstTraits::array_layout
1149 , Kokkos::LayoutStride >::value
1153 std::is_same<
typename SrcTraits::array_layout
1154 , Kokkos::LayoutLeft >::value ||
1155 std::is_same<
typename SrcTraits::array_layout
1156 , Kokkos::LayoutRight >::value ||
1157 std::is_same<
typename SrcTraits::array_layout
1158 , Kokkos::LayoutStride >::value
1160 ,
"View of UQ::PCE requires LayoutLeft, LayoutRight, or LayoutStride" );
1163 std::is_same<
typename DstTraits::array_layout
1164 ,
typename SrcTraits::array_layout >::value ||
1165 std::is_same<
typename DstTraits::array_layout
1166 , Kokkos::LayoutStride >::value ||
1167 (
unsigned(DstTraits::rank) == 1 &&
unsigned(SrcTraits::rank) == 1 ) ,
1168 "View assignment must have compatible layout" );
1174 ,
typename SrcTraits::const_value_type >::value ,
1175 "View assignment must have same value type or const = non-const" );
1178 ViewDimensionAssignable
1179 <
typename DstType::offset_type::dimension_type
1180 ,
typename SrcType::offset_type::dimension_type >::value ,
1181 "View assignment must have compatible dimensions" );
1183 dst.m_handle = src.m_handle ;
1184 dst.m_offset = src.m_offset ;
1185 dst.m_sacado_size = src.m_sacado_size ;
1186 dst.m_cijk = src.m_cijk ;
1187 dst.m_is_contiguous = src.m_is_contiguous ;
1196 template<
class DstTraits ,
class SrcTraits >
1197 class ViewMapping< DstTraits , SrcTraits ,
1198 typename std::enable_if<(
1199 std::is_same< typename DstTraits::memory_space
1200 , typename SrcTraits::memory_space >::value
1203 std::is_same< typename DstTraits::specialize , void >::value
1206 std::is_same< typename SrcTraits::specialize
1207 , ViewPCEContiguous >::value
1210 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)+1
1215 enum { is_assignable =
true };
1217 typedef Kokkos::Experimental::Impl::SharedAllocationTracker
TrackType ;
1221 KOKKOS_INLINE_FUNCTION
static 1228 std::is_same<
typename DstTraits::array_layout
1229 , Kokkos::LayoutLeft >::value ||
1230 std::is_same<
typename DstTraits::array_layout
1231 , Kokkos::LayoutRight >::value ||
1232 std::is_same<
typename DstTraits::array_layout
1233 , Kokkos::LayoutStride >::value
1237 std::is_same<
typename SrcTraits::array_layout
1238 , Kokkos::LayoutLeft >::value ||
1239 std::is_same<
typename SrcTraits::array_layout
1240 , Kokkos::LayoutRight >::value ||
1241 std::is_same<
typename SrcTraits::array_layout
1242 , Kokkos::LayoutStride >::value
1244 ,
"View of UQ::PCE requires LayoutLeft, LayoutRight, or LayoutStride" );
1247 std::is_same<
typename DstTraits::array_layout
1248 ,
typename SrcTraits::array_layout >::value ||
1249 std::is_same<
typename DstTraits::array_layout
1250 , Kokkos::LayoutStride >::value ,
1251 "View assignment must have compatible layout" );
1254 std::is_same<
typename DstTraits::scalar_array_type
1255 ,
typename SrcTraits::scalar_array_type >::value ||
1256 std::is_same<
typename DstTraits::scalar_array_type
1257 ,
typename SrcTraits::const_scalar_array_type >::value ,
1258 "View assignment must have same value type or const = non-const" );
1261 ViewDimensionAssignable<
1262 typename DstType::offset_type::dimension_type,
1263 typename SrcType::array_offset_type::dimension_type >::value,
1264 "View assignment must have compatible dimensions" );
1266 if ( !src.m_is_contiguous )
1267 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::UQ::PCE ... >: can't assign non-contiguous view ******\n\n");
1270 dims[0] = src.m_offset.dimension_0();
1271 dims[1] = src.m_offset.dimension_1();
1272 dims[2] = src.m_offset.dimension_2();
1273 dims[3] = src.m_offset.dimension_3();
1274 dims[4] = src.m_offset.dimension_4();
1275 dims[5] = src.m_offset.dimension_5();
1276 dims[6] = src.m_offset.dimension_6();
1277 dims[7] = src.m_offset.dimension_7();
1278 unsigned rank = SrcTraits::dimension::rank;
1279 unsigned sacado_size = src.m_sacado_size;
1280 if (std::is_same<typename SrcTraits::array_layout, LayoutLeft>::value) {
1282 for (
unsigned i=rank; i>0; --i)
1283 dims[i] = dims[i-1];
1284 dims[0] = sacado_size;
1287 dims[rank] = sacado_size;
1289 typedef typename DstType::offset_type dst_offset_type;
1290 dst.m_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1291 typename DstTraits::array_layout(
1292 dims[0] , dims[1] , dims[2] , dims[3] ,
1293 dims[4] , dims[5] , dims[6] , dims[7] ) );
1294 dst.m_handle = src.m_handle.scalar_ptr ;
1304 template<
class DstTraits ,
class SrcTraits >
1305 class ViewMapping< DstTraits , SrcTraits ,
1306 typename std::enable_if<(
1307 std::is_same< typename DstTraits::memory_space
1308 , typename SrcTraits::memory_space >::value
1311 std::is_same< typename DstTraits::specialize , void >::value
1314 std::is_same< typename SrcTraits::specialize
1315 , ViewPCEContiguous >::value
1318 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)
1323 enum { is_assignable =
true };
1325 typedef Kokkos::Experimental::Impl::SharedAllocationTracker
TrackType ;
1329 KOKKOS_INLINE_FUNCTION
static 1336 std::is_same<
typename DstTraits::array_layout
1337 , Kokkos::LayoutLeft >::value ||
1338 std::is_same<
typename DstTraits::array_layout
1339 , Kokkos::LayoutRight >::value ||
1340 std::is_same<
typename DstTraits::array_layout
1341 , Kokkos::LayoutStride >::value
1345 std::is_same<
typename SrcTraits::array_layout
1346 , Kokkos::LayoutLeft >::value ||
1347 std::is_same<
typename SrcTraits::array_layout
1348 , Kokkos::LayoutRight >::value ||
1349 std::is_same<
typename SrcTraits::array_layout
1350 , Kokkos::LayoutStride >::value
1352 ,
"View of UQ::PCE requires LayoutLeft, LayoutRight, or LayoutStride" );
1355 std::is_same<
typename DstTraits::array_layout
1356 ,
typename SrcTraits::array_layout >::value ||
1357 std::is_same<
typename DstTraits::array_layout
1358 , Kokkos::LayoutStride >::value ,
1359 "View assignment must have compatible layout" );
1366 "View assignment must have same value type or const = non-const" );
1369 ViewDimensionAssignable<
1370 typename DstType::offset_type::dimension_type,
1371 typename SrcType::offset_type::dimension_type >::value,
1372 "View assignment must have compatible dimensions" );
1374 if ( !src.m_is_contiguous )
1375 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::UQ::PCE ... >: can't assign non-contiguous view ******\n\n");
1378 dims[0] = src.m_offset.dimension_0();
1379 dims[1] = src.m_offset.dimension_1();
1380 dims[2] = src.m_offset.dimension_2();
1381 dims[3] = src.m_offset.dimension_3();
1382 dims[4] = src.m_offset.dimension_4();
1383 dims[5] = src.m_offset.dimension_5();
1384 dims[6] = src.m_offset.dimension_6();
1385 dims[7] = src.m_offset.dimension_7();
1386 unsigned rank = SrcTraits::dimension::rank;
1387 unsigned sacado_size = src.m_sacado_size;
1388 if (std::is_same<typename DstTraits::array_layout, LayoutLeft>::value) {
1389 dims[0] = dims[0]*sacado_size;
1393 dims[rank-1] = dims[rank-1]*sacado_size;
1396 typedef typename DstType::offset_type dst_offset_type;
1397 dst.m_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1398 typename DstTraits::array_layout(
1399 dims[0] , dims[1] , dims[2] , dims[3] ,
1400 dims[4] , dims[5] , dims[6] , dims[7] ) );
1401 dst.m_handle = src.m_handle.scalar_ptr ;
1412 namespace Experimental {
1417 template<
class DataType,
class ... P ,
class Arg0,
class ... Args >
1419 < typename std::enable_if<(
1421 std::is_same< typename Kokkos::Experimental::ViewTraits<DataType,P...>::specialize
1422 , ViewPCEContiguous >::value
1425 std::is_same< typename Kokkos::Experimental::ViewTraits<DataType,P...>::array_layout
1426 , Kokkos::LayoutLeft >::value ||
1427 std::is_same< typename Kokkos::Experimental::ViewTraits<DataType,P...>::array_layout
1428 , Kokkos::LayoutRight >::value ||
1429 std::is_same< typename Kokkos::Experimental::ViewTraits<DataType,P...>::array_layout
1430 , Kokkos::LayoutStride >::value
1433 , Kokkos::Experimental::ViewTraits<DataType,P...>
1438 typedef Kokkos::Experimental::ViewTraits<DataType,P...>
SrcTraits;
1444 , R0 = bool(is_integral_extent<0,Arg0,Args...>::value)
1445 , R1 = bool(is_integral_extent<1,Arg0,Args...>::value)
1446 , R2 = bool(is_integral_extent<2,Arg0,Args...>::value)
1447 , R3 = bool(is_integral_extent<3,Arg0,Args...>::value)
1448 , R4 = bool(is_integral_extent<4,Arg0,Args...>::value)
1449 , R5 = bool(is_integral_extent<5,Arg0,Args...>::value)
1450 , R6 = bool(is_integral_extent<6,Arg0,Args...>::value)
1454 enum { rank = unsigned(R0) + unsigned(R1) + unsigned(R2) + unsigned(R3)
1455 + unsigned(R4) + unsigned(R5) + unsigned(R6) };
1458 enum { R0_rev = ( 0 == SrcTraits::rank ? RZ : (
1459 1 == SrcTraits::rank ? R0 : (
1460 2 == SrcTraits::rank ? R1 : (
1461 3 == SrcTraits::rank ? R2 : (
1462 4 == SrcTraits::rank ? R3 : (
1463 5 == SrcTraits::rank ? R4 : (
1464 6 == SrcTraits::rank ? R5 : R6 ))))))) };
1467 typedef typename std::conditional<
1473 ( rank <= 2 && R0 && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutLeft >::value )
1477 ( rank <= 2 && R0_rev && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutRight >::value )
1478 ),
typename SrcTraits::array_layout , Kokkos::LayoutStride
1496 typedef Kokkos::Experimental::ViewTraits
1499 ,
typename SrcTraits::device_type
1502 typedef Kokkos::Experimental::View
1505 ,
typename SrcTraits::device_type
1506 ,
typename SrcTraits::memory_traits >
type ;
1511 template<
class DstTraits >
1512 KOKKOS_INLINE_FUNCTION
1513 static void assign( ViewMapping< DstTraits , void > & dst
1514 , ViewMapping< SrcTraits , void >
const & src
1515 , Arg0 arg0, Args ... args )
1518 ViewMapping< DstTraits , traits_type , void >::is_assignable ,
1519 "Subview destination type must be compatible with subview derived type" );
1521 typedef ViewMapping< DstTraits , void > DstType ;
1522 typedef typename DstType::offset_type dst_offset_type ;
1524 const SubviewExtents< SrcTraits::rank , rank >
1525 extents( src.m_offset.m_dim , arg0 , args... );
1527 const size_t offset = src.m_offset( extents.domain_offset(0)
1528 , extents.domain_offset(1)
1529 , extents.domain_offset(2)
1530 , extents.domain_offset(3)
1531 , extents.domain_offset(4)
1532 , extents.domain_offset(5)
1533 , extents.domain_offset(6)
1534 , extents.domain_offset(7) );
1536 dst.m_offset = dst_offset_type( src.m_offset , extents );
1537 dst.m_handle.value_ptr = src.m_handle.value_ptr + offset;
1538 dst.m_handle.scalar_ptr =
1539 src.m_handle.scalar_ptr + offset * src.m_sacado_size;
1540 dst.m_sacado_size = src.m_sacado_size;
1541 dst.m_cijk = src.m_cijk;
1542 dst.m_is_contiguous = src.m_is_contiguous;
1559 #if defined( KOKKOS_HAVE_CUDA ) 1560 template<
class OutputView >
1561 struct ViewFill< OutputView ,
1562 typename std::enable_if< std::is_same< typename OutputView::specialize,
1563 Kokkos::Experimental::Impl::ViewPCEContiguous >::value &&
1564 std::is_same< typename OutputView::execution_space,
1565 Cuda >::value >::type >
1567 typedef typename OutputView::const_value_type const_value_type ;
1568 typedef typename Sacado::ScalarType<const_value_type>::type
scalar_type ;
1570 typedef typename OutputView::size_type size_type ;
1572 template <
unsigned VectorLength>
1575 const OutputView output;
1576 const_value_type input;
1578 PCEKernel(
const OutputView & arg_out , const_value_type & arg_in ) :
1579 output(arg_out), input(arg_in) {}
1581 typedef typename Kokkos::TeamPolicy< execution_space >::member_type team_member ;
1583 KOKKOS_INLINE_FUNCTION
1584 void operator()(
const team_member & dev )
const 1586 const size_type tidx = dev.team_rank() % VectorLength;
1587 const size_type tidy = dev.team_rank() / VectorLength;
1588 const size_type nrow = dev.team_size() / VectorLength;
1591 const size_type i0 = dev.league_rank() * nrow + tidy;
1592 if ( i0 >= output.dimension_0() )
return;
1594 for ( size_type i1 = 0 ; i1 < output.dimension_1() ; ++i1 ) {
1595 for ( size_type i2 = 0 ; i2 < output.dimension_2() ; ++i2 ) {
1596 for ( size_type i3 = 0 ; i3 < output.dimension_3() ; ++i3 ) {
1597 for ( size_type i4 = 0 ; i4 < output.dimension_4() ; ++i4 ) {
1598 for ( size_type i5 = 0 ; i5 < output.dimension_5() ; ++i5 ) {
1599 for ( size_type i6 = 0 ; i6 < output.dimension_6() ; ++i6 ) {
1600 for ( size_type i7 = 0 ; i7 < output.dimension_7() ; ++i7 ) {
1601 for ( size_type is = tidx ; is < nvec ; is+=VectorLength ) {
1602 output(i0,i1,i2,i3,i4,i5,i6,i7).fastAccessCoeff(is) =
1603 input.fastAccessCoeff(is) ;
1608 template <
unsigned VectorLength>
1609 struct ScalarKernel {
1611 const OutputView output;
1614 ScalarKernel(
const OutputView & arg_out ,
const scalar_type & arg_in ) :
1615 output(arg_out), input(arg_in) {}
1617 typedef typename Kokkos::TeamPolicy< execution_space >::member_type team_member ;
1618 KOKKOS_INLINE_FUNCTION
1619 void operator()(
const team_member & dev )
const 1621 const size_type tidx = dev.team_rank() % VectorLength;
1622 const size_type tidy = dev.team_rank() / VectorLength;
1623 const size_type nrow = dev.team_size() / VectorLength;
1626 const size_type i0 = dev.league_rank() * nrow + tidy;
1627 if ( i0 >= output.dimension_0() )
return;
1629 for ( size_type i1 = 0 ; i1 < output.dimension_1() ; ++i1 ) {
1630 for ( size_type i2 = 0 ; i2 < output.dimension_2() ; ++i2 ) {
1631 for ( size_type i3 = 0 ; i3 < output.dimension_3() ; ++i3 ) {
1632 for ( size_type i4 = 0 ; i4 < output.dimension_4() ; ++i4 ) {
1633 for ( size_type i5 = 0 ; i5 < output.dimension_5() ; ++i5 ) {
1634 for ( size_type i6 = 0 ; i6 < output.dimension_6() ; ++i6 ) {
1635 for ( size_type i7 = 0 ; i7 < output.dimension_7() ; ++i7 ) {
1636 for ( size_type is = tidx ; is < npce ; is+=VectorLength ) {
1637 output(i0,i1,i2,i3,i4,i5,i6,i7).fastAccessCoeff(is) =
1643 ViewFill(
const OutputView & output , const_value_type & input )
1647 const unsigned vector_length =
1651 const size_type block_size = 256;
1653 const size_type rows_per_block = block_size / vector_length;
1654 const size_type n = output.dimension_0();
1655 const size_type league_size = ( n + rows_per_block-1 ) / rows_per_block;
1656 const size_type team_size = rows_per_block * vector_length;
1657 Kokkos::TeamPolicy< execution_space > config( league_size, team_size );
1660 Kokkos::abort(
"ViewFill: Invalid input value size");
1662 if (input.size() == 1)
1664 config, ScalarKernel<vector_length>(output, input.fastAccessCoeff(0)) );
1666 parallel_for( config, PCEKernel<vector_length>(output, input) );
1667 execution_space::fence();
1670 ViewFill(
const OutputView & output ,
const scalar_type & input )
1674 const unsigned vector_length =
1678 const size_type block_size = 256;
1680 const size_type rows_per_block = block_size / vector_length;
1681 const size_type n = output.dimension_0();
1682 const size_type league_size = ( n + rows_per_block-1 ) / rows_per_block;
1683 const size_type team_size = rows_per_block * vector_length;
1684 Kokkos::TeamPolicy< execution_space > config( league_size, team_size );
1686 parallel_for( config, ScalarKernel<vector_length>(output, input) );
1687 execution_space::fence();
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
execution_space::size_type size_type
KOKKOS_INLINE_FUNCTION constexpr pointer_type data() const
Raw data access.
ViewMapping< SrcTraits, void > SrcType
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_2() const
static KOKKOS_INLINE_FUNCTION constexpr size_t memory_span(const size_t span, const unsigned pce_size)
Stokhos::StandardStorage< int, double > storage_type
ViewMapping< DstTraits, void > DstType
PCEConstruct< ExecSpace > PCEFunctorType
ViewOffset< typename array_dimension::template append< 0 >::type, typename Traits::array_layout, void > append_offset_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_5() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_6() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_5() const
KOKKOS_INLINE_FUNCTION bool is_allocation_contiguous() const
KOKKOS_INLINE_FUNCTION PCEAllocation()
Kokkos::Experimental::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::specialize, ViewPCEContiguous >::value &&(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutStride >::value))>::type, Kokkos::Experimental::ViewTraits< DataType, P... >, Arg0, Args ... >::sacado_uq_pce_type SrcTraits::value_type sacado_uq_pce_type
std::conditional< std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft >::value, prepend_offset_type, append_offset_type >::type array_offset_type
sacado_uq_pce_type & reference_type
array_analysis::dimension array_dimension
KOKKOS_INLINE_FUNCTION PCEAllocation & operator=(const PCEAllocation< T > &a)
ViewOffset< typename Traits::dimension, typename Traits::array_layout, void > offset_type
sacado_uq_pce_type::cijk_type cijk_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_1() const
Kokkos::DefaultExecutionSpace execution_space
const ScalarType const_scalar_type
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< std::is_integral< I0 >::value &&! std::is_same< typename Traits::array_layout, Kokkos::LayoutStride >::value, reference_type >::type reference(const I0 &i0) const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_7() const
value_type::cijk_type cijk_type
Traits::value_type sacado_uq_pce_type
std::add_const< intrinsic_scalar_type >::type const_intrinsic_scalar_type
ViewDataType< const_scalar_type, scalar_dimension >::type const_scalar_array_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_6() const
OutputView::execution_space execution_space
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
StorageType::value_type ScalarType
KOKKOS_INLINE_FUNCTION void operator()(const size_type i0) const
static KOKKOS_INLINE_FUNCTION size_t memory_span(typename Traits::array_layout const &layout)
Span, in bytes, of the required memory.
ViewArrayAnalysis< DataType > array_analysis
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
KOKKOS_FORCEINLINE_FUNCTION reference_type reference() const
Kokkos::Experimental::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::specialize, ViewPCEContiguous >::value &&(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutStride >::value))>::type, Kokkos::Experimental::ViewTraits< DataType, P... >, Arg0, Args ... >::type Kokkos::Experimental::View< data_type, array_layout, typename SrcTraits::device_type, typename SrcTraits::memory_traits > type
Stokhos::CrsProductTensor< Value, Execution, Memory > type
view_type::traits::dimension dimension
ViewPCEContiguous specialize
KOKKOS_INLINE_FUNCTION constexpr size_t stride_3() const
ViewValueFunctor< ExecSpace, scalar_type > ScalarFunctorType
ConstructDestructFunctor< ExecSpace > create_functor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned pce_size, const cijk_type &cijk) const
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3, const I4 &i4) const
Kokkos::Experimental::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::specialize, ViewPCEContiguous >::value &&(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutStride >::value))>::type, Kokkos::Experimental::ViewTraits< DataType, P... >, Arg0, Args ... >::assign static KOKKOS_INLINE_FUNCTION void assign(ViewMapping< DstTraits, void > &dst, ViewMapping< SrcTraits, void > const &src, Arg0 arg0, Args ... args)
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
ViewType make_view(const std::string &label, size_t N0=0, size_t N1=0, size_t N2=0, size_t N3=0, size_t N4=0, size_t N5=0, size_t N6=0, size_t N7=0)
View< flat_data_type, P... > 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
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< view_type >::value, bool >::type is_allocation_contiguous(const view_type &view)
ViewDataType< scalar_type, scalar_dimension >::type scalar_array_type
ViewDataType< non_const_scalar_type, scalar_dimension >::type non_const_scalar_array_type
ViewCtorProp(const type &arg)
ViewMapping< SrcTraits, void > SrcType
ViewType::non_const_value_type::cijk_type type
KOKKOS_INLINE_FUNCTION constexpr size_t stride_2() const
std::conditional< std::is_same< ArrayLayout, Kokkos::LayoutLeft >::value, prepend_scalar_dimension, append_scalar_dimension >::type scalar_dimension
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_4() const
Kokkos::Experimental::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::specialize, ViewPCEContiguous >::value &&(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutStride >::value))>::type, Kokkos::Experimental::ViewTraits< DataType, P... >, Arg0, Args ... >::traits_type Kokkos::Experimental::ViewTraits< data_type, array_layout, typename SrcTraits::device_type, typename SrcTraits::memory_traits > traits_type
KOKKOS_INLINE_FUNCTION void stride(iType *const s) const
ScalarType non_const_scalar_type
PCEFunctorType m_pce_functor
ViewMapping< SrcTraits, void > SrcType
DeepCopyNonContiguous(const OutputView &arg_out, const InputView &arg_in)
Top-level namespace for Stokhos classes and functions.
sacado_uq_pce_type * pointer_type
Pointer to underlying memory type.
KOKKOS_INLINE_FUNCTION void operator()(const size_t i) const
std::false_type is_regular
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::Experimental::Impl::SharedAllocationTracker TrackType
ConstructDestructFunctor & operator=(const ConstructDestructFunctor &)=default
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_INLINE_FUNCTION constexpr size_t dimension_0() const
array_analysis::non_const_value_type non_const_value_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_3() const
View< D, P... > view_type
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1) const
void destroy_shared_allocation()
array_analysis::value_type value_type
KOKKOS_FORCEINLINE_FUNCTION void set_cijk(const cijk_type &cijk)
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< view_type >::value, typename CijkType< view_type >::type >::type cijk(const view_type &view)
Kokkos::Experimental::Impl::ViewDataType< flat_value_type, dimension >::type flat_data_type
Sacado::ValueType< value_type >::type scalar_type
Kokkos::Experimental::Impl::SharedAllocationTracker TrackType
SharedAllocationRecord * allocate_shared(ViewCtorProp< P... > const &prop, typename Traits::array_layout const &layout)
array_analysis::dimension::template append< 0 >::type append_scalar_dimension
ScalarFunctorType m_scalar_functor
ConstructDestructFunctor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned pce_size, const cijk_type &cijk, scalar_type *scalar_ptr, value_type *value_ptr)
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3, const I4 &i4, const I5 &i5) const
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3) const
Impl::PCEAllocation< sacado_uq_pce_type > handle_type
KOKKOS_INLINE_FUNCTION constexpr size_t extent(const iType &r) const
array_analysis::dimension dimension
PCEConstruct(const ExecSpace &space, value_type *p, scalar_type *sp, const size_t span, const unsigned pce_size, const cijk_type &cijk)
ViewMapping< DstTraits, void > DstType
KOKKOS_INLINE_FUNCTION bool is_data_contiguous() const
ConstructDestructFunctor()=default
KOKKOS_FORCEINLINE_FUNCTION constexpr unsigned dimension_scalar() const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_1() const
sacado_uq_pce_type::storage_type stokhos_storage_type
Kokkos::Experimental::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::specialize, ViewPCEContiguous >::value &&(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutStride >::value))>::type, Kokkos::Experimental::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
view_type::array_type::value_type flat_value_type
ViewMapping< DstTraits, void > DstType
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2) const
array_analysis::dimension::template prepend< 0 >::type prepend_scalar_dimension
KOKKOS_INLINE_FUNCTION std::enable_if< !Impl::ctor_prop_has_cijk< AllocProp >::value, CijkType >::type extract_cijk(const AllocProp &prop)
KOKKOS_INLINE_FUNCTION void set(value_type *ptr, const size_t span, const unsigned pce_size)
std::conditional< is_const, const ScalarType, ScalarType >::type scalar_type
KOKKOS_INLINE_FUNCTION constexpr size_t stride_4() const
Kokkos::Experimental::Impl::SharedAllocationTracker TrackType
array_analysis::const_value_type const_value_type
Kokkos::Experimental::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::specialize, ViewPCEContiguous >::value &&(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutStride >::value))>::type, Kokkos::Experimental::ViewTraits< DataType, P... >, Arg0, Args ... >::SrcTraits Kokkos::Experimental::ViewTraits< DataType, P... > SrcTraits
PCEConstruct & operator=(const PCEConstruct &)=default
ViewDataType< value_type, dimension >::type type
Kokkos::Experimental::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::specialize, ViewPCEContiguous >::value &&(std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutRight >::value||std::is_same< typename Kokkos::Experimental::ViewTraits< DataType, P... >::array_layout, Kokkos::LayoutStride >::value))>::type, Kokkos::Experimental::ViewTraits< DataType, P... >, Arg0, Args ... >::data_type std::conditional< rank==0, sacado_uq_pce_type, typename std::conditional< rank==1, sacado_uq_pce_type *, typename std::conditional< rank==2, sacado_uq_pce_type **, typename std::conditional< rank==3, sacado_uq_pce_type ***, typename std::conditional< rank==4, sacado_uq_pce_type ****, typename std::conditional< rank==5, sacado_uq_pce_type *****, typename std::conditional< rank==6, sacado_uq_pce_type ******, sacado_uq_pce_type *******>::type >::type >::type >::type >::type >::type >::type data_type
KOKKOS_FORCEINLINE_FUNCTION cijk_type cijk() const
ViewDataType< non_const_value_type, dimension >::type non_const_type
ViewDataType< const_value_type, dimension >::type const_type
ViewArrayAnalysis< typename Traits::data_type > array_analysis
ViewOffset< typename array_dimension::template prepend< 0 >::type, typename Traits::array_layout, void > prepend_offset_type
KOKKOS_INLINE_FUNCTION ViewMapping()
KOKKOS_INLINE_FUNCTION constexpr bool span_is_contiguous() const
Is the mapped range span contiguous.
void construct_shared_allocation()
stokhos_storage_type::value_type intrinsic_scalar_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_7() const
View< T, P... > view_type
KOKKOS_INLINE_FUNCTION constexpr size_t stride_0() const
KOKKOS_INLINE_FUNCTION constexpr Traits::array_layout layout() const
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)