42 #ifndef KOKKOS_EXPERIMENTAL_VIEW_UQ_PCE_CONTIGUOUS_HPP 43 #define KOKKOS_EXPERIMENTAL_VIEW_UQ_PCE_CONTIGUOUS_HPP 47 #include "Kokkos_Core_fwd.hpp" 48 #include "Kokkos_View.hpp" 49 #include "Kokkos_Layout.hpp" 60 template <
typename Storage >
68 template<
class Space,
class T,
class ... P>
75 namespace Experimental {
80 template<
class ... Args >
83 template<
class D ,
class ... P ,
class ... Args >
86 std::is_same<
typename Kokkos::ViewTraits<D,P...>::specialize
89 ( (
sizeof...(Args) == 0 ) ||
102 template<
class T ,
class ... P >
104 typename Kokkos::View<T,P...>::HostMirror
106 const Kokkos::View<T,P...> & src,
107 typename std::enable_if<
108 std::is_same<
typename ViewTraits<T,P...>::specialize ,
110 !std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
111 Kokkos::LayoutStride >::value >::type * = 0);
113 template<
class T ,
class ... P >
115 typename Kokkos::View<T,P...>::HostMirror
117 const Kokkos::View<T,P...> & src,
118 typename std::enable_if<
119 std::is_same<
typename ViewTraits<T,P...>::specialize ,
121 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
122 Kokkos::LayoutStride >::value >::type * = 0);
124 template<
class Space,
class T,
class ... P>
125 typename Impl::MirrorType<Space,T,P ...>::view_type
128 const Kokkos::View<T,P...> & src,
129 typename std::enable_if<
130 std::is_same<
typename ViewTraits<T,P...>::specialize ,
134 template<
class DT,
class ... DP >
136 const View<DT,DP...> & view ,
138 ,
typename std::enable_if<(
139 std::is_same<
typename ViewTraits<DT,DP...>::specialize
144 template<
class DT,
class ... DP >
146 const View<DT,DP...> & view ,
148 ,
typename std::enable_if<(
149 std::is_same<
typename ViewTraits<DT,DP...>::specialize
154 template<
class ExecSpace ,
class DT,
class ... DP >
157 const View<DT,DP...> & view ,
159 ,
typename std::enable_if<(
160 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
161 std::is_same<
typename ViewTraits<DT,DP...>::specialize
166 template<
class ExecSpace ,
class DT,
class ... DP >
169 const View<DT,DP...> & view ,
171 ,
typename std::enable_if<(
172 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
173 std::is_same<
typename ViewTraits<DT,DP...>::specialize
178 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
180 void deep_copy(
const View<DT,DP...> & dst ,
181 const View<ST,SP...> & src
182 ,
typename std::enable_if<(
183 std::is_same<
typename ViewTraits<DT,DP...>::specialize
186 std::is_same<
typename ViewTraits<ST,SP...>::specialize
191 template<
class ExecSpace,
class DT ,
class ... DP ,
class ST ,
class ... SP >
194 const View<DT,DP...> & dst ,
195 const View<ST,SP...> & src
196 ,
typename std::enable_if<(
197 std::is_same<
typename ViewTraits<DT,DP...>::specialize
200 std::is_same<
typename ViewTraits<ST,SP...>::specialize
204 template <
typename T,
typename ... P>
208 std::is_same<
typename view_type::specialize,
212 template <
typename ViewType>
214 typename
std::enable_if< is_view_uq_pce< ViewType >::value >
::type > {
215 typedef typename ViewType::non_const_value_type::cijk_type
type;
218 template <
typename T,
typename ... P>
219 KOKKOS_INLINE_FUNCTION
223 return view.impl_map().dimension_scalar();
226 template <
typename view_type>
227 KOKKOS_INLINE_FUNCTION
229 std::enable_if< is_view_uq_pce<view_type>::value,
230 typename CijkType<view_type>::type >::type
232 return view.impl_map().cijk();
235 template <
typename view_type>
236 KOKKOS_INLINE_FUNCTION
238 std::enable_if< is_view_uq_pce<view_type>::value,
bool >::type
240 return view.impl_map().is_allocation_contiguous();
243 template <
typename ViewType>
247 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
248 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
250 return ViewType(view_alloc(label,
cijk),
251 N0, N1, N2, N3, N4, N5, N6, N7);
254 template <
typename ViewType>
257 const Impl::WithoutInitializing_t& init,
259 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
260 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
262 return ViewType(view_alloc(label,init,
cijk),
263 N0, N1, N2, N3, N4, N5, N6, N7);
266 template <
typename ViewType>
270 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
271 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
273 return ViewType(view_alloc(((Kokkos::Impl::ViewCtorProp<void, std::string>)init).value,
276 N0, N1, N2, N3, N4, N5, N6, N7);
279 template <
typename ViewType>
280 typename std::enable_if< is_view_uq_pce<ViewType>::value, ViewType>::type
283 size_t N0 = 0,
size_t N1 = 0,
size_t N2 = 0,
size_t N3 = 0,
284 size_t N4 = 0,
size_t N5 = 0,
size_t N6 = 0,
size_t N7 = 0)
286 size_t N[8] = { N0, N1, N2, N3, N4, N5, N6, N7 };
287 N[ViewType::rank] =
cijk.dimension();
288 ViewType v(view_wrap(ptr,
cijk),
289 N[0], N[1], N[2], N[3], N[4], N[5], N[6], N[7]);
295 #include "Sacado_Traits.hpp" 298 #include "Kokkos_Core.hpp" 302 template <
typename D,
typename ... P>
304 typename
std::enable_if< is_view_uq_pce< View<D,P...> >::value >
::type > {
306 typedef typename view_type::traits::dimension
dimension;
308 typedef typename Kokkos::Impl::ViewDataType< flat_value_type , dimension >::type
flat_data_type;
312 template<
class T ,
class ... P >
314 typename Kokkos::View<T,P...>::HostMirror
316 ,
typename std::enable_if<
317 std::is_same<
typename ViewTraits<T,P...>::specialize ,
320 ! std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
321 , Kokkos::LayoutStride >::value
325 typedef View<T,P...> src_type ;
326 typedef typename src_type::HostMirror dst_type ;
328 typename src_type::array_layout layout = src.layout();
331 return dst_type(view_alloc(std::string(src.label()).append(
"_mirror"),
332 src.impl_map().cijk()), layout);
335 template<
class T ,
class ... P >
337 typename Kokkos::View<T,P...>::HostMirror
339 ,
typename std::enable_if<
340 std::is_same<
typename ViewTraits<T,P...>::specialize ,
343 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
344 , Kokkos::LayoutStride >::value
348 typedef View<T,P...> src_type ;
349 typedef typename src_type::HostMirror dst_type ;
351 Kokkos::LayoutStride layout ;
353 layout.dimension[0] = src.extent(0);
354 layout.dimension[1] = src.extent(1);
355 layout.dimension[2] = src.extent(2);
356 layout.dimension[3] = src.extent(3);
357 layout.dimension[4] = src.extent(4);
358 layout.dimension[5] = src.extent(5);
359 layout.dimension[6] = src.extent(6);
360 layout.dimension[7] = src.extent(7);
362 layout.stride[0] = src.stride_0();
363 layout.stride[1] = src.stride_1();
364 layout.stride[2] = src.stride_2();
365 layout.stride[3] = src.stride_3();
366 layout.stride[4] = src.stride_4();
367 layout.stride[5] = src.stride_5();
368 layout.stride[6] = src.stride_6();
369 layout.stride[7] = src.stride_7();
373 return dst_type(view_alloc(std::string(src.label()).append(
"_mirror"),
374 src.impl_map().cijk()), layout);
377 template<
class Space,
class T,
class ... P>
378 typename Impl::MirrorType<Space,T,P ...>::view_type
380 ,
typename std::enable_if<
381 std::is_same<
typename ViewTraits<T,P...>::specialize ,
384 typedef View<T,P...> src_type ;
385 typename src_type::array_layout layout = src.layout();
388 view_alloc(src.label(), src.impl_map().cijk()),layout);
392 template<
class DT,
class ... DP >
394 const View<DT,DP...> & view ,
396 ,
typename std::enable_if<(
397 std::is_same<
typename ViewTraits<DT,DP...>::specialize
403 typename ViewTraits<DT,DP...>::non_const_value_type >::value
404 ,
"Can only deep copy into non-const type" );
406 typedef View<DT,DP...> view_type;
416 template<
class DT,
class ... DP >
418 const View<DT,DP...> & view ,
420 ,
typename std::enable_if<(
421 std::is_same<
typename ViewTraits<DT,DP...>::specialize
427 typename ViewTraits<DT,DP...>::non_const_value_type >::value
428 ,
"Can only deep copy into non-const type" );
434 template<
class ExecSpace ,
class DT,
class ... DP >
437 const View<DT,DP...> & view ,
439 ,
typename std::enable_if<(
440 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
441 std::is_same<
typename ViewTraits<DT,DP...>::specialize
447 typename ViewTraits<DT,DP...>::non_const_value_type >::value
448 ,
"Can only deep copy into non-const type" );
450 typedef View<DT,DP...> view_type;
460 template<
class ExecSpace ,
class DT,
class ... DP >
463 const View<DT,DP...> & view ,
465 ,
typename std::enable_if<(
466 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
467 std::is_same<
typename ViewTraits<DT,DP...>::specialize
473 typename ViewTraits<DT,DP...>::non_const_value_type >::value
474 ,
"Can only deep copy into non-const type" );
479 namespace Experimental {
484 template<
class OutputView ,
class InputView >
494 const InputView & arg_in ) :
497 parallel_for(
output.extent(0) , *this );
501 KOKKOS_INLINE_FUNCTION
511 output.access(i0,i1,i2,i3,i4,i5,i6,i7) =
input.access(i0,i1,i2,i3,i4,i5,i6,i7) ;
520 template<
class ExecSpace,
class DT ,
class ... DP ,
class ST ,
class ... SP >
523 const View<DT,DP...> & dst ,
524 const View<ST,SP...> & src
525 ,
typename std::enable_if<(
526 std::is_same<
typename ViewTraits<DT,DP...>::specialize
529 std::is_same<
typename ViewTraits<ST,SP...>::specialize
535 typename ViewTraits<DT,DP...>::non_const_value_type >::value
536 ,
"Deep copy destination must be non-const" );
539 (
unsigned(ViewTraits<DT,DP...>::rank) ==
540 unsigned(ViewTraits<ST,SP...>::rank) )
541 ,
"Deep copy destination and source must have same rank" );
543 typedef View<DT,DP...> dst_type ;
544 typedef View<ST,SP...> src_type ;
545 typedef typename dst_type::array_type dst_array_type ;
546 typedef typename src_type::array_type src_array_type ;
549 dst_array_type dst_array = dst ;
550 src_array_type src_array = src ;
551 deep_copy( ExecSpace(), dst_array , src_array );
558 if ( std::is_same<
typename dst_type::memory_space ,
559 typename src_type::memory_space >::value ) {
565 typedef View<
typename src_type::non_const_data_type ,
566 typename src_type::array_layout ,
568 typedef typename tmp_src_type::array_type tmp_src_array_type;
569 typedef View<
typename dst_type::non_const_data_type ,
570 typename dst_type::array_layout ,
572 typedef typename tmp_dst_type::array_type tmp_dst_array_type;
580 src_dims[0] = src.extent(0);
581 src_dims[1] = src.extent(1);
582 src_dims[2] = src.extent(2);
583 src_dims[3] = src.extent(3);
584 src_dims[4] = src.extent(4);
585 src_dims[5] = src.extent(5);
586 src_dims[6] = src.extent(6);
587 src_dims[7] = src.extent(7);
589 tmp_src_type src_tmp(
590 view_alloc(
"src_tmp" , WithoutInitializing,
cijk(src) ) ,
591 src_dims[0], src_dims[1], src_dims[2], src_dims[3],
592 src_dims[4], src_dims[5], src_dims[6], src_dims[7] );
594 dst_array_type dst_array = dst ;
595 tmp_src_array_type src_array = src_tmp ;
596 deep_copy( ExecSpace(), dst_array , src_array );
605 dst_dims[0] = dst.extent(0);
606 dst_dims[1] = dst.extent(1);
607 dst_dims[2] = dst.extent(2);
608 dst_dims[3] = dst.extent(3);
609 dst_dims[4] = dst.extent(4);
610 dst_dims[5] = dst.extent(5);
611 dst_dims[6] = dst.extent(6);
612 dst_dims[7] = dst.extent(7);
614 tmp_dst_type dst_tmp(
615 view_alloc(
"dst_tmp" , WithoutInitializing,
cijk(dst) ) ,
616 dst_dims[0], dst_dims[1], dst_dims[2], dst_dims[3],
617 dst_dims[4], dst_dims[5], dst_dims[6], dst_dims[7] );
618 tmp_dst_array_type dst_array = dst_tmp ;
619 src_array_type src_array = src ;
620 deep_copy( ExecSpace(), dst_array , src_array );
629 src_dims[0] = src.extent(0);
630 src_dims[1] = src.extent(1);
631 src_dims[2] = src.extent(2);
632 src_dims[3] = src.extent(3);
633 src_dims[4] = src.extent(4);
634 src_dims[5] = src.extent(5);
635 src_dims[6] = src.extent(6);
636 src_dims[7] = src.extent(7);
638 tmp_src_type src_tmp(
639 view_alloc(
"src_tmp" , WithoutInitializing,
cijk(src) ) ,
640 src_dims[0], src_dims[1], src_dims[2], src_dims[3],
641 src_dims[4], src_dims[5], src_dims[6], src_dims[7] );
645 dst_dims[0] = dst.extent(0);
646 dst_dims[1] = dst.extent(1);
647 dst_dims[2] = dst.extent(2);
648 dst_dims[3] = dst.extent(3);
649 dst_dims[4] = dst.extent(4);
650 dst_dims[5] = dst.extent(5);
651 dst_dims[6] = dst.extent(6);
652 dst_dims[7] = dst.extent(7);
654 tmp_dst_type dst_tmp(
655 view_alloc(
"dst_tmp" , WithoutInitializing,
cijk(dst) ) ,
656 dst_dims[0], dst_dims[1], dst_dims[2], dst_dims[3],
657 dst_dims[4], dst_dims[5], dst_dims[6], dst_dims[7] );
658 tmp_dst_array_type dst_array = dst_tmp ;
659 tmp_src_array_type src_array = src_tmp ;
660 deep_copy( ExecSpace(), dst_array , src_array );
668 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
671 const View<ST,SP...> & src
672 ,
typename std::enable_if<(
673 std::is_same<
typename ViewTraits<DT,DP...>::specialize
676 std::is_same<
typename ViewTraits<ST,SP...>::specialize
697 template<
typename Value,
typename Execution,
typename Memory >
698 struct ViewCtorProp< void ,
Stokhos::CrsProductTensor<Value, Execution, Memory> >
700 ViewCtorProp() = default ;
701 ViewCtorProp(
const ViewCtorProp & ) = default ;
702 ViewCtorProp & operator = (
const ViewCtorProp & ) = default ;
712 template <
typename AllocProp>
718 template<
typename T >
724 template<
typename Value,
typename Execution,
typename Memory >
726 ViewCtorProp<
Stokhos::CrsProductTensor<Value, Execution, Memory> >
732 template<
typename T,
typename ... P >
743 template <
typename CijkType,
typename AllocProp>
744 KOKKOS_INLINE_FUNCTION
745 typename std::enable_if< !Impl::ctor_prop_has_cijk<AllocProp>::value,
752 template <
typename CijkType,
typename AllocProp>
753 KOKKOS_INLINE_FUNCTION
754 typename std::enable_if< Impl::ctor_prop_has_cijk<AllocProp>::value,
758 return ( (
const Impl::ViewCtorProp<void,CijkType>&) prop ).value;
770 template<
class DataType ,
class ArrayLayout ,
typename StorageType >
771 struct ViewDataAnalysis< DataType
773 ,
Sacado::UQ::PCE< StorageType > >
792 ViewDataType< value_type , dimension >::type
type ;
794 ViewDataType< const_value_type , dimension >::type
const_type ;
801 enum { is_const = std::is_same< value_type , const_value_type >::value };
805 std::conditional< is_const , const ScalarType , ScalarType >::type
812 typedef typename array_analysis::dimension::
813 template prepend<0>::type
815 typedef typename array_analysis::dimension::
816 template append<0>::type
818 typedef typename std::conditional<
819 std::is_same< ArrayLayout, Kokkos::LayoutLeft>::value,
830 ViewDataType< const_scalar_type , scalar_dimension >::type
834 ViewDataType< non_const_scalar_type , scalar_dimension >::type
844 namespace Experimental {
852 template <
class ValueType>
861 KOKKOS_INLINE_FUNCTION
862 static constexpr
size_t 867 KOKKOS_INLINE_FUNCTION
870 template <
typename T>
871 KOKKOS_INLINE_FUNCTION
881 KOKKOS_INLINE_FUNCTION
882 void set(
value_type* ptr,
const size_t span,
const unsigned pce_size) {
887 template <
class ExecSpace>
905 const unsigned pce_size,
911 if ( !
m_space.in_parallel() ) {
912 typedef Kokkos::RangePolicy< ExecSpace > PolicyType ;
913 const Kokkos::Impl::ParallelFor< PCEConstruct , PolicyType >
914 closure( *
this , PolicyType( 0 ,
m_span ) );
919 for (
size_t i = 0 ; i <
m_span ; ++i )
operator()(i);
923 KOKKOS_INLINE_FUNCTION
929 template <
class ExecSpace>
942 const bool initialize,
944 const unsigned pce_size,
979 template <
class ExecSpace>
980 inline ConstructDestructFunctor<ExecSpace>
982 const bool initialize,
984 const unsigned pce_size,
986 return ConstructDestructFunctor<ExecSpace>(space, initialize, span,
993 template <
typename T>
1008 template<
class Traits >
1009 class ViewMapping< Traits ,
1010 typename
std::enable_if<
1011 ( std::is_same< typename Traits::specialize
1012 , Kokkos::Experimental::Impl::ViewPCEContiguous >::value
1014 ( std::is_same< typename Traits::array_layout
1015 , Kokkos::LayoutLeft >::value
1017 std::is_same< typename Traits::array_layout
1018 , Kokkos::LayoutRight >::value
1020 std::is_same< typename Traits::array_layout
1021 , Kokkos::LayoutStride >::value
1024 , typename Traits::specialize
1029 template< class ,
class ... >
friend class ViewMapping ;
1030 template< class ,
class ... >
friend class Kokkos::View ;
1043 typedef ViewOffset<
typename Traits::dimension
1044 ,
typename Traits::array_layout
1051 typedef ViewOffset<
typename array_dimension::
1052 template append<0>::type,
1053 typename Traits::array_layout,
1056 typedef ViewOffset<
typename array_dimension::
1057 template prepend<0>::type,
1058 typename Traits::array_layout,
1061 typedef typename std::conditional<
1062 std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft>::value,
1075 KOKKOS_INLINE_FUNCTION
1077 const size_t sz = this->span();
1083 m_impl_handle.
scalar_ptr + (sz-1)*m_sacado_size;
1084 return last_coeff == last_coeff_expected;
1092 enum { Rank = Traits::dimension::rank };
1095 enum { Sacado_Rank = std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft >::value ? 0 : Rank+1 };
1098 template<
typename iType >
1099 KOKKOS_INLINE_FUNCTION constexpr
size_t extent(
const iType & r )
const 1100 {
return m_impl_offset.m_dim.extent(r); }
1102 KOKKOS_INLINE_FUNCTION constexpr
1104 {
return m_impl_offset.layout(); }
1107 {
return m_impl_offset.dimension_0(); }
1109 {
return m_impl_offset.dimension_1(); }
1111 {
return m_impl_offset.dimension_2(); }
1113 {
return m_impl_offset.dimension_3(); }
1115 {
return m_impl_offset.dimension_4(); }
1117 {
return m_impl_offset.dimension_5(); }
1119 {
return m_impl_offset.dimension_6(); }
1121 {
return m_impl_offset.dimension_7(); }
1128 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_0()
const 1129 {
return m_impl_offset.stride_0(); }
1130 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_1()
const 1131 {
return m_impl_offset.stride_1(); }
1132 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_2()
const 1133 {
return m_impl_offset.stride_2(); }
1134 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_3()
const 1135 {
return m_impl_offset.stride_3(); }
1136 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_4()
const 1137 {
return m_impl_offset.stride_4(); }
1138 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_5()
const 1139 {
return m_impl_offset.stride_5(); }
1140 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_6()
const 1141 {
return m_impl_offset.stride_6(); }
1142 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_7()
const 1143 {
return m_impl_offset.stride_7(); }
1145 template<
typename iType >
1146 KOKKOS_INLINE_FUNCTION
void stride( iType *
const s )
const 1147 { m_impl_offset.stride(s); }
1151 {
return m_sacado_size; }
1154 KOKKOS_FORCEINLINE_FUNCTION
1159 KOKKOS_FORCEINLINE_FUNCTION
1164 KOKKOS_INLINE_FUNCTION
1166 {
return m_is_contiguous; }
1169 static const bool is_static = false ;
1172 static const bool is_contiguous =
true;
1184 KOKKOS_INLINE_FUNCTION constexpr
size_t span()
const 1185 {
return m_impl_offset.span(); }
1189 {
return m_impl_offset.span_is_contiguous() ; }
1197 KOKKOS_FORCEINLINE_FUNCTION
1202 template<
typename I0 >
1203 KOKKOS_FORCEINLINE_FUNCTION
1205 std::enable_if< std::is_integral<I0>::value &&
1206 ! std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
1207 , reference_type >::type
1212 template<
typename I0 >
1213 KOKKOS_FORCEINLINE_FUNCTION
1215 std::enable_if< std::is_integral<I0>::value &&
1216 std::is_same< typename Traits::array_layout , Kokkos::LayoutStride >::value
1217 , reference_type >::type
1219 {
return m_impl_handle.
value_ptr[ m_impl_offset(i0) ]; }
1221 template<
typename I0 ,
typename I1 >
1222 KOKKOS_FORCEINLINE_FUNCTION
1224 {
return m_impl_handle.
value_ptr[ m_impl_offset(i0,i1) ]; }
1226 template<
typename I0 ,
typename I1 ,
typename I2 >
1227 KOKKOS_FORCEINLINE_FUNCTION
1229 {
return m_impl_handle.
value_ptr[ m_impl_offset(i0,i1,i2) ]; }
1231 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3 >
1232 KOKKOS_FORCEINLINE_FUNCTION
1234 {
return m_impl_handle.
value_ptr[ m_impl_offset(i0,i1,i2,i3) ]; }
1236 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1238 KOKKOS_FORCEINLINE_FUNCTION
1240 ,
const I4 & i4 )
const 1241 {
return m_impl_handle.
value_ptr[ m_impl_offset(i0,i1,i2,i3,i4) ]; }
1243 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1244 ,
typename I4 ,
typename I5 >
1245 KOKKOS_FORCEINLINE_FUNCTION
1247 ,
const I4 & i4 ,
const I5 & i5 )
const 1248 {
return m_impl_handle.
value_ptr[ m_impl_offset(i0,i1,i2,i3,i4,i5) ]; }
1250 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1251 ,
typename I4 ,
typename I5 ,
typename I6 >
1252 KOKKOS_FORCEINLINE_FUNCTION
1254 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 )
const 1255 {
return m_impl_handle.
value_ptr[ m_impl_offset(i0,i1,i2,i3,i4,i5,i6) ]; }
1257 template<
typename I0 ,
typename I1 ,
typename I2 ,
typename I3
1258 ,
typename I4 ,
typename I5 ,
typename I6 ,
typename I7 >
1259 KOKKOS_FORCEINLINE_FUNCTION
1261 ,
const I4 & i4 ,
const I5 & i5 ,
const I6 & i6 ,
const I7 & i7 )
const 1262 {
return m_impl_handle.
value_ptr[ m_impl_offset(i0,i1,i2,i3,i4,i5,i6,i7) ]; }
1267 KOKKOS_INLINE_FUNCTION
1268 static size_t memory_span(
typename Traits::array_layout
const & layout )
1271 typedef std::integral_constant< unsigned , 0 > padding ;
1273 unsigned sacado_size =
1275 return handle_type::memory_span( offset.span(), sacado_size );
1280 KOKKOS_DEFAULTED_FUNCTION ~ViewMapping() = default ;
1286 m_is_contiguous(
true)
1289 KOKKOS_DEFAULTED_FUNCTION ViewMapping(
const ViewMapping & ) = default ;
1290 KOKKOS_DEFAULTED_FUNCTION ViewMapping & operator = (
const ViewMapping & ) = default ;
1292 KOKKOS_DEFAULTED_FUNCTION ViewMapping( ViewMapping && ) = default ;
1293 KOKKOS_DEFAULTED_FUNCTION ViewMapping & operator = ( ViewMapping && ) = default ;
1295 template<
class ... P >
1296 KOKKOS_INLINE_FUNCTION
1298 ( ViewCtorProp< P ... >
const & prop
1299 ,
typename Traits::array_layout
const & layout
1302 , m_impl_offset( std::integral_constant< unsigned , 0 >() , layout )
1305 m_impl_handle.
set( ( (ViewCtorProp<void,pointer_type>
const &) prop ).value
1306 , m_impl_offset.span(), m_sacado_size );
1307 m_cijk = extract_cijk<cijk_type>(prop);
1308 #ifndef __CUDA_ARCH__ 1309 if (m_cijk.dimension() == 0)
1310 m_cijk = getGlobalCijkTensor<cijk_type>();
1313 if (m_sacado_size == 0 ||
1314 m_sacado_size ==
unsigned(KOKKOS_IMPL_CTOR_DEFAULT_ARG))
1315 m_sacado_size = m_cijk.dimension();
1317 m_is_contiguous = this->is_data_contiguous();
1321 KOKKOS_INLINE_FUNCTION
1323 { m_impl_handle.
set( arg_ptr, m_impl_offset.span(), m_sacado_size ); }
1330 template<
class ... P >
1331 SharedAllocationRecord<> *
1333 ,
typename Traits::array_layout
const & layout )
1335 typedef ViewCtorProp< P... > ctor_prop ;
1338 typedef typename Traits::memory_space memory_space ;
1339 typedef typename handle_type::template ConstructDestructFunctor<execution_space> functor_type ;
1340 typedef SharedAllocationRecord< memory_space , functor_type > record_type ;
1343 typedef std::integral_constant< unsigned , 0 > padding ;
1347 m_cijk = extract_cijk<cijk_type>(prop);
1348 if (m_cijk.dimension() == 0)
1349 m_cijk = getGlobalCijkTensor<cijk_type>();
1352 if (m_sacado_size == 0 ||
1353 m_sacado_size ==
unsigned(KOKKOS_IMPL_CTOR_DEFAULT_ARG))
1354 m_sacado_size = m_cijk.dimension();
1355 m_is_contiguous =
true;
1357 const size_t alloc_size =
1358 handle_type::memory_span( m_impl_offset.span(), m_sacado_size );
1361 record_type *
const record =
1362 record_type::allocate( ( (ViewCtorProp<void,memory_space>
const &) prop ).value
1363 , ( (ViewCtorProp<void,std::string>
const &) prop ).value
1370 m_impl_handle.
set( reinterpret_cast< pointer_type >( record->data() ),
1371 m_impl_offset.span(), m_sacado_size );
1376 ( (ViewCtorProp<void,execution_space>
const &) prop).value
1377 , ctor_prop::initialize
1378 , m_impl_offset.span()
1383 record->m_destroy.construct_shared_allocation();
1403 template<
class DstTraits ,
class SrcTraits >
1404 class ViewMapping< DstTraits , SrcTraits ,
1405 typename
std::enable_if<(
1406 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1407 , typename SrcTraits::memory_space >::assignable
1410 std::is_same< typename DstTraits::specialize
1411 , Kokkos::Experimental::Impl::ViewPCEContiguous >::value
1414 std::is_same< typename SrcTraits::specialize
1415 , Kokkos::Experimental::Impl::ViewPCEContiguous >::value
1417 , typename DstTraits::specialize
1422 enum { is_assignable =
true };
1423 enum { is_assignable_data_type =
true };
1426 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1427 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1429 KOKKOS_INLINE_FUNCTION
static 1436 std::is_same<
typename DstTraits::array_layout
1437 , Kokkos::LayoutLeft >::value ||
1438 std::is_same<
typename DstTraits::array_layout
1439 , Kokkos::LayoutRight >::value ||
1440 std::is_same<
typename DstTraits::array_layout
1441 , Kokkos::LayoutStride >::value
1445 std::is_same<
typename SrcTraits::array_layout
1446 , Kokkos::LayoutLeft >::value ||
1447 std::is_same<
typename SrcTraits::array_layout
1448 , Kokkos::LayoutRight >::value ||
1449 std::is_same<
typename SrcTraits::array_layout
1450 , Kokkos::LayoutStride >::value
1452 ,
"View of UQ::PCE requires LayoutLeft, LayoutRight, or LayoutStride" );
1455 std::is_same<
typename DstTraits::array_layout
1456 ,
typename SrcTraits::array_layout >::value ||
1457 std::is_same<
typename DstTraits::array_layout
1458 , Kokkos::LayoutStride >::value ||
1459 (
unsigned(DstTraits::rank) == 1 &&
unsigned(SrcTraits::rank) == 1 ) ,
1460 "View assignment must have compatible layout" );
1466 ,
typename SrcTraits::const_value_type >::value ,
1467 "View assignment must have same value type or const = non-const" );
1470 ViewDimensionAssignable
1471 <
typename DstType::offset_type::dimension_type
1472 ,
typename SrcType::offset_type::dimension_type >::value ,
1473 "View assignment must have compatible dimensions" );
1475 dst.m_impl_handle = src.m_impl_handle ;
1476 dst.m_impl_offset = src.m_impl_offset ;
1477 dst.m_sacado_size = src.m_sacado_size ;
1478 dst.m_cijk = src.m_cijk ;
1479 dst.m_is_contiguous = src.m_is_contiguous ;
1488 template<
class DstTraits ,
class SrcTraits >
1489 class ViewMapping< DstTraits , SrcTraits ,
1490 typename
std::enable_if<(
1491 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1492 , typename SrcTraits::memory_space >::assignable
1495 std::is_same< typename DstTraits::specialize , void >::value
1498 std::is_same< typename SrcTraits::specialize
1499 , Kokkos::Experimental::Impl::ViewPCEContiguous >::value
1502 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)+1
1504 , typename DstTraits::specialize
1509 enum { is_assignable =
true };
1510 enum { is_assignable_data_type =
true };
1513 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1514 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1516 KOKKOS_INLINE_FUNCTION
static 1523 std::is_same<
typename DstTraits::array_layout
1524 , Kokkos::LayoutLeft >::value ||
1525 std::is_same<
typename DstTraits::array_layout
1526 , Kokkos::LayoutRight >::value ||
1527 std::is_same<
typename DstTraits::array_layout
1528 , Kokkos::LayoutStride >::value
1532 std::is_same<
typename SrcTraits::array_layout
1533 , Kokkos::LayoutLeft >::value ||
1534 std::is_same<
typename SrcTraits::array_layout
1535 , Kokkos::LayoutRight >::value ||
1536 std::is_same<
typename SrcTraits::array_layout
1537 , Kokkos::LayoutStride >::value
1539 ,
"View of UQ::PCE requires LayoutLeft, LayoutRight, or LayoutStride" );
1542 std::is_same<
typename DstTraits::array_layout
1543 ,
typename SrcTraits::array_layout >::value ||
1544 std::is_same<
typename DstTraits::array_layout
1545 , Kokkos::LayoutStride >::value ,
1546 "View assignment must have compatible layout" );
1549 std::is_same<
typename DstTraits::scalar_array_type
1550 ,
typename SrcTraits::scalar_array_type >::value ||
1551 std::is_same<
typename DstTraits::scalar_array_type
1552 ,
typename SrcTraits::const_scalar_array_type >::value ,
1553 "View assignment must have same value type or const = non-const" );
1556 ViewDimensionAssignable<
1557 typename DstType::offset_type::dimension_type,
1558 typename SrcType::array_offset_type::dimension_type >::value,
1559 "View assignment must have compatible dimensions" );
1561 if ( !src.m_is_contiguous )
1562 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::UQ::PCE ... >: can't assign non-contiguous view ******\n\n");
1565 dims[0] = src.m_impl_offset.dimension_0();
1566 dims[1] = src.m_impl_offset.dimension_1();
1567 dims[2] = src.m_impl_offset.dimension_2();
1568 dims[3] = src.m_impl_offset.dimension_3();
1569 dims[4] = src.m_impl_offset.dimension_4();
1570 dims[5] = src.m_impl_offset.dimension_5();
1571 dims[6] = src.m_impl_offset.dimension_6();
1572 dims[7] = src.m_impl_offset.dimension_7();
1573 unsigned rank = SrcTraits::dimension::rank;
1574 unsigned sacado_size = src.m_sacado_size;
1575 if (std::is_same<typename SrcTraits::array_layout, LayoutLeft>::value) {
1577 for (
unsigned i=rank; i>0; --i)
1578 dims[i] = dims[i-1];
1579 dims[0] = sacado_size;
1582 dims[rank] = sacado_size;
1584 typedef typename DstType::offset_type dst_offset_type;
1585 dst.m_impl_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1586 typename DstTraits::array_layout(
1587 dims[0] , dims[1] , dims[2] , dims[3] ,
1588 dims[4] , dims[5] , dims[6] , dims[7] ) );
1589 dst.m_impl_handle = src.m_impl_handle.scalar_ptr ;
1599 template<
class DstTraits ,
class SrcTraits >
1600 class ViewMapping< DstTraits , SrcTraits ,
1601 typename
std::enable_if<(
1602 Kokkos::Impl::MemorySpaceAccess< typename DstTraits::memory_space
1603 , typename SrcTraits::memory_space >::assignable
1606 std::is_same< typename DstTraits::specialize , void >::value
1609 std::is_same< typename SrcTraits::specialize
1610 , Kokkos::Experimental::Impl::ViewPCEContiguous >::value
1613 unsigned(DstTraits::dimension::rank) == unsigned(SrcTraits::dimension::rank)
1615 , typename DstTraits::specialize
1620 enum { is_assignable =
true };
1621 enum { is_assignable_data_type =
true };
1624 typedef ViewMapping< DstTraits , typename DstTraits::specialize >
DstType ;
1625 typedef ViewMapping< SrcTraits , typename SrcTraits::specialize >
SrcType ;
1627 KOKKOS_INLINE_FUNCTION
static 1634 std::is_same<
typename DstTraits::array_layout
1635 , Kokkos::LayoutLeft >::value ||
1636 std::is_same<
typename DstTraits::array_layout
1637 , Kokkos::LayoutRight >::value ||
1638 std::is_same<
typename DstTraits::array_layout
1639 , Kokkos::LayoutStride >::value
1643 std::is_same<
typename SrcTraits::array_layout
1644 , Kokkos::LayoutLeft >::value ||
1645 std::is_same<
typename SrcTraits::array_layout
1646 , Kokkos::LayoutRight >::value ||
1647 std::is_same<
typename SrcTraits::array_layout
1648 , Kokkos::LayoutStride >::value
1650 ,
"View of UQ::PCE requires LayoutLeft, LayoutRight, or LayoutStride" );
1653 std::is_same<
typename DstTraits::array_layout
1654 ,
typename SrcTraits::array_layout >::value ||
1655 std::is_same<
typename DstTraits::array_layout
1656 , Kokkos::LayoutStride >::value ,
1657 "View assignment must have compatible layout" );
1664 "View assignment must have same value type or const = non-const" );
1667 ViewDimensionAssignable<
1668 typename DstType::offset_type::dimension_type,
1669 typename SrcType::offset_type::dimension_type >::value,
1670 "View assignment must have compatible dimensions" );
1672 if ( !src.m_is_contiguous )
1673 Kokkos::abort(
"\n\n ****** Kokkos::View< Sacado::UQ::PCE ... >: can't assign non-contiguous view ******\n\n");
1676 dims[0] = src.m_impl_offset.dimension_0();
1677 dims[1] = src.m_impl_offset.dimension_1();
1678 dims[2] = src.m_impl_offset.dimension_2();
1679 dims[3] = src.m_impl_offset.dimension_3();
1680 dims[4] = src.m_impl_offset.dimension_4();
1681 dims[5] = src.m_impl_offset.dimension_5();
1682 dims[6] = src.m_impl_offset.dimension_6();
1683 dims[7] = src.m_impl_offset.dimension_7();
1684 unsigned rank = SrcTraits::dimension::rank;
1685 unsigned sacado_size = src.m_sacado_size;
1686 if (std::is_same<typename DstTraits::array_layout, LayoutLeft>::value) {
1687 dims[0] = dims[0]*sacado_size;
1691 dims[rank-1] = dims[rank-1]*sacado_size;
1694 typedef typename DstType::offset_type dst_offset_type;
1695 dst.m_impl_offset = dst_offset_type( std::integral_constant< unsigned , 0 >(),
1696 typename DstTraits::array_layout(
1697 dims[0] , dims[1] , dims[2] , dims[3] ,
1698 dims[4] , dims[5] , dims[6] , dims[7] ) );
1699 dst.m_impl_handle = src.m_impl_handle.scalar_ptr ;
1713 template<
class DataType,
class ... P ,
class Arg0,
class ... Args >
1715 < typename
std::enable_if<(
1717 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::specialize
1718 , Kokkos::Experimental::Impl::ViewPCEContiguous >::value
1721 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1722 , Kokkos::LayoutLeft >::value ||
1723 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1724 , Kokkos::LayoutRight >::value ||
1725 std::is_same< typename Kokkos::ViewTraits<DataType,P...>::array_layout
1726 , Kokkos::LayoutStride >::value
1729 , Kokkos::ViewTraits<DataType,P...>
1740 , R0 = bool(is_integral_extent<0,Arg0,Args...>::value)
1741 , R1 = bool(is_integral_extent<1,Arg0,Args...>::value)
1742 , R2 = bool(is_integral_extent<2,Arg0,Args...>::value)
1743 , R3 = bool(is_integral_extent<3,Arg0,Args...>::value)
1744 , R4 = bool(is_integral_extent<4,Arg0,Args...>::value)
1745 , R5 = bool(is_integral_extent<5,Arg0,Args...>::value)
1746 , R6 = bool(is_integral_extent<6,Arg0,Args...>::value)
1750 enum { rank = unsigned(R0) + unsigned(R1) + unsigned(R2) + unsigned(R3)
1751 + unsigned(R4) + unsigned(R5) + unsigned(R6) };
1754 enum { R0_rev = ( 0 == SrcTraits::rank ? RZ : (
1755 1 == SrcTraits::rank ? R0 : (
1756 2 == SrcTraits::rank ? R1 : (
1757 3 == SrcTraits::rank ? R2 : (
1758 4 == SrcTraits::rank ? R3 : (
1759 5 == SrcTraits::rank ? R4 : (
1760 6 == SrcTraits::rank ? R5 : R6 ))))))) };
1763 typedef typename std::conditional<
1769 ( rank <= 2 && R0 && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutLeft >::value )
1773 ( rank <= 2 && R0_rev && std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutRight >::value )
1774 ),
typename SrcTraits::array_layout , Kokkos::LayoutStride
1792 typedef Kokkos::ViewTraits
1795 ,
typename SrcTraits::device_type
1798 typedef Kokkos::View
1801 ,
typename SrcTraits::device_type
1802 ,
typename SrcTraits::memory_traits >
type ;
1807 template<
class DstTraits >
1808 KOKKOS_INLINE_FUNCTION
1809 static void assign( ViewMapping< DstTraits , typename DstTraits::specialize > & dst
1810 , ViewMapping< SrcTraits , typename SrcTraits::specialize >
const & src
1811 , Arg0 arg0, Args ... args )
1814 ViewMapping< DstTraits , traits_type , typename DstTraits::specialize >::is_assignable ,
1815 "Subview destination type must be compatible with subview derived type" );
1817 typedef ViewMapping< DstTraits , typename DstTraits::specialize > DstType ;
1818 typedef typename DstType::offset_type dst_offset_type ;
1820 const SubviewExtents< SrcTraits::rank , rank >
1821 extents( src.m_impl_offset.m_dim , arg0 , args... );
1823 const size_t offset = src.m_impl_offset( extents.domain_offset(0)
1824 , extents.domain_offset(1)
1825 , extents.domain_offset(2)
1826 , extents.domain_offset(3)
1827 , extents.domain_offset(4)
1828 , extents.domain_offset(5)
1829 , extents.domain_offset(6)
1830 , extents.domain_offset(7) );
1832 dst.m_impl_offset = dst_offset_type( src.m_impl_offset , extents );
1833 dst.m_impl_handle.value_ptr = src.m_impl_handle.value_ptr + offset;
1834 dst.m_impl_handle.scalar_ptr =
1835 src.m_impl_handle.scalar_ptr + offset * src.m_sacado_size;
1836 dst.m_sacado_size = src.m_sacado_size;
1837 dst.m_cijk = src.m_cijk;
1838 dst.m_is_contiguous = src.m_is_contiguous;
1854 #if defined( KOKKOS_ENABLE_CUDA ) 1855 template<
class OutputView >
1856 struct StokhosViewFill< OutputView ,
1857 typename
std::enable_if< std::is_same< typename OutputView::specialize,
1858 Kokkos::Experimental::Impl::ViewPCEContiguous >::value &&
1859 std::is_same< typename OutputView::execution_space,
1860 Cuda >::value >::type >
1863 typedef typename Sacado::ScalarType<const_value_type>::type
scalar_type ;
1865 typedef typename OutputView::size_type size_type ;
1867 template <
unsigned VectorLength>
1876 typedef typename Kokkos::TeamPolicy< execution_space >::member_type team_member ;
1878 KOKKOS_INLINE_FUNCTION
1879 void operator()(
const team_member & dev )
const 1881 const size_type tidx = dev.team_rank() % VectorLength;
1882 const size_type tidy = dev.team_rank() / VectorLength;
1883 const size_type nrow = dev.team_size() / VectorLength;
1886 const size_type i0 = dev.league_rank() * nrow + tidy;
1887 if ( i0 >=
output.extent(0) )
return;
1889 for ( size_type i1 = 0 ; i1 <
output.extent(1) ; ++i1 ) {
1890 for ( size_type i2 = 0 ; i2 <
output.extent(2) ; ++i2 ) {
1891 for ( size_type i3 = 0 ; i3 <
output.extent(3) ; ++i3 ) {
1892 for ( size_type i4 = 0 ; i4 <
output.extent(4) ; ++i4 ) {
1893 for ( size_type i5 = 0 ; i5 <
output.extent(5) ; ++i5 ) {
1894 for ( size_type i6 = 0 ; i6 <
output.extent(6) ; ++i6 ) {
1895 for ( size_type i7 = 0 ; i7 <
output.extent(7) ; ++i7 ) {
1896 for ( size_type is = tidx ; is < nvec ; is+=VectorLength ) {
1897 output.access(i0,i1,i2,i3,i4,i5,i6,i7).fastAccessCoeff(is) =
1898 input.fastAccessCoeff(is) ;
1903 template <
unsigned VectorLength>
1904 struct ScalarKernel {
1909 ScalarKernel(
const OutputView & arg_out ,
const scalar_type & arg_in ) :
1912 typedef typename Kokkos::TeamPolicy< execution_space >::member_type team_member ;
1913 KOKKOS_INLINE_FUNCTION
1914 void operator()(
const team_member & dev )
const 1916 const size_type tidx = dev.team_rank() % VectorLength;
1917 const size_type tidy = dev.team_rank() / VectorLength;
1918 const size_type nrow = dev.team_size() / VectorLength;
1921 const size_type i0 = dev.league_rank() * nrow + tidy;
1922 if ( i0 >=
output.extent(0) )
return;
1924 for ( size_type i1 = 0 ; i1 <
output.extent(1) ; ++i1 ) {
1925 for ( size_type i2 = 0 ; i2 <
output.extent(2) ; ++i2 ) {
1926 for ( size_type i3 = 0 ; i3 <
output.extent(3) ; ++i3 ) {
1927 for ( size_type i4 = 0 ; i4 <
output.extent(4) ; ++i4 ) {
1928 for ( size_type i5 = 0 ; i5 <
output.extent(5) ; ++i5 ) {
1929 for ( size_type i6 = 0 ; i6 <
output.extent(6) ; ++i6 ) {
1930 for ( size_type i7 = 0 ; i7 <
output.extent(7) ; ++i7 ) {
1931 for ( size_type is = tidx ; is < npce ; is+=VectorLength ) {
1932 output.access(i0,i1,i2,i3,i4,i5,i6,i7).fastAccessCoeff(is) =
1942 const unsigned vector_length =
1946 const size_type block_size = 256;
1948 const size_type rows_per_block = block_size / vector_length;
1949 const size_type n =
output.extent(0);
1950 const size_type league_size = ( n + rows_per_block-1 ) / rows_per_block;
1951 const size_type team_size = rows_per_block * vector_length;
1952 Kokkos::TeamPolicy< execution_space > config( league_size, team_size );
1956 Kokkos::abort(
"StokhosViewFill: Invalid input value size");
1958 if (
input.size() == 1)
1960 config, ScalarKernel<vector_length>(
output,
input.fastAccessCoeff(0)) );
1962 parallel_for( config, PCEKernel<vector_length>(
output,
input) );
1970 const unsigned vector_length =
1974 const size_type block_size = 256;
1976 const size_type rows_per_block = block_size / vector_length;
1977 const size_type n =
output.extent(0);
1978 const size_type league_size = ( n + rows_per_block-1 ) / rows_per_block;
1979 const size_type team_size = rows_per_block * vector_length;
1980 Kokkos::TeamPolicy< execution_space > config( league_size, team_size );
1982 parallel_for( config, ScalarKernel<vector_length>(
output,
input) );
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
execution_space::size_type size_type
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_2() const
handle_type m_impl_handle
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
KOKKOS_INLINE_FUNCTION constexpr size_t stride_1() const
KOKKOS_INLINE_FUNCTION bool is_data_contiguous() const
static KOKKOS_INLINE_FUNCTION constexpr size_t memory_span(const size_t span, const unsigned pce_size)
ViewArrayAnalysis< DataType > array_analysis
array_analysis::value_type value_type
Stokhos::StandardStorage< int, double > storage_type
PCEConstruct< ExecSpace > PCEFunctorType
KOKKOS_INLINE_FUNCTION constexpr bool span_is_contiguous() const
Is the mapped range span contiguous.
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_5() const
KOKKOS_INLINE_FUNCTION PCEAllocation()
Kokkos::Impl::SharedAllocationTracker TrackType
KOKKOS_INLINE_FUNCTION PCEAllocation & operator=(const PCEAllocation< T > &a)
ViewArrayAnalysis< typename Traits::data_type > array_analysis
Kokkos::Impl::SharedAllocationTracker TrackType
sacado_uq_pce_type::cijk_type cijk_type
array_analysis::dimension array_dimension
Kokkos::DefaultExecutionSpace execution_space
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_1() const
ViewDataType< scalar_type, scalar_dimension >::type scalar_array_type
value_type::cijk_type cijk_type
ViewOffset< typename array_dimension::template prepend< 0 >::type, typename Traits::array_layout, void > prepend_offset_type
stokhos_storage_type::value_type intrinsic_scalar_type
Kokkos::Impl::SharedAllocationTracker TrackType
OutputView::execution_space execution_space
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
const ScalarType const_scalar_type
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P... >::specialize, Kokkos::Experimental::Impl::ViewPCEContiguous >::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))>::type, Kokkos::ViewTraits< DataType, P... >, Arg0, Args ... >::sacado_uq_pce_type SrcTraits::value_type sacado_uq_pce_type
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
KOKKOS_INLINE_FUNCTION constexpr size_t stride_5() const
ViewDataType< non_const_value_type, dimension >::type non_const_type
ScalarType non_const_scalar_type
KOKKOS_INLINE_FUNCTION void operator()(const size_type i0) const
Stokhos::CrsProductTensor< Value, Execution, Memory > type
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P... >::specialize, Kokkos::Experimental::Impl::ViewPCEContiguous >::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))>::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
ViewOffset< typename Traits::dimension, typename Traits::array_layout, void > offset_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
view_type::traits::dimension dimension
ConstructDestructFunctor< ExecSpace > create_functor(const ExecSpace &space, const bool initialize, const size_t span, const unsigned pce_size, const cijk_type &cijk) const
ViewDataType< const_value_type, dimension >::type const_type
StorageType::value_type ScalarType
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_3() const
ViewMapping< DstTraits, typename DstTraits::specialize > DstType
View< flat_data_type, P... > type
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)
ViewDataType< non_const_scalar_type, scalar_dimension >::type non_const_scalar_array_type
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< view_type >::value, bool >::type is_allocation_contiguous(const view_type &view)
array_analysis::non_const_value_type non_const_value_type
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
ViewCtorProp(const type &arg)
KOKKOS_INLINE_FUNCTION constexpr size_t stride_7() const
KOKKOS_INLINE_FUNCTION constexpr pointer_type data() const
Raw data access.
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3, const I4 &i4, const I5 &i5, const I6 &i6, const I7 &i7) const
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_4() const
OutputView::const_value_type const_value_type
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P... >::specialize, Kokkos::Experimental::Impl::ViewPCEContiguous >::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))>::type, Kokkos::ViewTraits< DataType, P... >, Arg0, Args ... >::type Kokkos::View< data_type, array_layout, typename SrcTraits::device_type, typename SrcTraits::memory_traits > type
ViewOffset< typename array_dimension::template append< 0 >::type, typename Traits::array_layout, void > append_offset_type
array_analysis::dimension dimension
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P... >::specialize, Kokkos::Experimental::Impl::ViewPCEContiguous >::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))>::type, Kokkos::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
ViewType::non_const_value_type::cijk_type type
array_analysis::dimension::template prepend< 0 >::type prepend_scalar_dimension
std::conditional< is_const, const ScalarType, ScalarType >::type scalar_type
KOKKOS_INLINE_FUNCTION constexpr Traits::array_layout layout() const
array_analysis::dimension::template append< 0 >::type append_scalar_dimension
KOKKOS_INLINE_FUNCTION constexpr size_t stride_0() const
ViewMapping< SrcTraits, typename SrcTraits::specialize > SrcType
ViewDataType< const_scalar_type, scalar_dimension >::type const_scalar_array_type
sacado_uq_pce_type::storage_type stokhos_storage_type
sacado_uq_pce_type & reference_type
offset_type m_impl_offset
KOKKOS_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1, const I2 &i2, const I3 &i3, const I4 &i4) const
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const TrackType &)
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_0() const
PCEFunctorType m_pce_functor
DeepCopyNonContiguous(const OutputView &arg_out, const InputView &arg_in)
KOKKOS_INLINE_FUNCTION constexpr size_t span() const
Span of the mapped range : [ data() .. data() + span() )
Top-level namespace for Stokhos classes and functions.
KOKKOS_INLINE_FUNCTION void operator()(const size_t i) const
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::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P... >::specialize, Kokkos::Experimental::Impl::ViewPCEContiguous >::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))>::type, Kokkos::ViewTraits< DataType, P... >, Arg0, Args ... >::array_layout std::conditional<((rank==0)||(rank<=2 &&R0 &&std::is_same< typename SrcTraits::array_layout, Kokkos::LayoutLeft >::value)||(rank<=2 &&R0_rev &&std::is_same< typename SrcTraits::array_layout, Kokkos::LayoutRight >::value)), typename SrcTraits::array_layout, Kokkos::LayoutStride >::type array_layout
Kokkos::Experimental::Impl::PCEAllocation< sacado_uq_pce_type > handle_type
OutputView::execution_space execution_space
KOKKOS_INLINE_FUNCTION void operator()(const size_t i0) const
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< std::is_integral< I0 >::value &&std::is_same< typename Traits::array_layout, Kokkos::LayoutStride >::value, reference_type >::type reference(const I0 &i0) const
static KOKKOS_INLINE_FUNCTION void assign(DstType &dst, const SrcType &src, const 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 void stride(iType *const s) const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_3() 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_6() 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 I4 &i4, const I5 &i5) const
KOKKOS_INLINE_FUNCTION constexpr size_t stride_4() const
StokhosViewFill(const OutputView &arg_out, const_value_type &arg_in)
std::add_const< intrinsic_scalar_type >::type const_intrinsic_scalar_type
View< D, P... > view_type
KOKKOS_FORCEINLINE_FUNCTION void set_cijk(const cijk_type &cijk)
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
void destroy_shared_allocation()
KOKKOS_INLINE_FUNCTION void assign_data(pointer_type arg_ptr)
Assign data.
Kokkos::Impl::ViewValueFunctor< ExecSpace, scalar_type > ScalarFunctorType
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_FORCEINLINE_FUNCTION reference_type reference(const I0 &i0, const I1 &i1) const
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P... >::specialize, Kokkos::Experimental::Impl::ViewPCEContiguous >::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))>::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)
std::conditional< std::is_same< typename Traits::array_layout, Kokkos::LayoutLeft >::value, prepend_offset_type, append_offset_type >::type array_offset_type
Sacado::ValueType< value_type >::type scalar_type
Kokkos::Impl::ViewMapping< typename std::enable_if<(std::is_same< typename Kokkos::ViewTraits< DataType, P... >::specialize, Kokkos::Experimental::Impl::ViewPCEContiguous >::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))>::type, Kokkos::ViewTraits< DataType, P... >, Arg0, Args ... >::SrcTraits Kokkos::ViewTraits< DataType, P... > SrcTraits
ScalarFunctorType m_scalar_functor
Kokkos::Experimental::Impl::ViewPCEContiguous specialize
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)
static KOKKOS_INLINE_FUNCTION size_t memory_span(typename Traits::array_layout const &layout)
Span, in bytes, of the required memory.
ViewDataType< value_type, dimension >::type type
KOKKOS_INLINE_FUNCTION ViewMapping()
std::false_type is_regular
PCEConstruct(const ExecSpace &space, value_type *p, scalar_type *sp, const size_t span, const unsigned pce_size, const cijk_type &cijk)
KOKKOS_INLINE_FUNCTION constexpr size_t stride_2() const
KOKKOS_FORCEINLINE_FUNCTION reference_type reference() const
Kokkos::Impl::ViewDataType< flat_value_type, dimension >::type flat_data_type
ConstructDestructFunctor()=default
SharedAllocationRecord * allocate_shared(ViewCtorProp< P... > const &prop, typename Traits::array_layout const &layout)
view_type::array_type::value_type flat_value_type
Traits::value_type sacado_uq_pce_type
KOKKOS_FORCEINLINE_FUNCTION constexpr unsigned dimension_scalar() const
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< std::is_same< ArrayLayout, Kokkos::LayoutLeft >::value, prepend_scalar_dimension, append_scalar_dimension >::type scalar_dimension
KOKKOS_INLINE_FUNCTION bool is_allocation_contiguous() const
KOKKOS_FORCEINLINE_FUNCTION cijk_type cijk() const
PCEConstruct & operator=(const PCEConstruct &)=default
KOKKOS_INLINE_FUNCTION constexpr size_t extent(const iType &r) const
Stokhos::CrsMatrix< ValueType, Device, Layout >::HostMirror create_mirror(const Stokhos::CrsMatrix< ValueType, Device, Layout > &A)
array_analysis::const_value_type const_value_type
sacado_uq_pce_type * pointer_type
Pointer to underlying memory type.
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_7() const
KOKKOS_INLINE_FUNCTION constexpr size_t dimension_6() const
void construct_shared_allocation()
View< T, P... > view_type