63 #ifndef KOKKOS_DYNRANKVIEW_HPP 64 #define KOKKOS_DYNRANKVIEW_HPP 66 #include <Kokkos_Core.hpp> 67 #include <impl/Kokkos_Error.hpp> 68 #include <type_traits> 73 template<
typename DataType ,
class ... Properties >
78 template <
typename Specialize>
79 struct DynRankDimTraits {
81 enum :
size_t{unspecified = ~size_t(0)};
84 KOKKOS_INLINE_FUNCTION
85 static size_t computeRank(
const size_t N0
95 ( (N6 == unspecified && N5 == unspecified && N4 == unspecified && N3 == unspecified && N2 == unspecified && N1 == unspecified && N0 == unspecified) ? 0
96 : ( (N6 == unspecified && N5 == unspecified && N4 == unspecified && N3 == unspecified && N2 == unspecified && N1 == unspecified) ? 1
97 : ( (N6 == unspecified && N5 == unspecified && N4 == unspecified && N3 == unspecified && N2 == unspecified) ? 2
98 : ( (N6 == unspecified && N5 == unspecified && N4 == unspecified && N3 == unspecified) ? 3
99 : ( (N6 == unspecified && N5 == unspecified && N4 == unspecified) ? 4
100 : ( (N6 == unspecified && N5 == unspecified) ? 5
101 : ( (N6 == unspecified) ? 6
106 template <
typename Layout>
107 KOKKOS_INLINE_FUNCTION
108 static size_t computeRank(
const Layout& layout )
110 return computeRank( layout.dimension[0]
111 , layout.dimension[1]
112 , layout.dimension[2]
113 , layout.dimension[3]
114 , layout.dimension[4]
115 , layout.dimension[5]
116 , layout.dimension[6]
117 , layout.dimension[7] );
122 template <
typename Layout>
123 KOKKOS_INLINE_FUNCTION
124 static typename std::enable_if< (std::is_same<Layout , Kokkos::LayoutRight>::value || std::is_same<Layout , Kokkos::LayoutLeft>::value) , Layout >::type createLayout(
const Layout& layout )
126 return Layout( layout.dimension[0] != unspecified ? layout.dimension[0] : 1
127 , layout.dimension[1] != unspecified ? layout.dimension[1] : 1
128 , layout.dimension[2] != unspecified ? layout.dimension[2] : 1
129 , layout.dimension[3] != unspecified ? layout.dimension[3] : 1
130 , layout.dimension[4] != unspecified ? layout.dimension[4] : 1
131 , layout.dimension[5] != unspecified ? layout.dimension[5] : 1
132 , layout.dimension[6] != unspecified ? layout.dimension[6] : 1
133 , layout.dimension[7] != unspecified ? layout.dimension[7] : 1
138 template <
typename Layout>
139 KOKKOS_INLINE_FUNCTION
140 static typename std::enable_if< (std::is_same<Layout , Kokkos::LayoutStride>::value) , Layout>::type createLayout(
const Layout& layout )
142 return Layout( layout.dimension[0] != unspecified ? layout.dimension[0] : 1
144 , layout.dimension[1] != unspecified ? layout.dimension[1] : 1
146 , layout.dimension[2] != unspecified ? layout.dimension[2] : 1
148 , layout.dimension[3] != unspecified ? layout.dimension[3] : 1
150 , layout.dimension[4] != unspecified ? layout.dimension[4] : 1
152 , layout.dimension[5] != unspecified ? layout.dimension[5] : 1
154 , layout.dimension[6] != unspecified ? layout.dimension[6] : 1
156 , layout.dimension[7] != unspecified ? layout.dimension[7] : 1
163 template <
typename ViewType,
typename ViewArg>
164 static ViewType createView(
const ViewArg& arg
175 , N0 != unspecified ? N0 : 1
176 , N1 != unspecified ? N1 : 1
177 , N2 != unspecified ? N2 : 1
178 , N3 != unspecified ? N3 : 1
179 , N4 != unspecified ? N4 : 1
180 , N5 != unspecified ? N5 : 1
181 , N6 != unspecified ? N6 : 1
182 , N7 != unspecified ? N7 : 1 );
187 template <
typename Layout ,
typename iType>
188 KOKKOS_INLINE_FUNCTION
189 static typename std::enable_if< (std::is_same<Layout , Kokkos::LayoutRight>::value || std::is_same<Layout , Kokkos::LayoutLeft>::value) && std::is_integral<iType>::value , Layout >::type reconstructLayout(
const Layout& layout , iType dynrank )
191 return Layout( dynrank > 0 ? layout.dimension[0] : ~
size_t(0)
192 , dynrank > 1 ? layout.dimension[1] : ~
size_t(0)
193 , dynrank > 2 ? layout.dimension[2] : ~
size_t(0)
194 , dynrank > 3 ? layout.dimension[3] : ~
size_t(0)
195 , dynrank > 4 ? layout.dimension[4] : ~
size_t(0)
196 , dynrank > 5 ? layout.dimension[5] : ~
size_t(0)
197 , dynrank > 6 ? layout.dimension[6] : ~
size_t(0)
198 , dynrank > 7 ? layout.dimension[7] : ~
size_t(0)
203 template <
typename Layout ,
typename iType>
204 KOKKOS_INLINE_FUNCTION
205 static typename std::enable_if< (std::is_same<Layout , Kokkos::LayoutStride>::value) && std::is_integral<iType>::value , Layout >::type reconstructLayout(
const Layout& layout , iType dynrank )
207 return Layout( dynrank > 0 ? layout.dimension[0] : ~
size_t(0)
208 , dynrank > 0 ? layout.stride[0] : (0)
209 , dynrank > 1 ? layout.dimension[1] : ~
size_t(0)
210 , dynrank > 1 ? layout.stride[1] : (0)
211 , dynrank > 2 ? layout.dimension[2] : ~
size_t(0)
212 , dynrank > 2 ? layout.stride[2] : (0)
213 , dynrank > 3 ? layout.dimension[3] : ~
size_t(0)
214 , dynrank > 3 ? layout.stride[3] : (0)
215 , dynrank > 4 ? layout.dimension[4] : ~
size_t(0)
216 , dynrank > 4 ? layout.stride[4] : (0)
217 , dynrank > 5 ? layout.dimension[5] : ~
size_t(0)
218 , dynrank > 5 ? layout.stride[5] : (0)
219 , dynrank > 6 ? layout.dimension[6] : ~
size_t(0)
220 , dynrank > 6 ? layout.stride[6] : (0)
221 , dynrank > 7 ? layout.dimension[7] : ~
size_t(0)
222 , dynrank > 7 ? layout.stride[7] : (0)
230 template<
unsigned ,
typename iType0 ,
class MapType >
231 KOKKOS_INLINE_FUNCTION
235 template<
unsigned R ,
typename iType0 ,
class MapType ,
typename iType1 ,
class ... Args >
236 KOKKOS_INLINE_FUNCTION
238 (
const iType0 &
rank 239 ,
const MapType & map
244 if ( static_cast<iType0>(R) < rank ) {
245 return (
size_t(i) < map.extent(R) )
246 && dyn_rank_view_verify_operator_bounds<R+1>( rank , map , args ... );
249 printf(
"DynRankView Debug Bounds Checking Error: at rank %u\n Extra arguments beyond the rank must be zero \n",R);
251 && dyn_rank_view_verify_operator_bounds<R+1>(
rank , map , args ... );
255 && dyn_rank_view_verify_operator_bounds<R+1>(
rank , map , args ... );
259 template<
unsigned ,
class MapType >
261 void dyn_rank_view_error_operator_bounds(
char * ,
int ,
const MapType & )
264 template<
unsigned R ,
class MapType ,
class iType ,
class ... Args >
266 void dyn_rank_view_error_operator_bounds
269 ,
const MapType & map
275 snprintf(buf,len,
" %ld < %ld %c" 276 , static_cast<unsigned long>(i)
277 , static_cast<unsigned long>( map.extent(R) )
278 , (
sizeof...(Args) ?
',' :
')' )
280 dyn_rank_view_error_operator_bounds<R+1>(buf+n,len-n,map,args...);
284 template<
typename MemorySpace
285 ,
typename iType0 ,
typename iType1 ,
class MapType ,
class ... Args >
286 KOKKOS_INLINE_FUNCTION
288 (
const iType0 & op_rank ,
const iType1 & rank
289 ,
const Kokkos::Impl::SharedAllocationTracker & tracker
290 ,
const MapType & map , Args ... args )
292 if ( static_cast<iType0>(rank) > op_rank ) {
293 Kokkos::abort(
"DynRankView Bounds Checking Error: Need at least rank arguments to the operator()" );
296 if ( ! dyn_rank_view_verify_operator_bounds<0>( rank , map , args ... ) ) {
297 #if defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST ) 300 const std::string label = tracker.template get_label<MemorySpace>();
301 int n = snprintf(buffer,LEN,
"DynRankView bounds error of view %s (", label.c_str());
302 dyn_rank_view_error_operator_bounds<0>( buffer + n , LEN - n , map , args ... );
303 Kokkos::Impl::throw_runtime_exception(std::string(buffer));
305 Kokkos::abort(
"DynRankView bounds error");
314 template<
class DstTraits ,
class SrcTraits >
315 class ViewMapping< DstTraits , SrcTraits ,
316 typename std::enable_if<(
317 std::is_same< typename DstTraits::memory_space , typename SrcTraits::memory_space >::value
319 std::is_same< typename DstTraits::specialize , void >::value
321 std::is_same< typename SrcTraits::specialize , void >::value
324 std::is_same< typename DstTraits::array_layout , typename SrcTraits::array_layout >::value
328 std::is_same< typename DstTraits::array_layout , Kokkos::LayoutLeft >::value ||
329 std::is_same< typename DstTraits::array_layout , Kokkos::LayoutRight >::value ||
330 std::is_same< typename DstTraits::array_layout , Kokkos::LayoutStride >::value
334 std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutLeft >::value ||
335 std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutRight >::value ||
336 std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutStride >::value
340 ) , ViewToDynRankViewTag >::type >
344 enum { is_assignable_value_type =
345 std::is_same<
typename DstTraits::value_type
346 ,
typename SrcTraits::value_type >::value ||
347 std::is_same<
typename DstTraits::value_type
348 ,
typename SrcTraits::const_value_type >::value };
350 enum { is_assignable_layout =
351 std::is_same<
typename DstTraits::array_layout
352 ,
typename SrcTraits::array_layout >::value ||
353 std::is_same<
typename DstTraits::array_layout
359 enum { is_assignable = is_assignable_value_type &&
360 is_assignable_layout };
362 typedef ViewMapping< DstTraits , void > DstType ;
363 typedef ViewMapping< SrcTraits , void > SrcType ;
365 template <
typename DT ,
typename ... DP ,
typename ST ,
typename ... SP >
366 KOKKOS_INLINE_FUNCTION
369 static_assert( is_assignable_value_type
370 ,
"View assignment must have same value type or const = non-const" );
372 static_assert( is_assignable_layout
373 ,
"View assignment must have compatible layout or have rank <= 1" );
377 typedef typename DstType::offset_type dst_offset_type ;
378 dst.m_map.m_offset = dst_offset_type(std::integral_constant<unsigned,0>() , src.layout() );
379 dst.m_map.m_handle = Kokkos::Experimental::Impl::ViewDataHandle< DstTraits >::assign( src.m_map.m_handle , src.m_track );
380 dst.m_track.assign( src.m_track , DstTraits::is_managed );
381 dst.m_rank = src.Rank ;
406 template<
class >
struct is_dyn_rank_view :
public std::false_type {};
408 template<
class D,
class ... P >
409 struct is_dyn_rank_view< Kokkos::Experimental::DynRankView<D,P...> > :
public std::true_type {};
412 template<
typename DataType ,
class ... Properties >
413 class DynRankView :
public ViewTraits< DataType , Properties ... >
415 static_assert( !std::is_array<DataType>::value && !std::is_pointer<DataType>::value ,
"Cannot template DynRankView with array or pointer datatype - must be pod" );
418 template < class ,
class ... >
friend class DynRankView ;
419 template < class ,
class ... >
friend class Impl::ViewMapping ;
422 typedef ViewTraits< DataType , Properties ... > drvtraits ;
424 typedef View< DataType******* , Properties...> view_type ;
426 typedef ViewTraits< DataType******* , Properties ... > traits ;
430 typedef Kokkos::Experimental::Impl::ViewMapping< traits , void > map_type ;
431 typedef Kokkos::Experimental::Impl::SharedAllocationTracker track_type ;
438 KOKKOS_INLINE_FUNCTION
439 view_type & DownCast()
const {
return ( view_type & ) (*this); }
440 KOKKOS_INLINE_FUNCTION
441 const view_type & ConstDownCast()
const {
return (
const view_type & ) (*this); }
446 typedef DynRankView<
typename drvtraits::scalar_array_type ,
447 typename drvtraits::array_layout ,
448 typename drvtraits::device_type ,
449 typename drvtraits::memory_traits >
453 typedef DynRankView<
typename drvtraits::const_data_type ,
454 typename drvtraits::array_layout ,
455 typename drvtraits::device_type ,
456 typename drvtraits::memory_traits >
460 typedef DynRankView<
typename drvtraits::non_const_data_type ,
461 typename drvtraits::array_layout ,
462 typename drvtraits::device_type ,
463 typename drvtraits::memory_traits >
467 typedef DynRankView<
typename drvtraits::non_const_data_type ,
468 typename drvtraits::array_layout ,
469 typename drvtraits::host_mirror_space >
478 template<
typename iType >
479 KOKKOS_INLINE_FUNCTION constexpr
480 typename std::enable_if< std::is_integral<iType>::value ,
size_t >::type
481 extent(
const iType & r )
const 482 {
return m_map.extent(r); }
484 template<
typename iType >
485 KOKKOS_INLINE_FUNCTION constexpr
486 typename std::enable_if< std::is_integral<iType>::value ,
int >::type
487 extent_int(
const iType & r )
const 488 {
return static_cast<int>(m_map.extent(r)); }
490 KOKKOS_INLINE_FUNCTION constexpr
491 typename traits::array_layout layout()
const 492 {
return m_map.layout(); }
499 template<
typename iType >
500 KOKKOS_INLINE_FUNCTION constexpr
501 typename std::enable_if< std::is_integral<iType>::value ,
size_t >::type
502 dimension(
const iType & r )
const {
return extent( r ); }
504 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_0()
const {
return m_map.dimension_0(); }
505 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_1()
const {
return m_map.dimension_1(); }
506 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_2()
const {
return m_map.dimension_2(); }
507 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_3()
const {
return m_map.dimension_3(); }
508 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_4()
const {
return m_map.dimension_4(); }
509 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_5()
const {
return m_map.dimension_5(); }
510 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_6()
const {
return m_map.dimension_6(); }
511 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_7()
const {
return m_map.dimension_7(); }
515 KOKKOS_INLINE_FUNCTION constexpr
size_t size()
const {
return m_map.dimension_0() *
516 m_map.dimension_1() *
517 m_map.dimension_2() *
518 m_map.dimension_3() *
519 m_map.dimension_4() *
520 m_map.dimension_5() *
521 m_map.dimension_6() *
522 m_map.dimension_7(); }
524 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_0()
const {
return m_map.stride_0(); }
525 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_1()
const {
return m_map.stride_1(); }
526 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_2()
const {
return m_map.stride_2(); }
527 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_3()
const {
return m_map.stride_3(); }
528 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_4()
const {
return m_map.stride_4(); }
529 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_5()
const {
return m_map.stride_5(); }
530 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_6()
const {
return m_map.stride_6(); }
531 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_7()
const {
return m_map.stride_7(); }
533 template<
typename iType >
534 KOKKOS_INLINE_FUNCTION
void stride( iType *
const s )
const { m_map.stride(s); }
539 typedef typename map_type::reference_type reference_type ;
540 typedef typename map_type::pointer_type pointer_type ;
542 enum { reference_type_is_lvalue_reference = std::is_lvalue_reference< reference_type >::value };
544 KOKKOS_INLINE_FUNCTION constexpr
size_t span()
const {
return m_map.span(); }
546 KOKKOS_INLINE_FUNCTION constexpr
size_t capacity()
const {
return m_map.span(); }
547 KOKKOS_INLINE_FUNCTION constexpr
bool span_is_contiguous()
const {
return m_map.span_is_contiguous(); }
548 KOKKOS_INLINE_FUNCTION constexpr pointer_type data()
const {
return m_map.data(); }
551 KOKKOS_INLINE_FUNCTION constexpr
bool is_contiguous()
const {
return m_map.span_is_contiguous(); }
553 KOKKOS_INLINE_FUNCTION constexpr pointer_type ptr_on_device()
const {
return m_map.data(); }
558 KOKKOS_INLINE_FUNCTION
559 const Kokkos::Experimental::Impl::ViewMapping< traits , void > &
560 implementation_map()
const {
return m_map ; }
567 is_layout_left = std::is_same<
typename traits::array_layout
570 is_layout_right = std::is_same<
typename traits::array_layout
573 is_layout_stride = std::is_same<
typename traits::array_layout
577 std::is_same< typename traits::specialize , void >::value &&
578 ( is_layout_left || is_layout_right || is_layout_stride )
581 template< class Space , bool = Kokkos::Impl::MemorySpaceAccess< Space , typename traits::memory_space >::accessible >
struct verify_space
582 { KOKKOS_FORCEINLINE_FUNCTION
static void check() {} };
584 template<
class Space >
struct verify_space<Space,false>
585 { KOKKOS_FORCEINLINE_FUNCTION
static void check()
586 { Kokkos::abort(
"Kokkos::DynRankView ERROR: attempt to access inaccessible memory space"); };
590 #if defined( KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK ) 593 #define KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( ARG ) \ 594 DynRankView::template verify_space< Kokkos::Impl::ActiveExecutionMemorySpace >::check(); \ 595 Kokkos::Experimental::Impl::dyn_rank_view_verify_operator_bounds< typename traits::memory_space > ARG ; 599 #define KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( ARG ) \ 600 DynRankView::template verify_space< Kokkos::Impl::ActiveExecutionMemorySpace >::check(); 606 KOKKOS_INLINE_FUNCTION
607 constexpr
unsigned rank()
const {
return m_rank; }
612 KOKKOS_INLINE_FUNCTION
613 reference_type operator()()
const 615 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (0 , this->
rank(), m_track, m_map) )
616 return implementation_map().reference();
622 template<
typename iType >
623 KOKKOS_INLINE_FUNCTION
624 typename std::enable_if< std::is_same<typename drvtraits::value_type, typename drvtraits::scalar_array_type>::value && std::is_integral<iType>::value, reference_type>::type
625 operator[](
const iType & i0)
const 634 template<
typename iType >
635 KOKKOS_INLINE_FUNCTION
636 typename std::enable_if< !std::is_same<typename drvtraits::value_type, typename drvtraits::scalar_array_type>::value && std::is_integral<iType>::value, reference_type>::type
637 operator[](
const iType & i0)
const 640 const size_t dim_scalar = m_map.dimension_scalar();
641 const size_t bytes = this->span() / dim_scalar;
644 tmp_view_type rankone_view(this->data(), bytes, dim_scalar);
645 return rankone_view(i0);
649 template<
typename iType >
650 KOKKOS_INLINE_FUNCTION
651 typename std::enable_if< (std::is_same<typename traits::specialize , void>::value && std::is_integral<iType>::value), reference_type>::type
652 operator()(
const iType & i0 )
const 654 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (1 , this->
rank(), m_track, m_map, i0) )
655 return m_map.reference(i0);
658 template<
typename iType >
659 KOKKOS_INLINE_FUNCTION
660 typename std::enable_if< !(std::is_same<typename traits::specialize , void>::value && std::is_integral<iType>::value), reference_type>::type
661 operator()(
const iType & i0 )
const 663 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (1 , this->
rank(), m_track, m_map, i0) )
664 return m_map.reference(i0,0,0,0,0,0,0);
668 template<
typename iType0 ,
typename iType1 >
669 KOKKOS_INLINE_FUNCTION
670 typename std::enable_if< (std::is_same<typename traits::specialize , void>::value && std::is_integral<iType0>::value && std::is_integral<iType1>::value), reference_type>::type
671 operator()(
const iType0 & i0 ,
const iType1 & i1 )
const 673 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (2 , this->
rank(), m_track, m_map, i0, i1) )
674 return m_map.reference(i0,i1);
677 template<
typename iType0 ,
typename iType1 >
678 KOKKOS_INLINE_FUNCTION
679 typename std::enable_if< !(std::is_same<typename drvtraits::specialize , void>::value && std::is_integral<iType0>::value), reference_type>::type
680 operator()(
const iType0 & i0 ,
const iType1 & i1 )
const 682 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (2 , this->
rank(), m_track, m_map, i0, i1) )
683 return m_map.reference(i0,i1,0,0,0,0,0);
687 template<
typename iType0 ,
typename iType1 ,
typename iType2 >
688 KOKKOS_INLINE_FUNCTION
689 typename std::enable_if< (std::is_same<typename traits::specialize , void>::value && std::is_integral<iType0>::value && std::is_integral<iType1>::value && std::is_integral<iType2>::value), reference_type>::type
690 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 )
const 692 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (3 , this->
rank(), m_track, m_map, i0, i1, i2) )
693 return m_map.reference(i0,i1,i2);
696 template<
typename iType0 ,
typename iType1 ,
typename iType2 >
697 KOKKOS_INLINE_FUNCTION
698 typename std::enable_if< !(std::is_same<typename drvtraits::specialize , void>::value && std::is_integral<iType0>::value), reference_type>::type
699 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 )
const 701 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (3 , this->
rank(), m_track, m_map, i0, i1, i2) )
702 return m_map.reference(i0,i1,i2,0,0,0,0);
706 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3 >
707 KOKKOS_INLINE_FUNCTION
708 typename std::enable_if< (std::is_same<typename traits::specialize , void>::value && std::is_integral<iType0>::value && std::is_integral<iType1>::value && std::is_integral<iType2>::value && std::is_integral<iType3>::value), reference_type>::type
709 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 )
const 711 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (4 , this->
rank(), m_track, m_map, i0, i1, i2, i3) )
712 return m_map.reference(i0,i1,i2,i3);
715 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3 >
716 KOKKOS_INLINE_FUNCTION
717 typename std::enable_if< !(std::is_same<typename drvtraits::specialize , void>::value && std::is_integral<iType0>::value), reference_type>::type
718 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 )
const 720 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (4 , this->
rank(), m_track, m_map, i0, i1, i2, i3) )
721 return m_map.reference(i0,i1,i2,i3,0,0,0);
725 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3,
typename iType4 >
726 KOKKOS_INLINE_FUNCTION
727 typename std::enable_if< (std::is_same<typename traits::specialize , void>::value && std::is_integral<iType0>::value && std::is_integral<iType1>::value && std::is_integral<iType2>::value && std::is_integral<iType3>::value && std::is_integral<iType4>::value), reference_type>::type
728 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 ,
const iType4 & i4 )
const 730 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (5 , this->
rank(), m_track, m_map, i0, i1, i2, i3, i4) )
731 return m_map.reference(i0,i1,i2,i3,i4);
734 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3,
typename iType4 >
735 KOKKOS_INLINE_FUNCTION
736 typename std::enable_if< !(std::is_same<typename drvtraits::specialize , void>::value && std::is_integral<iType0>::value), reference_type>::type
737 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 ,
const iType4 & i4 )
const 739 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (5 , this->
rank(), m_track, m_map, i0, i1, i2, i3, i4) )
740 return m_map.reference(i0,i1,i2,i3,i4,0,0);
744 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3,
typename iType4 ,
typename iType5 >
745 KOKKOS_INLINE_FUNCTION
746 typename std::enable_if< (std::is_same<typename traits::specialize , void>::value && std::is_integral<iType0>::value && std::is_integral<iType1>::value && std::is_integral<iType2>::value && std::is_integral<iType3>::value && std::is_integral<iType4>::value && std::is_integral<iType5>::value), reference_type>::type
747 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 ,
const iType4 & i4 ,
const iType5 & i5 )
const 749 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (6 , this->
rank(), m_track, m_map, i0, i1, i2, i3, i4, i5) )
750 return m_map.reference(i0,i1,i2,i3,i4,i5);
753 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3,
typename iType4 ,
typename iType5 >
754 KOKKOS_INLINE_FUNCTION
755 typename std::enable_if< !(std::is_same<typename drvtraits::specialize , void>::value && std::is_integral<iType0>::value), reference_type>::type
756 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 ,
const iType4 & i4 ,
const iType5 & i5 )
const 758 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (6 , this->
rank(), m_track, m_map, i0, i1, i2, i3, i4, i5) )
759 return m_map.reference(i0,i1,i2,i3,i4,i5,0);
763 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3,
typename iType4 ,
typename iType5 ,
typename iType6 >
764 KOKKOS_INLINE_FUNCTION
765 typename std::enable_if< (std::is_integral<iType0>::value && std::is_integral<iType1>::value && std::is_integral<iType2>::value && std::is_integral<iType3>::value && std::is_integral<iType4>::value && std::is_integral<iType5>::value && std::is_integral<iType6>::value), reference_type>::type
766 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 ,
const iType4 & i4 ,
const iType5 & i5 ,
const iType6 & i6 )
const 768 KOKKOS_IMPL_VIEW_OPERATOR_VERIFY( (7 , this->
rank(), m_track, m_map, i0, i1, i2, i3, i4, i5, i6) )
769 return m_map.reference(i0,i1,i2,i3,i4,i5,i6);
772 #undef KOKKOS_IMPL_VIEW_OPERATOR_VERIFY 777 KOKKOS_INLINE_FUNCTION
780 KOKKOS_INLINE_FUNCTION
781 DynRankView() : m_track(), m_map(), m_rank() {}
783 KOKKOS_INLINE_FUNCTION
784 DynRankView(
const DynRankView & rhs ) : m_track( rhs.m_track ), m_map( rhs.m_map ), m_rank(rhs.m_rank) {}
786 KOKKOS_INLINE_FUNCTION
787 DynRankView( DynRankView && rhs ) : m_track( rhs.m_track ), m_map( rhs.m_map ), m_rank(rhs.m_rank) {}
789 KOKKOS_INLINE_FUNCTION
790 DynRankView & operator = (
const DynRankView & rhs ) { m_track = rhs.m_track; m_map = rhs.m_map; m_rank = rhs.m_rank;
return *
this; }
792 KOKKOS_INLINE_FUNCTION
793 DynRankView & operator = ( DynRankView && rhs ) { m_track = rhs.m_track; m_map = rhs.m_map; m_rank = rhs.m_rank;
return *
this; }
798 template<
class RT ,
class ... RP >
799 KOKKOS_INLINE_FUNCTION
800 DynRankView(
const DynRankView<RT,RP...> & rhs )
801 : m_track( rhs.m_track , traits::is_managed )
805 typedef typename DynRankView<RT,RP...> ::traits SrcTraits ;
806 typedef Kokkos::Experimental::Impl::ViewMapping< traits , SrcTraits , void > Mapping ;
807 static_assert( Mapping::is_assignable ,
"Incompatible DynRankView copy construction" );
808 Mapping::assign( m_map , rhs.m_map , rhs.m_track );
811 template<
class RT ,
class ... RP >
812 KOKKOS_INLINE_FUNCTION
813 DynRankView & operator = (
const DynRankView<RT,RP...> & rhs )
815 typedef typename DynRankView<RT,RP...> ::traits SrcTraits ;
816 typedef Kokkos::Experimental::Impl::ViewMapping< traits , SrcTraits , void > Mapping ;
817 static_assert( Mapping::is_assignable ,
"Incompatible DynRankView copy construction" );
818 Mapping::assign( m_map , rhs.m_map , rhs.m_track );
819 m_track.assign( rhs.m_track , traits::is_managed );
826 template<
class RT ,
class ... RP >
827 KOKKOS_INLINE_FUNCTION
833 typedef typename View<RT,RP...>::traits SrcTraits ;
834 typedef Kokkos::Experimental::Impl::ViewMapping< traits , SrcTraits , Kokkos::Experimental::Impl::ViewToDynRankViewTag > Mapping ;
835 static_assert( Mapping::is_assignable ,
"Incompatible DynRankView copy construction" );
836 Mapping::assign( *
this , rhs );
839 template<
class RT ,
class ... RP >
840 KOKKOS_INLINE_FUNCTION
843 typedef typename View<RT,RP...>::traits SrcTraits ;
844 typedef Kokkos::Experimental::Impl::ViewMapping< traits , SrcTraits , Kokkos::Experimental::Impl::ViewToDynRankViewTag > Mapping ;
845 static_assert( Mapping::is_assignable ,
"Incompatible View to DynRankView copy assignment" );
846 Mapping::assign( *
this , rhs );
853 KOKKOS_INLINE_FUNCTION
854 int use_count()
const 855 {
return m_track.use_count(); }
858 const std::string label()
const 859 {
return m_track.template get_label< typename traits::memory_space >(); }
864 template<
class ... P >
866 DynRankView(
const Impl::ViewCtorProp< P ... > & arg_prop
867 ,
typename std::enable_if< ! Impl::ViewCtorProp< P... >::has_pointer
868 ,
typename traits::array_layout
869 >::type
const & arg_layout
873 , m_rank( Impl::DynRankDimTraits<typename traits::specialize>::computeRank(arg_layout) )
876 typedef Impl::ViewCtorProp< P ... > alloc_prop_input ;
880 typedef Impl::ViewCtorProp
882 ,
typename std::conditional
883 < alloc_prop_input::has_label
884 , std::integral_constant<unsigned,0>
885 ,
typename std::string
887 ,
typename std::conditional
888 < alloc_prop_input::has_memory_space
889 , std::integral_constant<unsigned,1>
890 ,
typename traits::device_type::memory_space
892 ,
typename std::conditional
893 < alloc_prop_input::has_execution_space
894 , std::integral_constant<unsigned,2>
895 ,
typename traits::device_type::execution_space
899 static_assert( traits::is_managed
900 ,
"View allocation constructor requires managed memory" );
902 if ( alloc_prop::initialize &&
903 ! alloc_prop::execution_space::is_initialized() ) {
906 Kokkos::Impl::throw_runtime_exception(
"Constructing DynRankView and initializing data with uninitialized execution space");
910 alloc_prop prop( arg_prop );
913 #if defined( KOKKOS_ENABLE_CUDA ) 919 if ( std::is_same< Kokkos::CudaUVMSpace , typename traits::device_type::memory_space >::value ) {
920 traits::device_type::memory_space::execution_space::fence();
925 Kokkos::Experimental::Impl::SharedAllocationRecord<> *
926 record = m_map.allocate_shared( prop , Impl::DynRankDimTraits<typename traits::specialize>::createLayout(arg_layout) );
929 #if defined( KOKKOS_ENABLE_CUDA ) 930 if ( std::is_same< Kokkos::CudaUVMSpace , typename traits::device_type::memory_space >::value ) {
931 traits::device_type::memory_space::execution_space::fence();
937 m_track.assign_allocated_record_to_uninitialized( record );
942 template<
class ... P >
943 explicit KOKKOS_INLINE_FUNCTION
944 DynRankView(
const Impl::ViewCtorProp< P ... > & arg_prop
945 ,
typename std::enable_if< Impl::ViewCtorProp< P... >::has_pointer
946 ,
typename traits::array_layout
947 >::type
const & arg_layout
950 , m_map( arg_prop , Impl::DynRankDimTraits<typename traits::specialize>::createLayout(arg_layout) )
951 , m_rank( Impl::DynRankDimTraits<typename traits::specialize>::computeRank(arg_layout) )
954 std::is_same< pointer_type
955 ,
typename Impl::ViewCtorProp< P... >::pointer_type
957 "Constructing DynRankView to wrap user memory must supply matching pointer type" );
964 template<
class ... P >
966 DynRankView(
const Impl::ViewCtorProp< P ... > & arg_prop
967 ,
typename std::enable_if< ! Impl::ViewCtorProp< P... >::has_pointer
969 >::type
const arg_N0 = ~
size_t(0)
970 ,
const size_t arg_N1 = ~
size_t(0)
971 ,
const size_t arg_N2 = ~
size_t(0)
972 ,
const size_t arg_N3 = ~
size_t(0)
973 ,
const size_t arg_N4 = ~
size_t(0)
974 ,
const size_t arg_N5 = ~
size_t(0)
975 ,
const size_t arg_N6 = ~
size_t(0)
976 ,
const size_t arg_N7 = ~
size_t(0)
978 : DynRankView( arg_prop
979 ,
typename traits::array_layout
980 ( arg_N0 , arg_N1 , arg_N2 , arg_N3 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
984 template<
class ... P >
985 explicit KOKKOS_INLINE_FUNCTION
986 DynRankView(
const Impl::ViewCtorProp< P ... > & arg_prop
987 ,
typename std::enable_if< Impl::ViewCtorProp< P... >::has_pointer
989 >::type
const arg_N0 = ~
size_t(0)
990 ,
const size_t arg_N1 = ~
size_t(0)
991 ,
const size_t arg_N2 = ~
size_t(0)
992 ,
const size_t arg_N3 = ~
size_t(0)
993 ,
const size_t arg_N4 = ~
size_t(0)
994 ,
const size_t arg_N5 = ~
size_t(0)
995 ,
const size_t arg_N6 = ~
size_t(0)
996 ,
const size_t arg_N7 = ~
size_t(0)
998 : DynRankView( arg_prop
999 ,
typename traits::array_layout
1000 ( arg_N0 , arg_N1 , arg_N2 , arg_N3 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
1005 template<
typename Label >
1007 DynRankView(
const Label & arg_label
1008 ,
typename std::enable_if<
1009 Kokkos::Experimental::Impl::is_view_label<Label>::value ,
1010 typename traits::array_layout >::type
const & arg_layout
1012 : DynRankView( Impl::ViewCtorProp< std::string >( arg_label ) , arg_layout )
1016 template<
typename Label >
1018 DynRankView(
const Label & arg_label
1019 ,
typename std::enable_if<
1020 Kokkos::Experimental::Impl::is_view_label<Label>::value ,
1021 const size_t >::type arg_N0 = ~
size_t(0)
1022 ,
const size_t arg_N1 = ~
size_t(0)
1023 ,
const size_t arg_N2 = ~
size_t(0)
1024 ,
const size_t arg_N3 = ~
size_t(0)
1025 ,
const size_t arg_N4 = ~
size_t(0)
1026 ,
const size_t arg_N5 = ~
size_t(0)
1027 ,
const size_t arg_N6 = ~
size_t(0)
1028 ,
const size_t arg_N7 = ~
size_t(0)
1030 : DynRankView( Impl::ViewCtorProp< std::string >( arg_label )
1031 ,
typename traits::array_layout
1032 ( arg_N0 , arg_N1 , arg_N2 , arg_N3 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
1038 DynRankView(
const ViewAllocateWithoutInitializing & arg_prop
1039 ,
const typename traits::array_layout & arg_layout
1041 : DynRankView( Impl::ViewCtorProp< std::string , Kokkos::Experimental::Impl::WithoutInitializing_t >( arg_prop.label , Kokkos::Experimental::WithoutInitializing )
1042 , Impl::DynRankDimTraits<typename traits::specialize>::createLayout(arg_layout)
1047 DynRankView(
const ViewAllocateWithoutInitializing & arg_prop
1048 ,
const size_t arg_N0 = ~
size_t(0)
1049 ,
const size_t arg_N1 = ~
size_t(0)
1050 ,
const size_t arg_N2 = ~
size_t(0)
1051 ,
const size_t arg_N3 = ~
size_t(0)
1052 ,
const size_t arg_N4 = ~
size_t(0)
1053 ,
const size_t arg_N5 = ~
size_t(0)
1054 ,
const size_t arg_N6 = ~
size_t(0)
1055 ,
const size_t arg_N7 = ~
size_t(0)
1057 : DynRankView(Impl::ViewCtorProp< std::string , Kokkos::Experimental::Impl::WithoutInitializing_t >( arg_prop.label , Kokkos::Experimental::WithoutInitializing ), arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7 )
1062 static constexpr
size_t required_allocation_size(
1063 const size_t arg_N0 = 0
1064 ,
const size_t arg_N1 = 0
1065 ,
const size_t arg_N2 = 0
1066 ,
const size_t arg_N3 = 0
1067 ,
const size_t arg_N4 = 0
1068 ,
const size_t arg_N5 = 0
1069 ,
const size_t arg_N6 = 0
1070 ,
const size_t arg_N7 = 0
1073 return map_type::memory_span(
1074 typename traits::array_layout
1075 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
1076 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) );
1079 explicit KOKKOS_INLINE_FUNCTION
1080 DynRankView( pointer_type arg_ptr
1081 ,
const size_t arg_N0 = ~
size_t(0)
1082 ,
const size_t arg_N1 = ~
size_t(0)
1083 ,
const size_t arg_N2 = ~
size_t(0)
1084 ,
const size_t arg_N3 = ~
size_t(0)
1085 ,
const size_t arg_N4 = ~
size_t(0)
1086 ,
const size_t arg_N5 = ~
size_t(0)
1087 ,
const size_t arg_N6 = ~
size_t(0)
1088 ,
const size_t arg_N7 = ~
size_t(0)
1090 : DynRankView( Impl::ViewCtorProp<pointer_type>(arg_ptr) , arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7 )
1093 explicit KOKKOS_INLINE_FUNCTION
1094 DynRankView( pointer_type arg_ptr
1095 ,
typename traits::array_layout & arg_layout
1097 : DynRankView( Impl::ViewCtorProp<pointer_type>(arg_ptr) , arg_layout )
1105 size_t shmem_size(
const size_t arg_N0 = ~
size_t(0) ,
1106 const size_t arg_N1 = ~
size_t(0) ,
1107 const size_t arg_N2 = ~
size_t(0) ,
1108 const size_t arg_N3 = ~
size_t(0) ,
1109 const size_t arg_N4 = ~
size_t(0) ,
1110 const size_t arg_N5 = ~
size_t(0) ,
1111 const size_t arg_N6 = ~
size_t(0) ,
1112 const size_t arg_N7 = ~
size_t(0) )
1114 const size_t num_passed_args =
1115 ( arg_N0 != ~size_t(0) ) + ( arg_N1 != ~
size_t(0) ) + ( arg_N2 != ~
size_t(0) ) +
1116 ( arg_N3 != ~
size_t(0) ) + ( arg_N4 != ~
size_t(0) ) + ( arg_N5 != ~
size_t(0) ) +
1117 ( arg_N6 != ~
size_t(0) ) + ( arg_N7 != ~
size_t(0) );
1119 if ( std::is_same<typename traits::specialize , void>::value && num_passed_args != traits::rank_dynamic ) {
1120 Kokkos::abort(
"Kokkos::View::shmem_size() rank_dynamic != number of arguments.\n" );
1124 return map_type::memory_span(
1125 typename traits::array_layout
1126 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
1127 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) );
1130 explicit KOKKOS_INLINE_FUNCTION
1131 DynRankView(
const typename traits::execution_space::scratch_memory_space & arg_space
1132 ,
const typename traits::array_layout & arg_layout )
1133 : DynRankView( Impl::ViewCtorProp<pointer_type>(
1134 reinterpret_cast<pointer_type>(
1135 arg_space.get_shmem( map_type::memory_span(
1136 Impl::DynRankDimTraits<typename traits::specialize>::createLayout( arg_layout )
1141 explicit KOKKOS_INLINE_FUNCTION
1142 DynRankView(
const typename traits::execution_space::scratch_memory_space & arg_space
1143 ,
const size_t arg_N0 = ~
size_t(0)
1144 ,
const size_t arg_N1 = ~
size_t(0)
1145 ,
const size_t arg_N2 = ~
size_t(0)
1146 ,
const size_t arg_N3 = ~
size_t(0)
1147 ,
const size_t arg_N4 = ~
size_t(0)
1148 ,
const size_t arg_N5 = ~
size_t(0)
1149 ,
const size_t arg_N6 = ~
size_t(0)
1150 ,
const size_t arg_N7 = ~
size_t(0) )
1152 : DynRankView( Impl::ViewCtorProp<pointer_type>(
1153 reinterpret_cast<pointer_type>(
1154 arg_space.get_shmem(
1155 map_type::memory_span(
1156 Impl::DynRankDimTraits<typename traits::specialize>::createLayout(
1157 typename traits::array_layout
1158 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
1159 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) ) ) ) )
1161 ,
typename traits::array_layout
1162 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
1163 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
1170 template <
typename D ,
class ... P >
1171 KOKKOS_INLINE_FUNCTION
1172 constexpr
unsigned rank(
const DynRankView<D , P...> & DRV ) {
return DRV.rank(); }
1180 struct DynRankSubviewTag {};
1182 template<
class SrcTraits ,
class ... Args >
1184 < typename std::enable_if<(
1185 std::is_same< typename SrcTraits::specialize , void >::value
1188 std::is_same< typename SrcTraits::array_layout
1189 , Kokkos::LayoutLeft >::value ||
1190 std::is_same< typename SrcTraits::array_layout
1191 , Kokkos::LayoutRight >::value ||
1192 std::is_same< typename SrcTraits::array_layout
1193 , Kokkos::LayoutStride >::value
1195 ), DynRankSubviewTag >::type
1203 , R0 = bool(is_integral_extent<0,Args...>::value)
1204 , R1 = bool(is_integral_extent<1,Args...>::value)
1205 , R2 = bool(is_integral_extent<2,Args...>::value)
1206 , R3 = bool(is_integral_extent<3,Args...>::value)
1207 , R4 = bool(is_integral_extent<4,Args...>::value)
1208 , R5 = bool(is_integral_extent<5,Args...>::value)
1209 , R6 = bool(is_integral_extent<6,Args...>::value)
1212 enum {
rank = unsigned(R0) + unsigned(R1) + unsigned(R2) + unsigned(R3)
1213 + unsigned(R4) + unsigned(R5) + unsigned(R6) };
1217 typedef typename SrcTraits::value_type value_type ;
1219 typedef value_type******* data_type ;
1226 ,
typename SrcTraits::device_type
1227 ,
typename SrcTraits::memory_traits > traits_type ;
1232 ,
typename SrcTraits::device_type
1233 ,
typename SrcTraits::memory_traits > type ;
1236 template<
class MemoryTraits >
1239 static_assert( Kokkos::Impl::is_memory_traits< MemoryTraits >::value ,
"" );
1244 ,
typename SrcTraits::device_type
1245 , MemoryTraits > traits_type ;
1250 ,
typename SrcTraits::device_type
1251 , MemoryTraits > type ;
1255 typedef typename SrcTraits::dimension dimension ;
1257 template <
class Arg0 =
int,
class Arg1 =
int,
class Arg2 =
int,
class Arg3 =
int,
class Arg4 =
int,
class Arg5 =
int,
class Arg6 =
int >
1258 struct ExtentGenerator {
1259 KOKKOS_INLINE_FUNCTION
1260 static SubviewExtents< 7 , rank > generator (
const dimension & dim , Arg0 arg0 = Arg0(), Arg1 arg1 = Arg1(), Arg2 arg2 = Arg2(), Arg3 arg3 = Arg3(), Arg4 arg4 = Arg4(), Arg5 arg5 = Arg5(), Arg6 arg6 = Arg6() )
1262 return SubviewExtents< 7 , rank>( dim , arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 );
1267 typedef DynRankView< value_type , array_layout , typename SrcTraits::device_type , typename SrcTraits::memory_traits > ret_type;
1269 template <
typename T ,
class ... P >
1270 KOKKOS_INLINE_FUNCTION
1271 static ret_type subview(
const unsigned src_rank , Kokkos::Experimental::DynRankView< T , P...>
const & src
1275 typedef ViewMapping< traits_type, void > DstType ;
1277 typedef typename std::conditional< (rank==0) , ViewDimension<>
1278 ,
typename std::conditional< (rank==1) , ViewDimension<0>
1279 ,
typename std::conditional< (rank==2) , ViewDimension<0,0>
1280 ,
typename std::conditional< (rank==3) , ViewDimension<0,0,0>
1281 ,
typename std::conditional< (rank==4) , ViewDimension<0,0,0,0>
1282 ,
typename std::conditional< (rank==5) , ViewDimension<0,0,0,0,0>
1283 ,
typename std::conditional< (rank==6) , ViewDimension<0,0,0,0,0,0>
1284 , ViewDimension<0,0,0,0,0,0,0>
1285 >::type >::type >::type >::type >::type >::type >::type DstDimType ;
1287 typedef ViewOffset< DstDimType , Kokkos::LayoutStride > dst_offset_type ;
1288 typedef typename DstType::handle_type dst_handle_type ;
1292 const SubviewExtents< 7 , rank > extents =
1293 ExtentGenerator< Args ... >::generator( src.m_map.m_offset.m_dim , args... ) ;
1295 dst_offset_type tempdst( src.m_map.m_offset , extents ) ;
1297 dst.m_track = src.m_track ;
1299 dst.m_map.m_offset.m_dim.N0 = tempdst.m_dim.N0 ;
1300 dst.m_map.m_offset.m_dim.N1 = tempdst.m_dim.N1 ;
1301 dst.m_map.m_offset.m_dim.N2 = tempdst.m_dim.N2 ;
1302 dst.m_map.m_offset.m_dim.N3 = tempdst.m_dim.N3 ;
1303 dst.m_map.m_offset.m_dim.N4 = tempdst.m_dim.N4 ;
1304 dst.m_map.m_offset.m_dim.N5 = tempdst.m_dim.N5 ;
1305 dst.m_map.m_offset.m_dim.N6 = tempdst.m_dim.N6 ;
1307 dst.m_map.m_offset.m_stride.S0 = tempdst.m_stride.S0 ;
1308 dst.m_map.m_offset.m_stride.S1 = tempdst.m_stride.S1 ;
1309 dst.m_map.m_offset.m_stride.S2 = tempdst.m_stride.S2 ;
1310 dst.m_map.m_offset.m_stride.S3 = tempdst.m_stride.S3 ;
1311 dst.m_map.m_offset.m_stride.S4 = tempdst.m_stride.S4 ;
1312 dst.m_map.m_offset.m_stride.S5 = tempdst.m_stride.S5 ;
1313 dst.m_map.m_offset.m_stride.S6 = tempdst.m_stride.S6 ;
1315 dst.m_map.m_handle = dst_handle_type( src.m_map.m_handle +
1316 src.m_map.m_offset( extents.domain_offset(0)
1317 , extents.domain_offset(1)
1318 , extents.domain_offset(2)
1319 , extents.domain_offset(3)
1320 , extents.domain_offset(4)
1321 , extents.domain_offset(5)
1322 , extents.domain_offset(6)
1325 dst.m_rank = ( src_rank > 0 ? unsigned(R0) : 0 )
1326 + ( src_rank > 1 ?
unsigned(R1) : 0 )
1327 + ( src_rank > 2 ?
unsigned(R2) : 0 )
1328 + ( src_rank > 3 ?
unsigned(R3) : 0 )
1329 + ( src_rank > 4 ?
unsigned(R4) : 0 )
1330 + ( src_rank > 5 ?
unsigned(R5) : 0 )
1331 + ( src_rank > 6 ?
unsigned(R6) : 0 ) ;
1340 template<
class V ,
class ... Args >
1341 using Subdynrankview =
typename Kokkos::Experimental::Impl::ViewMapping< Kokkos::Experimental::Impl::DynRankSubviewTag , V , Args... >::ret_type ;
1343 template<
class D ,
class ... P ,
class ...Args >
1344 KOKKOS_INLINE_FUNCTION
1345 Subdynrankview<
ViewTraits<D******* , P...> , Args... >
1346 subdynrankview(
const Kokkos::Experimental::DynRankView< D , P... > &src , Args...args)
1348 if ( src.rank() >
sizeof...(Args) )
1349 { Kokkos::abort(
"subdynrankview: num of args must be >= rank of the source DynRankView"); }
1351 typedef Kokkos::Experimental::Impl::ViewMapping< Kokkos::Experimental::Impl::DynRankSubviewTag ,
Kokkos::ViewTraits< D*******, P... > , Args... > metafcn ;
1353 return metafcn::subview( src.rank() , src , args... );
1357 template<
class D ,
class ... P ,
class ...Args >
1358 KOKKOS_INLINE_FUNCTION
1359 Subdynrankview<
ViewTraits<D******* , P...> , Args... >
1360 subview(
const Kokkos::Experimental::DynRankView< D , P... > &src , Args...args)
1362 return subdynrankview( src , args... );
1372 template<
class LT ,
class ... LP ,
class RT ,
class ... RP >
1373 KOKKOS_INLINE_FUNCTION
1374 bool operator == (
const DynRankView<LT,LP...> & lhs ,
1375 const DynRankView<RT,RP...> & rhs )
1382 std::is_same<
typename lhs_traits::const_value_type ,
1383 typename rhs_traits::const_value_type >::value &&
1384 std::is_same<
typename lhs_traits::array_layout ,
1385 typename rhs_traits::array_layout >::value &&
1386 std::is_same<
typename lhs_traits::memory_space ,
1387 typename rhs_traits::memory_space >::value &&
1388 lhs.rank() == rhs.rank() &&
1389 lhs.data() == rhs.data() &&
1390 lhs.span() == rhs.span() &&
1391 lhs.dimension(0) == rhs.dimension(0) &&
1392 lhs.dimension(1) == rhs.dimension(1) &&
1393 lhs.dimension(2) == rhs.dimension(2) &&
1394 lhs.dimension(3) == rhs.dimension(3) &&
1395 lhs.dimension(4) == rhs.dimension(4) &&
1396 lhs.dimension(5) == rhs.dimension(5) &&
1397 lhs.dimension(6) == rhs.dimension(6) &&
1398 lhs.dimension(7) == rhs.dimension(7);
1401 template<
class LT ,
class ... LP ,
class RT ,
class ... RP >
1402 KOKKOS_INLINE_FUNCTION
1403 bool operator != (
const DynRankView<LT,LP...> & lhs ,
1404 const DynRankView<RT,RP...> & rhs )
1418 template<
class OutputView ,
typename Enable =
void >
1419 struct DynRankViewFill {
1421 typedef typename OutputView::traits::const_value_type const_value_type ;
1423 const OutputView output ;
1424 const_value_type input ;
1426 KOKKOS_INLINE_FUNCTION
1427 void operator()(
const size_t i0 )
const 1429 const size_t n1 = output.dimension_1();
1430 const size_t n2 = output.dimension_2();
1431 const size_t n3 = output.dimension_3();
1432 const size_t n4 = output.dimension_4();
1433 const size_t n5 = output.dimension_5();
1434 const size_t n6 = output.dimension_6();
1436 for (
size_t i1 = 0 ; i1 < n1 ; ++i1 ) {
1437 for (
size_t i2 = 0 ; i2 < n2 ; ++i2 ) {
1438 for (
size_t i3 = 0 ; i3 < n3 ; ++i3 ) {
1439 for (
size_t i4 = 0 ; i4 < n4 ; ++i4 ) {
1440 for (
size_t i5 = 0 ; i5 < n5 ; ++i5 ) {
1441 for (
size_t i6 = 0 ; i6 < n6 ; ++i6 ) {
1442 output(i0,i1,i2,i3,i4,i5,i6) = input ;
1446 DynRankViewFill(
const OutputView & arg_out , const_value_type & arg_in )
1447 : output( arg_out ), input( arg_in )
1449 typedef typename OutputView::execution_space execution_space ;
1456 execution_space::fence();
1460 template<
class OutputView >
1461 struct DynRankViewFill< OutputView , typename std::enable_if< OutputView::Rank == 0 >::type > {
1462 DynRankViewFill(
const OutputView & dst ,
const typename OutputView::const_value_type & src )
1464 Kokkos::Impl::DeepCopy< typename OutputView::memory_space , Kokkos::HostSpace >
1465 ( dst.data() , & src ,
sizeof(
typename OutputView::const_value_type) );
1469 template<
class OutputView ,
class InputView ,
class ExecSpace =
typename OutputView::execution_space >
1470 struct DynRankViewRemap {
1472 const OutputView output ;
1473 const InputView input ;
1483 DynRankViewRemap(
const OutputView & arg_out ,
const InputView & arg_in )
1484 : output( arg_out ), input( arg_in )
1485 , n0( std::min( (
size_t)arg_out.dimension_0() , (size_t)arg_in.dimension_0() ) )
1486 , n1( std::min( (
size_t)arg_out.dimension_1() , (size_t)arg_in.dimension_1() ) )
1487 , n2( std::min( (
size_t)arg_out.dimension_2() , (size_t)arg_in.dimension_2() ) )
1488 , n3( std::min( (
size_t)arg_out.dimension_3() , (size_t)arg_in.dimension_3() ) )
1489 , n4( std::min( (
size_t)arg_out.dimension_4() , (size_t)arg_in.dimension_4() ) )
1490 , n5( std::min( (
size_t)arg_out.dimension_5() , (size_t)arg_in.dimension_5() ) )
1491 , n6( std::min( (
size_t)arg_out.dimension_6() , (size_t)arg_in.dimension_6() ) )
1492 , n7( std::min( (
size_t)arg_out.dimension_7() , (size_t)arg_in.dimension_7() ) )
1499 KOKKOS_INLINE_FUNCTION
1500 void operator()(
const size_t i0 )
const 1502 for (
size_t i1 = 0 ; i1 < n1 ; ++i1 ) {
1503 for (
size_t i2 = 0 ; i2 < n2 ; ++i2 ) {
1504 for (
size_t i3 = 0 ; i3 < n3 ; ++i3 ) {
1505 for (
size_t i4 = 0 ; i4 < n4 ; ++i4 ) {
1506 for (
size_t i5 = 0 ; i5 < n5 ; ++i5 ) {
1507 for (
size_t i6 = 0 ; i6 < n6 ; ++i6 ) {
1508 output(i0,i1,i2,i3,i4,i5,i6) = input(i0,i1,i2,i3,i4,i5,i6);
1522 template<
class DT ,
class ... DP >
1525 (
const DynRankView<DT,DP...> & dst
1526 ,
typename ViewTraits<DT,DP...>::const_value_type & value
1527 ,
typename std::enable_if<
1528 std::is_same<
typename ViewTraits<DT,DP...>::specialize ,
void >::value
1532 std::is_same<
typename ViewTraits<DT,DP...>::non_const_value_type ,
1533 typename ViewTraits<DT,DP...>::value_type >::value
1534 ,
"deep_copy requires non-const type" );
1536 Kokkos::Experimental::Impl::DynRankViewFill< DynRankView<DT,DP...> >( dst , value );
1540 template<
class ST ,
class ... SP >
1543 (
typename ViewTraits<ST,SP...>::non_const_value_type & dst
1544 ,
const DynRankView<ST,SP...> & src
1545 ,
typename std::enable_if<
1546 std::is_same<
typename ViewTraits<ST,SP...>::specialize ,
void >::value
1549 if ( src.rank() != 0 )
1555 typedef typename src_traits::memory_space src_memory_space ;
1556 Kokkos::Impl::DeepCopy< HostSpace , src_memory_space >( & dst , src.data() ,
sizeof(ST) );
1563 template<
class DstType ,
class SrcType >
1566 (
const DstType & dst
1567 ,
const SrcType & src
1568 ,
typename std::enable_if<(
1569 std::is_same< typename DstType::traits::specialize , void >::value &&
1570 std::is_same< typename SrcType::traits::specialize , void >::value
1572 ( Kokkos::Experimental::is_dyn_rank_view<DstType>::value || Kokkos::Experimental::is_dyn_rank_view<SrcType>::value)
1576 std::is_same<
typename DstType::traits::value_type ,
1577 typename DstType::traits::non_const_value_type >::value
1578 ,
"deep_copy requires non-const destination type" );
1580 typedef DstType dst_type ;
1581 typedef SrcType src_type ;
1583 typedef typename dst_type::execution_space dst_execution_space ;
1584 typedef typename src_type::execution_space src_execution_space ;
1585 typedef typename dst_type::memory_space dst_memory_space ;
1586 typedef typename src_type::memory_space src_memory_space ;
1588 enum { DstExecCanAccessSrc =
1591 enum { SrcExecCanAccessDst =
1594 if ( (
void *) dst.data() != (
void*) src.data() ) {
1600 if (
rank(src) == 0 &&
rank(dst) == 0 )
1602 typedef typename dst_type::value_type value_type ;
1603 Kokkos::Impl::DeepCopy< dst_memory_space , src_memory_space >( dst.data() , src.data() ,
sizeof(value_type) );
1605 else if ( std::is_same<
typename DstType::traits::value_type ,
1606 typename SrcType::traits::non_const_value_type >::value &&
1608 ( std::is_same<
typename DstType::traits::array_layout ,
1609 typename SrcType::traits::array_layout >::value
1611 ( std::is_same<
typename DstType::traits::array_layout ,
1614 std::is_same<
typename DstType::traits::array_layout ,
1625 dst.span_is_contiguous() &&
1626 src.span_is_contiguous() &&
1627 dst.span() == src.span() &&
1628 dst.dimension_0() == src.dimension_0() &&
1629 dst.dimension_1() == src.dimension_1() &&
1630 dst.dimension_2() == src.dimension_2() &&
1631 dst.dimension_3() == src.dimension_3() &&
1632 dst.dimension_4() == src.dimension_4() &&
1633 dst.dimension_5() == src.dimension_5() &&
1634 dst.dimension_6() == src.dimension_6() &&
1635 dst.dimension_7() == src.dimension_7() ) {
1637 const size_t nbytes =
sizeof(
typename dst_type::value_type) * dst.span();
1639 Kokkos::Impl::DeepCopy< dst_memory_space , src_memory_space >( dst.data() , src.data() , nbytes );
1641 else if ( std::is_same<
typename DstType::traits::value_type ,
1642 typename SrcType::traits::non_const_value_type >::value &&
1644 ( std::is_same<
typename DstType::traits::array_layout ,
1645 typename SrcType::traits::array_layout >::value
1647 std::is_same<
typename DstType::traits::array_layout ,
1657 dst.span_is_contiguous() &&
1658 src.span_is_contiguous() &&
1659 dst.span() == src.span() &&
1660 dst.dimension_0() == src.dimension_0() &&
1661 dst.dimension_1() == src.dimension_1() &&
1662 dst.dimension_2() == src.dimension_2() &&
1663 dst.dimension_3() == src.dimension_3() &&
1664 dst.dimension_4() == src.dimension_4() &&
1665 dst.dimension_5() == src.dimension_5() &&
1666 dst.dimension_6() == src.dimension_6() &&
1667 dst.dimension_7() == src.dimension_7() &&
1668 dst.stride_0() == src.stride_0() &&
1669 dst.stride_1() == src.stride_1() &&
1670 dst.stride_2() == src.stride_2() &&
1671 dst.stride_3() == src.stride_3() &&
1672 dst.stride_4() == src.stride_4() &&
1673 dst.stride_5() == src.stride_5() &&
1674 dst.stride_6() == src.stride_6() &&
1675 dst.stride_7() == src.stride_7()
1678 const size_t nbytes =
sizeof(
typename dst_type::value_type) * dst.span();
1680 Kokkos::Impl::DeepCopy< dst_memory_space , src_memory_space >( dst.data() , src.data() , nbytes );
1682 else if ( DstExecCanAccessSrc ) {
1684 Kokkos::Experimental::Impl::DynRankViewRemap< dst_type , src_type >( dst , src );
1686 else if ( SrcExecCanAccessDst ) {
1688 Kokkos::Experimental::Impl::DynRankViewRemap< dst_type , src_type , src_execution_space >( dst , src );
1691 Kokkos::Impl::throw_runtime_exception(
"deep_copy given views that would require a temporary allocation");
1710 template<
class Space,
class T,
class ... P>
1711 struct MirrorDRViewType {
1713 typedef typename Kokkos::Experimental::DynRankView<T,P...> src_view_type;
1715 typedef typename Space::memory_space memory_space;
1717 enum { is_same_memspace = std::is_same<memory_space,typename src_view_type::memory_space>::value };
1719 typedef typename src_view_type::array_layout array_layout;
1721 typedef typename src_view_type::non_const_data_type data_type;
1723 typedef Kokkos::Experimental::DynRankView<data_type,array_layout,Space> dest_view_type;
1726 typedef typename std::conditional<is_same_memspace,src_view_type,dest_view_type>::type view_type;
1729 template<
class Space,
class T,
class ... P>
1730 struct MirrorDRVType {
1732 typedef typename Kokkos::Experimental::DynRankView<T,P...> src_view_type;
1734 typedef typename Space::memory_space memory_space;
1736 enum { is_same_memspace = std::is_same<memory_space,typename src_view_type::memory_space>::value };
1738 typedef typename src_view_type::array_layout array_layout;
1740 typedef typename src_view_type::non_const_data_type data_type;
1742 typedef Kokkos::Experimental::DynRankView<data_type,array_layout,Space> view_type;
1748 template<
class T ,
class ... P >
1750 typename DynRankView<T,P...>::HostMirror
1751 create_mirror(
const DynRankView<T,P...> & src
1752 ,
typename std::enable_if<
1753 ! std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
1758 typedef DynRankView<T,P...> src_type ;
1759 typedef typename src_type::HostMirror dst_type ;
1761 return dst_type( std::string( src.label() ).append(
"_mirror")
1762 , Impl::reconstructLayout(src.layout(), src.rank()) );
1766 template<
class T ,
class ... P >
1768 typename DynRankView<T,P...>::HostMirror
1769 create_mirror(
const DynRankView<T,P...> & src
1770 ,
typename std::enable_if<
1771 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
1776 typedef DynRankView<T,P...> src_type ;
1777 typedef typename src_type::HostMirror dst_type ;
1779 return dst_type( std::string( src.label() ).append(
"_mirror")
1780 , Impl::reconstructLayout(src.layout(), src.rank()) );
1785 template<
class Space,
class T,
class ... P>
1786 typename Impl::MirrorDRVType<Space,T,P ...>::view_type create_mirror(
const Space& ,
const Kokkos::Experimental::DynRankView<T,P...> & src) {
1787 return typename Impl::MirrorDRVType<Space,T,P ...>::view_type(src.label(), Impl::reconstructLayout(src.layout(), src.rank()) );
1790 template<
class T ,
class ... P >
1792 typename DynRankView<T,P...>::HostMirror
1793 create_mirror_view(
const DynRankView<T,P...> & src
1794 ,
typename std::enable_if<(
1795 std::is_same<
typename DynRankView<T,P...>::memory_space
1796 ,
typename DynRankView<T,P...>::HostMirror::memory_space
1799 std::is_same<
typename DynRankView<T,P...>::data_type
1800 ,
typename DynRankView<T,P...>::HostMirror::data_type
1808 template<
class T ,
class ... P >
1810 typename DynRankView<T,P...>::HostMirror
1811 create_mirror_view(
const DynRankView<T,P...> & src
1812 ,
typename std::enable_if< ! (
1813 std::is_same<
typename DynRankView<T,P...>::memory_space
1814 ,
typename DynRankView<T,P...>::HostMirror::memory_space
1817 std::is_same<
typename DynRankView<T,P...>::data_type
1818 ,
typename DynRankView<T,P...>::HostMirror::data_type
1823 return Kokkos::Experimental::create_mirror( src );
1827 template<
class Space,
class T,
class ... P>
1828 typename Impl::MirrorDRViewType<Space,T,P ...>::view_type
1829 create_mirror_view(
const Space& ,
const Kokkos::Experimental::DynRankView<T,P...> & src
1830 ,
typename std::enable_if<Impl::MirrorDRViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
1835 template<
class Space,
class T,
class ... P>
1836 typename Impl::MirrorDRViewType<Space,T,P ...>::view_type
1837 create_mirror_view(
const Space& ,
const Kokkos::Experimental::DynRankView<T,P...> & src
1838 ,
typename std::enable_if<!Impl::MirrorDRViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
1839 return typename Impl::MirrorDRViewType<Space,T,P ...>::view_type(src.label(), Impl::reconstructLayout(src.layout(), src.rank()) );
1852 template<
class T ,
class ... P >
1855 const size_t n0 = ~
size_t(0) ,
1856 const size_t n1 = ~
size_t(0) ,
1857 const size_t n2 = ~
size_t(0) ,
1858 const size_t n3 = ~
size_t(0) ,
1859 const size_t n4 = ~
size_t(0) ,
1860 const size_t n5 = ~
size_t(0) ,
1861 const size_t n6 = ~
size_t(0) ,
1862 const size_t n7 = ~
size_t(0) )
1864 typedef DynRankView<T,P...> drview_type ;
1868 drview_type v_resized( v.label(), n0, n1, n2, n3, n4, n5, n6 );
1870 Kokkos::Experimental::Impl::DynRankViewRemap< drview_type , drview_type >( v_resized, v );
1876 template<
class T ,
class ... P >
1879 const size_t n0 = ~
size_t(0) ,
1880 const size_t n1 = ~
size_t(0) ,
1881 const size_t n2 = ~
size_t(0) ,
1882 const size_t n3 = ~
size_t(0) ,
1883 const size_t n4 = ~
size_t(0) ,
1884 const size_t n5 = ~
size_t(0) ,
1885 const size_t n6 = ~
size_t(0) ,
1886 const size_t n7 = ~
size_t(0) )
1888 typedef DynRankView<T,P...> drview_type ;
1892 const std::string label = v.label();
1895 v = drview_type( label, n0, n1, n2, n3, n4, n5, n6 );
1902 using Kokkos::Experimental::is_dyn_rank_view ;
1906 template<
typename D ,
class ... P >
1907 using DynRankView = Kokkos::Experimental::DynRankView< D , P... > ;
1910 using Kokkos::Experimental::create_mirror ;
1911 using Kokkos::Experimental::create_mirror_view ;
1912 using Kokkos::Experimental::subdynrankview ;
1913 using Kokkos::Experimental::subview ;
std::enable_if< std::is_same< typename Kokkos::View< T, P... >::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::View< T, P... >::array_layout, Kokkos::LayoutRight >::value >::type resize(Kokkos::View< T, P... > &v, const size_t n0=0, const size_t n1=0, const size_t n2=0, const size_t n3=0, const size_t n4=0, const size_t n5=0, const size_t n6=0, const size_t n7=0)
Resize a view with copying old data to new data at the corresponding indices.
KOKKOS_INLINE_FUNCTION bool dyn_rank_view_verify_operator_bounds(const iType0 &, const MapType &)
Debug bounds-checking routines.
Memory layout tag indicating left-to-right (Fortran scheme) striding of multi-indices.
std::enable_if< std::is_same< typename Kokkos::View< T, P... >::array_layout, Kokkos::LayoutLeft >::value||std::is_same< typename Kokkos::View< T, P... >::array_layout, Kokkos::LayoutRight >::value >::type realloc(Kokkos::View< T, P... > &v, const size_t n0=0, const size_t n1=0, const size_t n2=0, const size_t n3=0, const size_t n4=0, const size_t n5=0, const size_t n6=0, const size_t n7=0)
Resize a view with discarding old data.
KOKKOS_INLINE_FUNCTION bool operator!=(const complex< RealType > &x, const complex< RealType > &y)
Inequality operator for two complex numbers.
Memory layout tag indicated arbitrarily strided multi-index mapping into contiguous memory...
View to an array of data.
Can AccessSpace access MemorySpace ?
Assign compatible default mappings.
Memory layout tag indicating right-to-left (C or lexigraphical scheme) striding of multi-indices...
void resize(DynRankView< T, P... > &v, const size_t n0=~size_t(0), const size_t n1=~size_t(0), const size_t n2=~size_t(0), const size_t n3=~size_t(0), const size_t n4=~size_t(0), const size_t n5=~size_t(0), const size_t n6=~size_t(0), const size_t n7=~size_t(0))
Resize a view with copying old data to new data at the corresponding indices.
Implementation of the ParallelFor operator that has a partial specialization for the device...
KOKKOS_INLINE_FUNCTION bool operator==(const complex< RealType > &x, const complex< RealType > &y)
Equality operator for two complex numbers.
void realloc(DynRankView< T, P... > &v, const size_t n0=~size_t(0), const size_t n1=~size_t(0), const size_t n2=~size_t(0), const size_t n3=~size_t(0), const size_t n4=~size_t(0), const size_t n5=~size_t(0), const size_t n6=~size_t(0), const size_t n7=~size_t(0))
Resize a view with copying old data to new data at the corresponding indices.
void deep_copy(const View< DT, DP... > &dst, typename ViewTraits< DT, DP... >::const_value_type &value, typename std::enable_if< std::is_same< typename ViewTraits< DT, DP... >::specialize, void >::value >::type *=0)
Deep copy a value from Host memory into a view.
Execution policy for work over a range of an integral type.
void deep_copy(const DstType &dst, const SrcType &src, typename std::enable_if<(std::is_same< typename DstType::traits::specialize, void >::value &&std::is_same< typename SrcType::traits::specialize, void >::value &&(Kokkos::Experimental::is_dyn_rank_view< DstType >::value||Kokkos::Experimental::is_dyn_rank_view< SrcType >::value))>::type *=0)
A deep copy between views of the default specialization, compatible type, same rank, same contiguous layout.
Traits class for accessing attributes of a View.
KOKKOS_INLINE_FUNCTION constexpr unsigned rank(const View< D, P... > &V)
Temporary free function rank() until rank() is implemented in the View.