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> 71 namespace Experimental {
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)
226 template <
typename DynRankViewType ,
typename iType >
227 KOKKOS_INLINE_FUNCTION
228 void verify_dynrankview_rank ( iType N ,
const DynRankViewType &drv )
230 if ( static_cast<iType>(drv.rank()) > N )
232 Kokkos::abort(
"Need at least rank arguments to the operator()" );
240 template<
class DstTraits ,
class SrcTraits >
241 class ViewMapping< DstTraits , SrcTraits ,
242 typename std::enable_if<(
243 std::is_same< typename DstTraits::memory_space , typename SrcTraits::memory_space >::value
245 std::is_same< typename DstTraits::specialize , void >::value
247 std::is_same< typename SrcTraits::specialize , void >::value
250 std::is_same< typename DstTraits::array_layout , typename SrcTraits::array_layout >::value
254 std::is_same< typename DstTraits::array_layout , Kokkos::LayoutLeft >::value ||
255 std::is_same< typename DstTraits::array_layout , Kokkos::LayoutRight >::value ||
256 std::is_same< typename DstTraits::array_layout , Kokkos::LayoutStride >::value
260 std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutLeft >::value ||
261 std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutRight >::value ||
262 std::is_same< typename SrcTraits::array_layout , Kokkos::LayoutStride >::value
266 ) , ViewToDynRankViewTag >::type >
270 enum { is_assignable_value_type =
271 std::is_same<
typename DstTraits::value_type
272 ,
typename SrcTraits::value_type >::value ||
273 std::is_same<
typename DstTraits::value_type
274 ,
typename SrcTraits::const_value_type >::value };
276 enum { is_assignable_layout =
277 std::is_same<
typename DstTraits::array_layout
278 ,
typename SrcTraits::array_layout >::value ||
279 std::is_same<
typename DstTraits::array_layout
285 enum { is_assignable = is_assignable_value_type &&
286 is_assignable_layout };
288 typedef ViewMapping< DstTraits , void > DstType ;
289 typedef ViewMapping< SrcTraits , void > SrcType ;
291 template <
typename DT ,
typename ... DP ,
typename ST ,
typename ... SP >
292 KOKKOS_INLINE_FUNCTION
295 static_assert( is_assignable_value_type
296 ,
"View assignment must have same value type or const = non-const" );
298 static_assert( is_assignable_layout
299 ,
"View assignment must have compatible layout or have rank <= 1" );
303 typedef typename DstType::offset_type dst_offset_type ;
304 dst.m_map.m_offset = dst_offset_type(std::integral_constant<unsigned,0>() , src.layout() );
305 dst.m_map.m_handle = Kokkos::Experimental::Impl::ViewDataHandle< DstTraits >::assign( src.m_map.m_handle , src.m_track );
306 dst.m_track.assign( src.m_track , DstTraits::is_managed );
307 dst.m_rank = src.Rank ;
332 template<
class >
struct is_dyn_rank_view :
public std::false_type {};
334 template<
class D,
class ... P >
335 struct is_dyn_rank_view<
Kokkos::Experimental::DynRankView<D,P...> > :
public std::true_type {};
338 template<
typename DataType ,
class ... Properties >
339 class DynRankView :
public ViewTraits< DataType , Properties ... >
341 static_assert( !std::is_array<DataType>::value && !std::is_pointer<DataType>::value ,
"Cannot template DynRankView with array or pointer datatype - must be pod" );
344 template < class ,
class ... >
friend class DynRankView ;
345 template < class ,
class ... >
friend class Impl::ViewMapping ;
348 typedef ViewTraits< DataType , Properties ... > drvtraits ;
350 typedef View< DataType******* , Properties...> view_type ;
352 typedef ViewTraits< DataType******* , Properties ... > traits ;
356 typedef Kokkos::Experimental::Impl::ViewMapping< traits , void > map_type ;
357 typedef Kokkos::Experimental::Impl::SharedAllocationTracker track_type ;
364 KOKKOS_INLINE_FUNCTION
365 view_type & DownCast()
const {
return ( view_type & ) (*this); }
366 KOKKOS_INLINE_FUNCTION
367 const view_type & ConstDownCast()
const {
return (
const view_type & ) (*this); }
372 typedef DynRankView<
typename drvtraits::scalar_array_type ,
373 typename drvtraits::array_layout ,
374 typename drvtraits::device_type ,
375 typename drvtraits::memory_traits >
379 typedef DynRankView<
typename drvtraits::const_data_type ,
380 typename drvtraits::array_layout ,
381 typename drvtraits::device_type ,
382 typename drvtraits::memory_traits >
386 typedef DynRankView<
typename drvtraits::non_const_data_type ,
387 typename drvtraits::array_layout ,
388 typename drvtraits::device_type ,
389 typename drvtraits::memory_traits >
393 typedef DynRankView<
typename drvtraits::non_const_data_type ,
394 typename drvtraits::array_layout ,
395 typename drvtraits::host_mirror_space >
404 template<
typename iType >
405 KOKKOS_INLINE_FUNCTION constexpr
406 typename std::enable_if< std::is_integral<iType>::value ,
size_t >::type
407 extent(
const iType & r )
const 408 {
return m_map.extent(r); }
410 template<
typename iType >
411 KOKKOS_INLINE_FUNCTION constexpr
412 typename std::enable_if< std::is_integral<iType>::value ,
int >::type
413 extent_int(
const iType & r )
const 414 {
return static_cast<int>(m_map.extent(r)); }
416 KOKKOS_INLINE_FUNCTION constexpr
417 typename traits::array_layout layout()
const 418 {
return m_map.layout(); }
425 template<
typename iType >
426 KOKKOS_INLINE_FUNCTION constexpr
427 typename std::enable_if< std::is_integral<iType>::value ,
size_t >::type
428 dimension(
const iType & r )
const {
return extent( r ); }
430 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_0()
const {
return m_map.dimension_0(); }
431 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_1()
const {
return m_map.dimension_1(); }
432 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_2()
const {
return m_map.dimension_2(); }
433 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_3()
const {
return m_map.dimension_3(); }
434 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_4()
const {
return m_map.dimension_4(); }
435 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_5()
const {
return m_map.dimension_5(); }
436 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_6()
const {
return m_map.dimension_6(); }
437 KOKKOS_INLINE_FUNCTION constexpr
size_t dimension_7()
const {
return m_map.dimension_7(); }
441 KOKKOS_INLINE_FUNCTION constexpr
size_t size()
const {
return m_map.dimension_0() *
442 m_map.dimension_1() *
443 m_map.dimension_2() *
444 m_map.dimension_3() *
445 m_map.dimension_4() *
446 m_map.dimension_5() *
447 m_map.dimension_6() *
448 m_map.dimension_7(); }
450 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_0()
const {
return m_map.stride_0(); }
451 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_1()
const {
return m_map.stride_1(); }
452 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_2()
const {
return m_map.stride_2(); }
453 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_3()
const {
return m_map.stride_3(); }
454 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_4()
const {
return m_map.stride_4(); }
455 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_5()
const {
return m_map.stride_5(); }
456 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_6()
const {
return m_map.stride_6(); }
457 KOKKOS_INLINE_FUNCTION constexpr
size_t stride_7()
const {
return m_map.stride_7(); }
459 template<
typename iType >
460 KOKKOS_INLINE_FUNCTION
void stride( iType *
const s )
const { m_map.stride(s); }
465 typedef typename map_type::reference_type reference_type ;
466 typedef typename map_type::pointer_type pointer_type ;
468 enum { reference_type_is_lvalue_reference = std::is_lvalue_reference< reference_type >::value };
470 KOKKOS_INLINE_FUNCTION constexpr
size_t span()
const {
return m_map.span(); }
472 KOKKOS_INLINE_FUNCTION constexpr
size_t capacity()
const {
return m_map.span(); }
473 KOKKOS_INLINE_FUNCTION constexpr
bool span_is_contiguous()
const {
return m_map.span_is_contiguous(); }
474 KOKKOS_INLINE_FUNCTION constexpr pointer_type data()
const {
return m_map.data(); }
477 KOKKOS_INLINE_FUNCTION constexpr
bool is_contiguous()
const {
return m_map.span_is_contiguous(); }
479 KOKKOS_INLINE_FUNCTION constexpr pointer_type ptr_on_device()
const {
return m_map.data(); }
484 KOKKOS_INLINE_FUNCTION
485 const Kokkos::Experimental::Impl::ViewMapping< traits , void > &
486 implementation_map()
const {
return m_map ; }
493 is_layout_left = std::is_same<
typename traits::array_layout
496 is_layout_right = std::is_same<
typename traits::array_layout
499 is_layout_stride = std::is_same<
typename traits::array_layout
503 std::is_same< typename traits::specialize , void >::value &&
504 ( is_layout_left || is_layout_right || is_layout_stride )
508 #if defined( KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK ) 511 #define KOKKOS_VIEW_OPERATOR_VERIFY( N , ARG ) \ 512 Kokkos::Impl::VerifyExecutionCanAccessMemorySpace \ 513 < Kokkos::Impl::ActiveExecutionMemorySpace , typename traits::memory_space >::verify(); \ 514 Kokkos::Experimental::Impl::verify_dynrankview_rank ( N , *this ) ; \ 515 Kokkos::Impl::view_verify_operator_bounds ARG ; 519 #define KOKKOS_VIEW_OPERATOR_VERIFY( N , ARG ) \ 520 Kokkos::Impl::VerifyExecutionCanAccessMemorySpace \ 521 < Kokkos::Impl::ActiveExecutionMemorySpace , typename traits::memory_space >::verify(); 527 KOKKOS_INLINE_FUNCTION
528 constexpr
unsigned rank()
const {
return m_rank; }
533 KOKKOS_INLINE_FUNCTION
534 reference_type operator()()
const 536 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 537 KOKKOS_VIEW_OPERATOR_VERIFY( 0 , (NULL , m_map) )
539 KOKKOS_VIEW_OPERATOR_VERIFY( 0 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map) )
541 return implementation_map().reference();
547 template<
typename iType >
548 KOKKOS_INLINE_FUNCTION
549 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
550 operator[](
const iType & i0)
const 557 template<
typename iType >
558 KOKKOS_INLINE_FUNCTION
559 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
560 operator[](
const iType & i0)
const 563 const size_t dim_scalar = m_map.dimension_scalar();
564 const size_t bytes = this->span() / dim_scalar;
567 tmp_view_type rankone_view(this->data(), bytes, dim_scalar);
568 return rankone_view(i0);
571 template<
typename iType >
572 KOKKOS_INLINE_FUNCTION
573 typename std::enable_if< (std::is_same<typename traits::specialize , void>::value && std::is_integral<iType>::value), reference_type>::type
574 operator()(
const iType & i0 )
const 576 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 577 KOKKOS_VIEW_OPERATOR_VERIFY( 1 , (NULL , m_map , i0) )
579 KOKKOS_VIEW_OPERATOR_VERIFY( 1 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0) )
581 return m_map.reference(i0);
584 template<
typename iType >
585 KOKKOS_INLINE_FUNCTION
586 typename std::enable_if< !(std::is_same<typename traits::specialize , void>::value && std::is_integral<iType>::value), reference_type>::type
587 operator()(
const iType & i0 )
const 589 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 590 KOKKOS_VIEW_OPERATOR_VERIFY( 1 , (NULL , m_map , i0) )
592 KOKKOS_VIEW_OPERATOR_VERIFY( 1 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0) )
594 return m_map.reference(i0,0,0,0,0,0,0);
598 template<
typename iType0 ,
typename iType1 >
599 KOKKOS_INLINE_FUNCTION
600 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
601 operator()(
const iType0 & i0 ,
const iType1 & i1 )
const 603 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 604 KOKKOS_VIEW_OPERATOR_VERIFY( 2 , (NULL , m_map , i0 , i1) )
606 KOKKOS_VIEW_OPERATOR_VERIFY( 2 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1) )
608 return m_map.reference(i0,i1);
611 template<
typename iType0 ,
typename iType1 >
612 KOKKOS_INLINE_FUNCTION
613 typename std::enable_if< !(std::is_same<typename drvtraits::specialize , void>::value && std::is_integral<iType0>::value), reference_type>::type
614 operator()(
const iType0 & i0 ,
const iType1 & i1 )
const 616 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 617 KOKKOS_VIEW_OPERATOR_VERIFY( 2 , (NULL , m_map , i0 , i1) )
619 KOKKOS_VIEW_OPERATOR_VERIFY( 2 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1) )
621 return m_map.reference(i0,i1,0,0,0,0,0);
625 template<
typename iType0 ,
typename iType1 ,
typename iType2 >
626 KOKKOS_INLINE_FUNCTION
627 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
628 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 )
const 630 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 631 KOKKOS_VIEW_OPERATOR_VERIFY( 3 , (NULL , m_map , i0 , i1 , i2) )
633 KOKKOS_VIEW_OPERATOR_VERIFY( 3 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1,i2) )
635 return m_map.reference(i0,i1,i2);
638 template<
typename iType0 ,
typename iType1 ,
typename iType2 >
639 KOKKOS_INLINE_FUNCTION
640 typename std::enable_if< !(std::is_same<typename drvtraits::specialize , void>::value && std::is_integral<iType0>::value), reference_type>::type
641 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 )
const 643 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 644 KOKKOS_VIEW_OPERATOR_VERIFY( 3 , (NULL , m_map , i0 , i1 , i2) )
646 KOKKOS_VIEW_OPERATOR_VERIFY( 3 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1,i2) )
648 return m_map.reference(i0,i1,i2,0,0,0,0);
652 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3 >
653 KOKKOS_INLINE_FUNCTION
654 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
655 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 )
const 657 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 658 KOKKOS_VIEW_OPERATOR_VERIFY( 4 , (NULL , m_map , i0 , i1 , i2 , i3) )
660 KOKKOS_VIEW_OPERATOR_VERIFY( 4 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1,i2,i3) )
662 return m_map.reference(i0,i1,i2,i3);
665 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3 >
666 KOKKOS_INLINE_FUNCTION
667 typename std::enable_if< !(std::is_same<typename drvtraits::specialize , void>::value && std::is_integral<iType0>::value), reference_type>::type
668 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 )
const 670 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 671 KOKKOS_VIEW_OPERATOR_VERIFY( 4 , (NULL , m_map , i0 , i1 , i2 , i3) )
673 KOKKOS_VIEW_OPERATOR_VERIFY( 4 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1,i2,i3) )
675 return m_map.reference(i0,i1,i2,i3,0,0,0);
679 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3,
typename iType4 >
680 KOKKOS_INLINE_FUNCTION
681 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
682 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 ,
const iType4 & i4 )
const 684 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 685 KOKKOS_VIEW_OPERATOR_VERIFY( 5 , (NULL , m_map , i0 , i1 , i2 , i3, i4) )
687 KOKKOS_VIEW_OPERATOR_VERIFY( 5 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1,i2,i3,i4) )
689 return m_map.reference(i0,i1,i2,i3,i4);
692 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3,
typename iType4 >
693 KOKKOS_INLINE_FUNCTION
694 typename std::enable_if< !(std::is_same<typename drvtraits::specialize , void>::value && std::is_integral<iType0>::value), reference_type>::type
695 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 ,
const iType4 & i4 )
const 697 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 698 KOKKOS_VIEW_OPERATOR_VERIFY( 5 , (NULL , m_map , i0 , i1 , i2 , i3, i4) )
700 KOKKOS_VIEW_OPERATOR_VERIFY( 5 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1,i2,i3,i4) )
702 return m_map.reference(i0,i1,i2,i3,i4,0,0);
706 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3,
typename iType4 ,
typename iType5 >
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 && std::is_integral<iType4>::value && std::is_integral<iType5>::value), reference_type>::type
709 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 ,
const iType4 & i4 ,
const iType5 & i5 )
const 711 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 712 KOKKOS_VIEW_OPERATOR_VERIFY( 6 , (NULL , m_map , i0 , i1 , i2 , i3, i4 , i5) )
714 KOKKOS_VIEW_OPERATOR_VERIFY( 6 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1,i2,i3,i4,i5) )
716 return m_map.reference(i0,i1,i2,i3,i4,i5);
719 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3,
typename iType4 ,
typename iType5 >
720 KOKKOS_INLINE_FUNCTION
721 typename std::enable_if< !(std::is_same<typename drvtraits::specialize , void>::value && std::is_integral<iType0>::value), reference_type>::type
722 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 ,
const iType4 & i4 ,
const iType5 & i5 )
const 724 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 725 KOKKOS_VIEW_OPERATOR_VERIFY( 6 , (NULL , m_map , i0 , i1 , i2 , i3, i4 , i5) )
727 KOKKOS_VIEW_OPERATOR_VERIFY( 6 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1,i2,i3,i4,i5) )
729 return m_map.reference(i0,i1,i2,i3,i4,i5,0);
733 template<
typename iType0 ,
typename iType1 ,
typename iType2 ,
typename iType3,
typename iType4 ,
typename iType5 ,
typename iType6 >
734 KOKKOS_INLINE_FUNCTION
735 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
736 operator()(
const iType0 & i0 ,
const iType1 & i1 ,
const iType2 & i2 ,
const iType3 & i3 ,
const iType4 & i4 ,
const iType5 & i5 ,
const iType6 & i6 )
const 738 #ifndef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 739 KOKKOS_VIEW_OPERATOR_VERIFY( 7 , (NULL , m_map , i0 , i1 , i2 , i3, i4 , i5 , i6) )
741 KOKKOS_VIEW_OPERATOR_VERIFY( 7 , (m_track.template get_label<typename traits::memory_space>().c_str(),m_map,i0,i1,i2,i3,i4,i5,i6) )
743 return m_map.reference(i0,i1,i2,i3,i4,i5,i6);
746 #undef KOKKOS_VIEW_OPERATOR_VERIFY 751 KOKKOS_INLINE_FUNCTION
754 KOKKOS_INLINE_FUNCTION
755 DynRankView() : m_track(), m_map(), m_rank() {}
757 KOKKOS_INLINE_FUNCTION
758 DynRankView(
const DynRankView & rhs ) : m_track( rhs.m_track ), m_map( rhs.m_map ), m_rank(rhs.m_rank) {}
760 KOKKOS_INLINE_FUNCTION
761 DynRankView( DynRankView && rhs ) : m_track( rhs.m_track ), m_map( rhs.m_map ), m_rank(rhs.m_rank) {}
763 KOKKOS_INLINE_FUNCTION
764 DynRankView & operator = (
const DynRankView & rhs ) { m_track = rhs.m_track; m_map = rhs.m_map; m_rank = rhs.m_rank;
return *
this; }
766 KOKKOS_INLINE_FUNCTION
767 DynRankView & operator = ( DynRankView && rhs ) { m_track = rhs.m_track; m_map = rhs.m_map; m_rank = rhs.m_rank;
return *
this; }
772 template<
class RT ,
class ... RP >
773 KOKKOS_INLINE_FUNCTION
774 DynRankView(
const DynRankView<RT,RP...> & rhs )
775 : m_track( rhs.m_track , traits::is_managed )
779 typedef typename DynRankView<RT,RP...> ::traits SrcTraits ;
780 typedef Kokkos::Experimental::Impl::ViewMapping< traits , SrcTraits , void > Mapping ;
781 static_assert( Mapping::is_assignable ,
"Incompatible DynRankView copy construction" );
782 Mapping::assign( m_map , rhs.m_map , rhs.m_track );
785 template<
class RT ,
class ... RP >
786 KOKKOS_INLINE_FUNCTION
787 DynRankView & operator = (
const DynRankView<RT,RP...> & rhs )
789 typedef typename DynRankView<RT,RP...> ::traits SrcTraits ;
790 typedef Kokkos::Experimental::Impl::ViewMapping< traits , SrcTraits , void > Mapping ;
791 static_assert( Mapping::is_assignable ,
"Incompatible DynRankView copy construction" );
792 Mapping::assign( m_map , rhs.m_map , rhs.m_track );
793 m_track.assign( rhs.m_track , traits::is_managed );
800 template<
class RT ,
class ... RP >
801 KOKKOS_INLINE_FUNCTION
802 DynRankView(
const View<RT,RP...> & rhs )
807 typedef typename View<RT,RP...>::traits SrcTraits ;
808 typedef Kokkos::Experimental::Impl::ViewMapping< traits , SrcTraits , Kokkos::Experimental::Impl::ViewToDynRankViewTag > Mapping ;
809 static_assert( Mapping::is_assignable ,
"Incompatible DynRankView copy construction" );
810 Mapping::assign( *
this , rhs );
813 template<
class RT ,
class ... RP >
814 KOKKOS_INLINE_FUNCTION
815 DynRankView & operator = (
const View<RT,RP...> & rhs )
817 typedef typename View<RT,RP...>::traits SrcTraits ;
818 typedef Kokkos::Experimental::Impl::ViewMapping< traits , SrcTraits , Kokkos::Experimental::Impl::ViewToDynRankViewTag > Mapping ;
819 static_assert( Mapping::is_assignable ,
"Incompatible View to DynRankView copy assignment" );
820 Mapping::assign( *
this , rhs );
827 KOKKOS_INLINE_FUNCTION
828 int use_count()
const 829 {
return m_track.use_count(); }
832 const std::string label()
const 833 {
return m_track.template get_label< typename traits::memory_space >(); }
838 template<
class ... P >
840 DynRankView(
const Impl::ViewCtorProp< P ... > & arg_prop
841 ,
typename std::enable_if< ! Impl::ViewCtorProp< P... >::has_pointer
842 ,
typename traits::array_layout
843 >::type
const & arg_layout
847 , m_rank( Impl::DynRankDimTraits<typename traits::specialize>::computeRank(arg_layout) )
850 typedef Impl::ViewCtorProp< P ... > alloc_prop_input ;
854 typedef Impl::ViewCtorProp
856 ,
typename std::conditional
857 < alloc_prop_input::has_label
858 , std::integral_constant<unsigned,0>
859 ,
typename std::string
861 ,
typename std::conditional
862 < alloc_prop_input::has_memory_space
863 , std::integral_constant<unsigned,1>
864 ,
typename traits::device_type::memory_space
866 ,
typename std::conditional
867 < alloc_prop_input::has_execution_space
868 , std::integral_constant<unsigned,2>
869 ,
typename traits::device_type::execution_space
873 static_assert( traits::is_managed
874 ,
"View allocation constructor requires managed memory" );
876 if ( alloc_prop::initialize &&
877 ! alloc_prop::execution_space::is_initialized() ) {
880 Kokkos::Impl::throw_runtime_exception(
"Constructing DynRankView and initializing data with uninitialized execution space");
884 alloc_prop prop( arg_prop );
887 #if defined( KOKKOS_HAVE_CUDA ) 893 if ( std::is_same< Kokkos::CudaUVMSpace , typename traits::device_type::memory_space >::value ) {
894 traits::device_type::memory_space::execution_space::fence();
899 Kokkos::Experimental::Impl::SharedAllocationRecord<> *
900 record = m_map.allocate_shared( prop , Impl::DynRankDimTraits<typename traits::specialize>::createLayout(arg_layout) );
903 #if defined( KOKKOS_HAVE_CUDA ) 904 if ( std::is_same< Kokkos::CudaUVMSpace , typename traits::device_type::memory_space >::value ) {
905 traits::device_type::memory_space::execution_space::fence();
911 m_track.assign_allocated_record_to_uninitialized( record );
916 template<
class ... P >
917 explicit KOKKOS_INLINE_FUNCTION
918 DynRankView(
const Impl::ViewCtorProp< P ... > & arg_prop
919 ,
typename std::enable_if< Impl::ViewCtorProp< P... >::has_pointer
920 ,
typename traits::array_layout
921 >::type
const & arg_layout
924 , m_map( arg_prop , Impl::DynRankDimTraits<typename traits::specialize>::createLayout(arg_layout) )
925 , m_rank( Impl::DynRankDimTraits<typename traits::specialize>::computeRank(arg_layout) )
928 std::is_same< pointer_type
929 ,
typename Impl::ViewCtorProp< P... >::pointer_type
931 "Constructing DynRankView to wrap user memory must supply matching pointer type" );
938 template<
class ... P >
940 DynRankView(
const Impl::ViewCtorProp< P ... > & arg_prop
941 ,
typename std::enable_if< ! Impl::ViewCtorProp< P... >::has_pointer
943 >::type
const arg_N0 = ~
size_t(0)
944 ,
const size_t arg_N1 = ~
size_t(0)
945 ,
const size_t arg_N2 = ~
size_t(0)
946 ,
const size_t arg_N3 = ~
size_t(0)
947 ,
const size_t arg_N4 = ~
size_t(0)
948 ,
const size_t arg_N5 = ~
size_t(0)
949 ,
const size_t arg_N6 = ~
size_t(0)
950 ,
const size_t arg_N7 = ~
size_t(0)
952 : DynRankView( arg_prop
953 , typename traits::array_layout
954 ( arg_N0 , arg_N1 , arg_N2 , arg_N3 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
958 template<
class ... P >
959 explicit KOKKOS_INLINE_FUNCTION
960 DynRankView(
const Impl::ViewCtorProp< P ... > & arg_prop
961 ,
typename std::enable_if< Impl::ViewCtorProp< P... >::has_pointer
963 >::type
const arg_N0 = ~
size_t(0)
964 ,
const size_t arg_N1 = ~
size_t(0)
965 ,
const size_t arg_N2 = ~
size_t(0)
966 ,
const size_t arg_N3 = ~
size_t(0)
967 ,
const size_t arg_N4 = ~
size_t(0)
968 ,
const size_t arg_N5 = ~
size_t(0)
969 ,
const size_t arg_N6 = ~
size_t(0)
970 ,
const size_t arg_N7 = ~
size_t(0)
972 : DynRankView( arg_prop
973 , typename traits::array_layout
974 ( arg_N0 , arg_N1 , arg_N2 , arg_N3 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
979 template<
typename Label >
981 DynRankView(
const Label & arg_label
982 ,
typename std::enable_if<
983 Kokkos::Experimental::Impl::is_view_label<Label>::value ,
984 typename traits::array_layout >::type
const & arg_layout
986 : DynRankView( Impl::ViewCtorProp< std::string >( arg_label ) , arg_layout )
990 template<
typename Label >
992 DynRankView(
const Label & arg_label
993 ,
typename std::enable_if<
994 Kokkos::Experimental::Impl::is_view_label<Label>::value ,
995 const size_t >::type arg_N0 = ~
size_t(0)
996 ,
const size_t arg_N1 = ~
size_t(0)
997 ,
const size_t arg_N2 = ~
size_t(0)
998 ,
const size_t arg_N3 = ~
size_t(0)
999 ,
const size_t arg_N4 = ~
size_t(0)
1000 ,
const size_t arg_N5 = ~
size_t(0)
1001 ,
const size_t arg_N6 = ~
size_t(0)
1002 ,
const size_t arg_N7 = ~
size_t(0)
1004 : DynRankView( Impl::ViewCtorProp< std::string >( arg_label )
1005 , typename traits::array_layout
1006 ( arg_N0 , arg_N1 , arg_N2 , arg_N3 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
1012 DynRankView(
const ViewAllocateWithoutInitializing & arg_prop
1013 ,
const typename traits::array_layout & arg_layout
1015 : DynRankView( Impl::ViewCtorProp< std::string ,
Kokkos::Experimental::Impl::WithoutInitializing_t >( arg_prop.label ,
Kokkos::Experimental::WithoutInitializing )
1016 , Impl::DynRankDimTraits<typename traits::specialize>::createLayout(arg_layout)
1021 DynRankView(
const ViewAllocateWithoutInitializing & arg_prop
1022 ,
const size_t arg_N0 = ~
size_t(0)
1023 ,
const size_t arg_N1 = ~
size_t(0)
1024 ,
const size_t arg_N2 = ~
size_t(0)
1025 ,
const size_t arg_N3 = ~
size_t(0)
1026 ,
const size_t arg_N4 = ~
size_t(0)
1027 ,
const size_t arg_N5 = ~
size_t(0)
1028 ,
const size_t arg_N6 = ~
size_t(0)
1029 ,
const size_t arg_N7 = ~
size_t(0)
1031 : 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 )
1036 static constexpr
size_t required_allocation_size(
1037 const size_t arg_N0 = 0
1038 ,
const size_t arg_N1 = 0
1039 ,
const size_t arg_N2 = 0
1040 ,
const size_t arg_N3 = 0
1041 ,
const size_t arg_N4 = 0
1042 ,
const size_t arg_N5 = 0
1043 ,
const size_t arg_N6 = 0
1044 ,
const size_t arg_N7 = 0
1047 return map_type::memory_span(
1048 typename traits::array_layout
1049 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
1050 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) );
1053 explicit KOKKOS_INLINE_FUNCTION
1054 DynRankView( pointer_type arg_ptr
1055 ,
const size_t arg_N0 = ~
size_t(0)
1056 ,
const size_t arg_N1 = ~
size_t(0)
1057 ,
const size_t arg_N2 = ~
size_t(0)
1058 ,
const size_t arg_N3 = ~
size_t(0)
1059 ,
const size_t arg_N4 = ~
size_t(0)
1060 ,
const size_t arg_N5 = ~
size_t(0)
1061 ,
const size_t arg_N6 = ~
size_t(0)
1062 ,
const size_t arg_N7 = ~
size_t(0)
1064 : DynRankView( Impl::ViewCtorProp<pointer_type>(arg_ptr) , arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7 )
1067 explicit KOKKOS_INLINE_FUNCTION
1068 DynRankView( pointer_type arg_ptr
1069 ,
typename traits::array_layout & arg_layout
1071 : DynRankView( Impl::ViewCtorProp<pointer_type>(arg_ptr) , arg_layout )
1079 size_t shmem_size(
const size_t arg_N0 = ~
size_t(0) ,
1080 const size_t arg_N1 = ~
size_t(0) ,
1081 const size_t arg_N2 = ~
size_t(0) ,
1082 const size_t arg_N3 = ~
size_t(0) ,
1083 const size_t arg_N4 = ~
size_t(0) ,
1084 const size_t arg_N5 = ~
size_t(0) ,
1085 const size_t arg_N6 = ~
size_t(0) ,
1086 const size_t arg_N7 = ~
size_t(0) )
1088 const size_t num_passed_args =
1089 ( arg_N0 != ~size_t(0) ) + ( arg_N1 != ~
size_t(0) ) + ( arg_N2 != ~
size_t(0) ) +
1090 ( arg_N3 != ~
size_t(0) ) + ( arg_N4 != ~
size_t(0) ) + ( arg_N5 != ~
size_t(0) ) +
1091 ( arg_N6 != ~
size_t(0) ) + ( arg_N7 != ~
size_t(0) );
1093 if ( std::is_same<typename traits::specialize , void>::value && num_passed_args != traits::rank_dynamic ) {
1094 Kokkos::abort(
"Kokkos::View::shmem_size() rank_dynamic != number of arguments.\n" );
1098 return map_type::memory_span(
1099 typename traits::array_layout
1100 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
1101 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) );
1104 explicit KOKKOS_INLINE_FUNCTION
1105 DynRankView(
const typename traits::execution_space::scratch_memory_space & arg_space
1106 ,
const typename traits::array_layout & arg_layout )
1107 : DynRankView( Impl::ViewCtorProp<pointer_type>(
1108 reinterpret_cast<pointer_type>(
1109 arg_space.get_shmem( map_type::memory_span(
1110 Impl::DynRankDimTraits<typename traits::specialize>::createLayout( arg_layout )
1115 explicit KOKKOS_INLINE_FUNCTION
1116 DynRankView(
const typename traits::execution_space::scratch_memory_space & arg_space
1117 ,
const size_t arg_N0 = ~
size_t(0)
1118 ,
const size_t arg_N1 = ~
size_t(0)
1119 ,
const size_t arg_N2 = ~
size_t(0)
1120 ,
const size_t arg_N3 = ~
size_t(0)
1121 ,
const size_t arg_N4 = ~
size_t(0)
1122 ,
const size_t arg_N5 = ~
size_t(0)
1123 ,
const size_t arg_N6 = ~
size_t(0)
1124 ,
const size_t arg_N7 = ~
size_t(0) )
1126 : DynRankView( Impl::ViewCtorProp<pointer_type>(
1127 reinterpret_cast<pointer_type>(
1128 arg_space.get_shmem(
1129 map_type::memory_span(
1130 Impl::DynRankDimTraits<typename traits::specialize>::createLayout(
1131 typename traits::array_layout
1132 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
1133 , arg_N4 , arg_N5 , arg_N6 , arg_N7 ) ) ) ) )
1135 , typename traits::array_layout
1136 ( arg_N0 , arg_N1 , arg_N2 , arg_N3
1137 , arg_N4 , arg_N5 , arg_N6 , arg_N7 )
1144 template <
typename D ,
class ... P >
1145 KOKKOS_INLINE_FUNCTION
1146 constexpr
unsigned rank(
const DynRankView<D , P...> & DRV ) {
return DRV.rank(); }
1154 struct DynRankSubviewTag {};
1156 template<
class SrcTraits ,
class ... Args >
1158 < typename std::enable_if<(
1159 std::is_same< typename SrcTraits::specialize , void >::value
1162 std::is_same< typename SrcTraits::array_layout
1163 , Kokkos::LayoutLeft >::value ||
1164 std::is_same< typename SrcTraits::array_layout
1165 , Kokkos::LayoutRight >::value ||
1166 std::is_same< typename SrcTraits::array_layout
1167 , Kokkos::LayoutStride >::value
1169 ), DynRankSubviewTag >::type
1177 , R0 = bool(is_integral_extent<0,Args...>::value)
1178 , R1 = bool(is_integral_extent<1,Args...>::value)
1179 , R2 = bool(is_integral_extent<2,Args...>::value)
1180 , R3 = bool(is_integral_extent<3,Args...>::value)
1181 , R4 = bool(is_integral_extent<4,Args...>::value)
1182 , R5 = bool(is_integral_extent<5,Args...>::value)
1183 , R6 = bool(is_integral_extent<6,Args...>::value)
1186 enum {
rank = unsigned(R0) + unsigned(R1) + unsigned(R2) + unsigned(R3)
1187 + unsigned(R4) + unsigned(R5) + unsigned(R6) };
1191 typedef typename SrcTraits::value_type value_type ;
1193 typedef value_type******* data_type ;
1200 ,
typename SrcTraits::device_type
1201 ,
typename SrcTraits::memory_traits > traits_type ;
1206 ,
typename SrcTraits::device_type
1207 ,
typename SrcTraits::memory_traits > type ;
1210 template<
class MemoryTraits >
1213 static_assert( Kokkos::Impl::is_memory_traits< MemoryTraits >::value ,
"" );
1218 ,
typename SrcTraits::device_type
1219 , MemoryTraits > traits_type ;
1224 ,
typename SrcTraits::device_type
1225 , MemoryTraits > type ;
1229 typedef typename SrcTraits::dimension dimension ;
1231 template <
class Arg0 =
int,
class Arg1 =
int,
class Arg2 =
int,
class Arg3 =
int,
class Arg4 =
int,
class Arg5 =
int,
class Arg6 =
int >
1232 struct ExtentGenerator {
1233 KOKKOS_INLINE_FUNCTION
1234 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() )
1236 return SubviewExtents< 7 , rank>( dim , arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 );
1241 typedef DynRankView< value_type , array_layout , typename SrcTraits::device_type , typename SrcTraits::memory_traits > ret_type;
1243 template <
typename T ,
class ... P >
1244 KOKKOS_INLINE_FUNCTION
1245 static ret_type subview(
const unsigned src_rank , Kokkos::Experimental::DynRankView< T , P...>
const & src
1249 typedef ViewMapping< traits_type, void > DstType ;
1251 typedef typename std::conditional< (rank==0) , ViewDimension<>
1252 ,
typename std::conditional< (rank==1) , ViewDimension<0>
1253 ,
typename std::conditional< (rank==2) , ViewDimension<0,0>
1254 ,
typename std::conditional< (rank==3) , ViewDimension<0,0,0>
1255 ,
typename std::conditional< (rank==4) , ViewDimension<0,0,0,0>
1256 ,
typename std::conditional< (rank==5) , ViewDimension<0,0,0,0,0>
1257 ,
typename std::conditional< (rank==6) , ViewDimension<0,0,0,0,0,0>
1258 , ViewDimension<0,0,0,0,0,0,0>
1259 >::type >::type >::type >::type >::type >::type >::type DstDimType ;
1261 typedef ViewOffset< DstDimType , Kokkos::LayoutStride > dst_offset_type ;
1262 typedef typename DstType::handle_type dst_handle_type ;
1266 const SubviewExtents< 7 , rank > extents =
1267 ExtentGenerator< Args ... >::generator( src.m_map.m_offset.m_dim , args... ) ;
1269 dst_offset_type tempdst( src.m_map.m_offset , extents ) ;
1271 dst.m_track = src.m_track ;
1273 dst.m_map.m_offset.m_dim.N0 = tempdst.m_dim.N0 ;
1274 dst.m_map.m_offset.m_dim.N1 = tempdst.m_dim.N1 ;
1275 dst.m_map.m_offset.m_dim.N2 = tempdst.m_dim.N2 ;
1276 dst.m_map.m_offset.m_dim.N3 = tempdst.m_dim.N3 ;
1277 dst.m_map.m_offset.m_dim.N4 = tempdst.m_dim.N4 ;
1278 dst.m_map.m_offset.m_dim.N5 = tempdst.m_dim.N5 ;
1279 dst.m_map.m_offset.m_dim.N6 = tempdst.m_dim.N6 ;
1281 dst.m_map.m_offset.m_stride.S0 = tempdst.m_stride.S0 ;
1282 dst.m_map.m_offset.m_stride.S1 = tempdst.m_stride.S1 ;
1283 dst.m_map.m_offset.m_stride.S2 = tempdst.m_stride.S2 ;
1284 dst.m_map.m_offset.m_stride.S3 = tempdst.m_stride.S3 ;
1285 dst.m_map.m_offset.m_stride.S4 = tempdst.m_stride.S4 ;
1286 dst.m_map.m_offset.m_stride.S5 = tempdst.m_stride.S5 ;
1287 dst.m_map.m_offset.m_stride.S6 = tempdst.m_stride.S6 ;
1289 dst.m_map.m_handle = dst_handle_type( src.m_map.m_handle +
1290 src.m_map.m_offset( extents.domain_offset(0)
1291 , extents.domain_offset(1)
1292 , extents.domain_offset(2)
1293 , extents.domain_offset(3)
1294 , extents.domain_offset(4)
1295 , extents.domain_offset(5)
1296 , extents.domain_offset(6)
1299 dst.m_rank = ( src_rank > 0 ? unsigned(R0) : 0 )
1300 + ( src_rank > 1 ? unsigned(R1) : 0 )
1301 + ( src_rank > 2 ? unsigned(R2) : 0 )
1302 + ( src_rank > 3 ? unsigned(R3) : 0 )
1303 + ( src_rank > 4 ? unsigned(R4) : 0 )
1304 + ( src_rank > 5 ? unsigned(R5) : 0 )
1305 + ( src_rank > 6 ? unsigned(R6) : 0 ) ;
1314 template<
class V ,
class ... Args >
1315 using Subdynrankview =
typename Kokkos::Experimental::Impl::ViewMapping< Kokkos::Experimental::Impl::DynRankSubviewTag , V , Args... >::ret_type ;
1317 template<
class D ,
class ... P ,
class ...Args >
1318 KOKKOS_INLINE_FUNCTION
1319 Subdynrankview< ViewTraits<D******* , P...> , Args... >
1320 subdynrankview(
const Kokkos::Experimental::DynRankView< D , P... > &src , Args...args)
1322 if ( src.rank() >
sizeof...(Args) )
1323 { Kokkos::abort(
"subdynrankview: num of args must be >= rank of the source DynRankView"); }
1325 typedef Kokkos::Experimental::Impl::ViewMapping< Kokkos::Experimental::Impl::DynRankSubviewTag ,
Kokkos::ViewTraits< D*******, P... > , Args... > metafcn ;
1327 return metafcn::subview( src.rank() , src , args... );
1331 template<
class D ,
class ... P ,
class ...Args >
1332 KOKKOS_INLINE_FUNCTION
1333 Subdynrankview< ViewTraits<D******* , P...> , Args... >
1334 subview(
const Kokkos::Experimental::DynRankView< D , P... > &src , Args...args)
1336 return subdynrankview( src , args... );
1343 namespace Experimental {
1346 template<
class LT ,
class ... LP ,
class RT ,
class ... RP >
1347 KOKKOS_INLINE_FUNCTION
1348 bool operator == (
const DynRankView<LT,LP...> & lhs ,
1349 const DynRankView<RT,RP...> & rhs )
1352 typedef ViewTraits<LT,LP...> lhs_traits ;
1353 typedef ViewTraits<RT,RP...> rhs_traits ;
1356 std::is_same<
typename lhs_traits::const_value_type ,
1357 typename rhs_traits::const_value_type >::value &&
1358 std::is_same<
typename lhs_traits::array_layout ,
1359 typename rhs_traits::array_layout >::value &&
1360 std::is_same<
typename lhs_traits::memory_space ,
1361 typename rhs_traits::memory_space >::value &&
1362 lhs.rank() == rhs.rank() &&
1363 lhs.data() == rhs.data() &&
1364 lhs.span() == rhs.span() &&
1365 lhs.dimension(0) == rhs.dimension(0) &&
1366 lhs.dimension(1) == rhs.dimension(1) &&
1367 lhs.dimension(2) == rhs.dimension(2) &&
1368 lhs.dimension(3) == rhs.dimension(3) &&
1369 lhs.dimension(4) == rhs.dimension(4) &&
1370 lhs.dimension(5) == rhs.dimension(5) &&
1371 lhs.dimension(6) == rhs.dimension(6) &&
1372 lhs.dimension(7) == rhs.dimension(7);
1375 template<
class LT ,
class ... LP ,
class RT ,
class ... RP >
1376 KOKKOS_INLINE_FUNCTION
1377 bool operator != (
const DynRankView<LT,LP...> & lhs ,
1378 const DynRankView<RT,RP...> & rhs )
1389 namespace Experimental {
1392 template<
class OutputView ,
typename Enable =
void >
1393 struct DynRankViewFill {
1395 typedef typename OutputView::traits::const_value_type const_value_type ;
1397 const OutputView output ;
1398 const_value_type input ;
1400 KOKKOS_INLINE_FUNCTION
1401 void operator()(
const size_t i0 )
const 1403 const size_t n1 = output.dimension_1();
1404 const size_t n2 = output.dimension_2();
1405 const size_t n3 = output.dimension_3();
1406 const size_t n4 = output.dimension_4();
1407 const size_t n5 = output.dimension_5();
1408 const size_t n6 = output.dimension_6();
1410 for (
size_t i1 = 0 ; i1 < n1 ; ++i1 ) {
1411 for (
size_t i2 = 0 ; i2 < n2 ; ++i2 ) {
1412 for (
size_t i3 = 0 ; i3 < n3 ; ++i3 ) {
1413 for (
size_t i4 = 0 ; i4 < n4 ; ++i4 ) {
1414 for (
size_t i5 = 0 ; i5 < n5 ; ++i5 ) {
1415 for (
size_t i6 = 0 ; i6 < n6 ; ++i6 ) {
1416 output(i0,i1,i2,i3,i4,i5,i6) = input ;
1420 DynRankViewFill(
const OutputView & arg_out , const_value_type & arg_in )
1421 : output( arg_out ), input( arg_in )
1423 typedef typename OutputView::execution_space execution_space ;
1430 execution_space::fence();
1434 template<
class OutputView >
1435 struct DynRankViewFill< OutputView , typename std::enable_if< OutputView::Rank == 0 >::type > {
1436 DynRankViewFill(
const OutputView & dst ,
const typename OutputView::const_value_type & src )
1438 Kokkos::Impl::DeepCopy< typename OutputView::memory_space , Kokkos::HostSpace >
1439 ( dst.data() , & src ,
sizeof(
typename OutputView::const_value_type) );
1443 template<
class OutputView ,
class InputView ,
class ExecSpace =
typename OutputView::execution_space >
1444 struct DynRankViewRemap {
1446 const OutputView output ;
1447 const InputView input ;
1457 DynRankViewRemap(
const OutputView & arg_out ,
const InputView & arg_in )
1458 : output( arg_out ), input( arg_in )
1459 , n0( std::min( (size_t)arg_out.dimension_0() , (size_t)arg_in.dimension_0() ) )
1460 , n1( std::min( (size_t)arg_out.dimension_1() , (size_t)arg_in.dimension_1() ) )
1461 , n2( std::min( (size_t)arg_out.dimension_2() , (size_t)arg_in.dimension_2() ) )
1462 , n3( std::min( (size_t)arg_out.dimension_3() , (size_t)arg_in.dimension_3() ) )
1463 , n4( std::min( (size_t)arg_out.dimension_4() , (size_t)arg_in.dimension_4() ) )
1464 , n5( std::min( (size_t)arg_out.dimension_5() , (size_t)arg_in.dimension_5() ) )
1465 , n6( std::min( (size_t)arg_out.dimension_6() , (size_t)arg_in.dimension_6() ) )
1466 , n7( std::min( (size_t)arg_out.dimension_7() , (size_t)arg_in.dimension_7() ) )
1473 KOKKOS_INLINE_FUNCTION
1474 void operator()(
const size_t i0 )
const 1476 for (
size_t i1 = 0 ; i1 < n1 ; ++i1 ) {
1477 for (
size_t i2 = 0 ; i2 < n2 ; ++i2 ) {
1478 for (
size_t i3 = 0 ; i3 < n3 ; ++i3 ) {
1479 for (
size_t i4 = 0 ; i4 < n4 ; ++i4 ) {
1480 for (
size_t i5 = 0 ; i5 < n5 ; ++i5 ) {
1481 for (
size_t i6 = 0 ; i6 < n6 ; ++i6 ) {
1482 output(i0,i1,i2,i3,i4,i5,i6) = input(i0,i1,i2,i3,i4,i5,i6);
1493 namespace Experimental {
1496 template<
class DT ,
class ... DP >
1499 (
const DynRankView<DT,DP...> & dst
1500 ,
typename ViewTraits<DT,DP...>::const_value_type & value
1501 ,
typename std::enable_if<
1502 std::is_same<
typename ViewTraits<DT,DP...>::specialize ,
void >::value
1506 std::is_same<
typename ViewTraits<DT,DP...>::non_const_value_type ,
1507 typename ViewTraits<DT,DP...>::value_type >::value
1508 ,
"deep_copy requires non-const type" );
1510 Kokkos::Experimental::Impl::DynRankViewFill< DynRankView<DT,DP...> >( dst , value );
1514 template<
class ST ,
class ... SP >
1517 (
typename ViewTraits<ST,SP...>::non_const_value_type & dst
1518 ,
const DynRankView<ST,SP...> & src
1519 ,
typename std::enable_if<
1520 std::is_same<
typename ViewTraits<ST,SP...>::specialize ,
void >::value
1523 if ( src.rank() != 0 )
1529 typedef typename src_traits::memory_space src_memory_space ;
1530 Kokkos::Impl::DeepCopy< HostSpace , src_memory_space >( & dst , src.data() ,
sizeof(ST) );
1537 template<
class DstType ,
class SrcType >
1540 (
const DstType & dst
1541 ,
const SrcType & src
1542 ,
typename std::enable_if<(
1543 std::is_same< typename DstType::traits::specialize , void >::value &&
1544 std::is_same< typename SrcType::traits::specialize , void >::value
1546 ( Kokkos::Experimental::is_dyn_rank_view<DstType>::value || Kokkos::Experimental::is_dyn_rank_view<SrcType>::value)
1550 std::is_same<
typename DstType::traits::value_type ,
1551 typename DstType::traits::non_const_value_type >::value
1552 ,
"deep_copy requires non-const destination type" );
1554 typedef DstType dst_type ;
1555 typedef SrcType src_type ;
1557 typedef typename dst_type::execution_space dst_execution_space ;
1558 typedef typename src_type::execution_space src_execution_space ;
1559 typedef typename dst_type::memory_space dst_memory_space ;
1560 typedef typename src_type::memory_space src_memory_space ;
1562 enum { DstExecCanAccessSrc =
1563 Kokkos::Impl::VerifyExecutionCanAccessMemorySpace< typename dst_execution_space::memory_space , src_memory_space >::value };
1565 enum { SrcExecCanAccessDst =
1566 Kokkos::Impl::VerifyExecutionCanAccessMemorySpace< typename src_execution_space::memory_space , dst_memory_space >::value };
1568 if ( (
void *) dst.data() != (
void*) src.data() ) {
1574 if (
rank(src) == 0 &&
rank(dst) == 0 )
1576 typedef typename dst_type::value_type value_type ;
1577 Kokkos::Impl::DeepCopy< dst_memory_space , src_memory_space >( dst.data() , src.data() ,
sizeof(value_type) );
1579 else if ( std::is_same<
typename DstType::traits::value_type ,
1580 typename SrcType::traits::non_const_value_type >::value &&
1582 ( std::is_same<
typename DstType::traits::array_layout ,
1583 typename SrcType::traits::array_layout >::value
1585 ( std::is_same<
typename DstType::traits::array_layout ,
1588 std::is_same<
typename DstType::traits::array_layout ,
1599 dst.span_is_contiguous() &&
1600 src.span_is_contiguous() &&
1601 dst.span() == src.span() &&
1602 dst.dimension_0() == src.dimension_0() &&
1603 dst.dimension_1() == src.dimension_1() &&
1604 dst.dimension_2() == src.dimension_2() &&
1605 dst.dimension_3() == src.dimension_3() &&
1606 dst.dimension_4() == src.dimension_4() &&
1607 dst.dimension_5() == src.dimension_5() &&
1608 dst.dimension_6() == src.dimension_6() &&
1609 dst.dimension_7() == src.dimension_7() ) {
1611 const size_t nbytes =
sizeof(
typename dst_type::value_type) * dst.span();
1613 Kokkos::Impl::DeepCopy< dst_memory_space , src_memory_space >( dst.data() , src.data() , nbytes );
1615 else if ( std::is_same<
typename DstType::traits::value_type ,
1616 typename SrcType::traits::non_const_value_type >::value &&
1618 ( std::is_same<
typename DstType::traits::array_layout ,
1619 typename SrcType::traits::array_layout >::value
1621 std::is_same<
typename DstType::traits::array_layout ,
1631 dst.span_is_contiguous() &&
1632 src.span_is_contiguous() &&
1633 dst.span() == src.span() &&
1634 dst.dimension_0() == src.dimension_0() &&
1635 dst.dimension_1() == src.dimension_1() &&
1636 dst.dimension_2() == src.dimension_2() &&
1637 dst.dimension_3() == src.dimension_3() &&
1638 dst.dimension_4() == src.dimension_4() &&
1639 dst.dimension_5() == src.dimension_5() &&
1640 dst.dimension_6() == src.dimension_6() &&
1641 dst.dimension_7() == src.dimension_7() &&
1642 dst.stride_0() == src.stride_0() &&
1643 dst.stride_1() == src.stride_1() &&
1644 dst.stride_2() == src.stride_2() &&
1645 dst.stride_3() == src.stride_3() &&
1646 dst.stride_4() == src.stride_4() &&
1647 dst.stride_5() == src.stride_5() &&
1648 dst.stride_6() == src.stride_6() &&
1649 dst.stride_7() == src.stride_7()
1652 const size_t nbytes =
sizeof(
typename dst_type::value_type) * dst.span();
1654 Kokkos::Impl::DeepCopy< dst_memory_space , src_memory_space >( dst.data() , src.data() , nbytes );
1656 else if ( DstExecCanAccessSrc ) {
1658 Kokkos::Experimental::Impl::DynRankViewRemap< dst_type , src_type >( dst , src );
1660 else if ( SrcExecCanAccessDst ) {
1662 Kokkos::Experimental::Impl::DynRankViewRemap< dst_type , src_type , src_execution_space >( dst , src );
1665 Kokkos::Impl::throw_runtime_exception(
"deep_copy given views that would require a temporary allocation");
1678 namespace Experimental {
1684 template<
class Space,
class T,
class ... P>
1685 struct MirrorDRViewType {
1687 typedef typename Kokkos::Experimental::DynRankView<T,P...> src_view_type;
1689 typedef typename Space::memory_space memory_space;
1691 enum { is_same_memspace = std::is_same<memory_space,typename src_view_type::memory_space>::value };
1693 typedef typename src_view_type::array_layout array_layout;
1695 typedef typename src_view_type::non_const_data_type data_type;
1697 typedef Kokkos::Experimental::DynRankView<data_type,array_layout,Space> dest_view_type;
1700 typedef typename std::conditional<is_same_memspace,src_view_type,dest_view_type>::type view_type;
1703 template<
class Space,
class T,
class ... P>
1704 struct MirrorDRVType {
1706 typedef typename Kokkos::Experimental::DynRankView<T,P...> src_view_type;
1708 typedef typename Space::memory_space memory_space;
1710 enum { is_same_memspace = std::is_same<memory_space,typename src_view_type::memory_space>::value };
1712 typedef typename src_view_type::array_layout array_layout;
1714 typedef typename src_view_type::non_const_data_type data_type;
1716 typedef Kokkos::Experimental::DynRankView<data_type,array_layout,Space> view_type;
1722 template<
class T ,
class ... P >
1724 typename DynRankView<T,P...>::HostMirror
1725 create_mirror(
const DynRankView<T,P...> & src
1726 ,
typename std::enable_if<
1727 ! std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
1732 typedef DynRankView<T,P...> src_type ;
1733 typedef typename src_type::HostMirror dst_type ;
1735 return dst_type( std::string( src.label() ).append(
"_mirror")
1736 , Impl::reconstructLayout(src.layout(), src.rank()) );
1740 template<
class T ,
class ... P >
1742 typename DynRankView<T,P...>::HostMirror
1743 create_mirror(
const DynRankView<T,P...> & src
1744 ,
typename std::enable_if<
1745 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
1750 typedef DynRankView<T,P...> src_type ;
1751 typedef typename src_type::HostMirror dst_type ;
1753 return dst_type( std::string( src.label() ).append(
"_mirror")
1754 , Impl::reconstructLayout(src.layout(), src.rank()) );
1759 template<
class Space,
class T,
class ... P>
1760 typename Impl::MirrorDRVType<Space,T,P ...>::view_type create_mirror(
const Space& ,
const Kokkos::Experimental::DynRankView<T,P...> & src) {
1761 return typename Impl::MirrorDRVType<Space,T,P ...>::view_type(src.label(), Impl::reconstructLayout(src.layout(), src.rank()) );
1764 template<
class T ,
class ... P >
1766 typename DynRankView<T,P...>::HostMirror
1767 create_mirror_view(
const DynRankView<T,P...> & src
1768 ,
typename std::enable_if<(
1769 std::is_same<
typename DynRankView<T,P...>::memory_space
1770 ,
typename DynRankView<T,P...>::HostMirror::memory_space
1773 std::is_same<
typename DynRankView<T,P...>::data_type
1774 ,
typename DynRankView<T,P...>::HostMirror::data_type
1782 template<
class T ,
class ... P >
1784 typename DynRankView<T,P...>::HostMirror
1785 create_mirror_view(
const DynRankView<T,P...> & src
1786 ,
typename std::enable_if< ! (
1787 std::is_same<
typename DynRankView<T,P...>::memory_space
1788 ,
typename DynRankView<T,P...>::HostMirror::memory_space
1791 std::is_same<
typename DynRankView<T,P...>::data_type
1792 ,
typename DynRankView<T,P...>::HostMirror::data_type
1797 return Kokkos::Experimental::create_mirror( src );
1801 template<
class Space,
class T,
class ... P>
1802 typename Impl::MirrorDRViewType<Space,T,P ...>::view_type
1803 create_mirror_view(
const Space& ,
const Kokkos::Experimental::DynRankView<T,P...> & src
1804 ,
typename std::enable_if<Impl::MirrorDRViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
1809 template<
class Space,
class T,
class ... P>
1810 typename Impl::MirrorDRViewType<Space,T,P ...>::view_type
1811 create_mirror_view(
const Space& ,
const Kokkos::Experimental::DynRankView<T,P...> & src
1812 ,
typename std::enable_if<!Impl::MirrorDRViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
1813 return typename Impl::MirrorDRViewType<Space,T,P ...>::view_type(src.label(), Impl::reconstructLayout(src.layout(), src.rank()) );
1824 namespace Experimental {
1826 template<
class T ,
class ... P >
1829 const size_t n0 = ~
size_t(0) ,
1830 const size_t n1 = ~
size_t(0) ,
1831 const size_t n2 = ~
size_t(0) ,
1832 const size_t n3 = ~
size_t(0) ,
1833 const size_t n4 = ~
size_t(0) ,
1834 const size_t n5 = ~
size_t(0) ,
1835 const size_t n6 = ~
size_t(0) ,
1836 const size_t n7 = ~
size_t(0) )
1838 typedef DynRankView<T,P...> drview_type ;
1842 drview_type v_resized( v.label(), n0, n1, n2, n3, n4, n5, n6 );
1844 Kokkos::Experimental::Impl::DynRankViewRemap< drview_type , drview_type >( v_resized, v );
1850 template<
class T ,
class ... P >
1853 const size_t n0 = ~
size_t(0) ,
1854 const size_t n1 = ~
size_t(0) ,
1855 const size_t n2 = ~
size_t(0) ,
1856 const size_t n3 = ~
size_t(0) ,
1857 const size_t n4 = ~
size_t(0) ,
1858 const size_t n5 = ~
size_t(0) ,
1859 const size_t n6 = ~
size_t(0) ,
1860 const size_t n7 = ~
size_t(0) )
1862 typedef DynRankView<T,P...> drview_type ;
1866 const std::string label = v.label();
1869 v = drview_type( label, n0, n1, n2, n3, n4, n5, n6 );
1876 using Kokkos::Experimental::is_dyn_rank_view ;
1880 template<
typename D ,
class ... P >
1881 using DynRankView = Kokkos::Experimental::DynRankView< D , P... > ;
1884 using Kokkos::Experimental::create_mirror ;
1885 using Kokkos::Experimental::create_mirror_view ;
1886 using Kokkos::Experimental::subdynrankview ;
1887 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.
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.
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.