44 #ifndef KOKKOS_COPYVIEWS_HPP_
45 #define KOKKOS_COPYVIEWS_HPP_
51 #ifndef KOKKOS_IMPL_COMPILING_LIBRARY
52 #define KOKKOS_IMPL_COMPILING_LIBRARY false
59 template<
class Layout>
60 struct ViewFillLayoutSelector {
64 struct ViewFillLayoutSelector<Kokkos::LayoutLeft> {
65 static const Kokkos::Iterate iterate = Kokkos::Iterate::Left;
69 struct ViewFillLayoutSelector<Kokkos::LayoutRight> {
70 static const Kokkos::Iterate iterate = Kokkos::Iterate::Right;
76 #include<impl/Kokkos_ViewFillCopyETIAvail.hpp>
81 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
82 struct ViewFill<ViewType,Layout,ExecSpace,0,iType,ETIAvail> {
84 typename ViewType::const_value_type val;
85 typedef typename ViewType::non_const_value_type ST;
86 ViewFill(
const ViewType&,
const ST&);
89 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
90 struct ViewFill<ViewType,Layout,ExecSpace,1,iType,ETIAvail> {
92 typename ViewType::const_value_type val;
93 typedef typename ViewType::non_const_value_type ST;
94 ViewFill(
const ViewType&,
const ST&);
95 KOKKOS_INLINE_FUNCTION
96 void operator() (
const iType&)
const;
99 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
100 struct ViewFill<ViewType,Layout,ExecSpace,2,iType,ETIAvail> {
102 typename ViewType::const_value_type val;
103 typedef typename ViewType::non_const_value_type ST;
104 ViewFill(
const ViewType&,
const ST&);
105 KOKKOS_INLINE_FUNCTION
106 void operator() (
const iType&,
const iType&)
const;
109 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
110 struct ViewFill<ViewType,Layout,ExecSpace,3,iType,ETIAvail> {
112 typename ViewType::const_value_type val;
113 typedef typename ViewType::non_const_value_type ST;
114 ViewFill(
const ViewType&,
const ST&);
115 KOKKOS_INLINE_FUNCTION
116 void operator() (
const iType&,
const iType&,
const iType&)
const;
119 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
120 struct ViewFill<ViewType,Layout,ExecSpace,4,iType,ETIAvail> {
122 typename ViewType::const_value_type val;
123 typedef typename ViewType::non_const_value_type ST;
124 ViewFill(
const ViewType&,
const ST&);
125 KOKKOS_INLINE_FUNCTION
126 void operator() (
const iType&,
const iType&,
const iType&,
const iType&)
const;
129 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
130 struct ViewFill<ViewType,Layout,ExecSpace,5,iType,ETIAvail> {
132 typename ViewType::const_value_type val;
133 typedef typename ViewType::non_const_value_type ST;
134 ViewFill(
const ViewType&,
const ST&);
135 KOKKOS_INLINE_FUNCTION
136 void operator() (
const iType&,
const iType&,
const iType&,
const iType&,
140 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
141 struct ViewFill<ViewType,Layout,ExecSpace,6,iType,ETIAvail> {
143 typename ViewType::const_value_type val;
144 typedef typename ViewType::non_const_value_type ST;
145 ViewFill(
const ViewType&,
const ST&);
146 KOKKOS_INLINE_FUNCTION
147 void operator() (
const iType&,
const iType&,
const iType&,
const iType&,
148 const iType&,
const iType&)
const;
151 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
152 struct ViewFill<ViewType,Layout,ExecSpace,7,iType,ETIAvail> {
154 typename ViewType::const_value_type val;
155 typedef typename ViewType::non_const_value_type ST;
156 ViewFill(
const ViewType&,
const ST&);
157 KOKKOS_INLINE_FUNCTION
158 void operator() (
const iType&,
const iType&,
const iType&,
const iType&,
159 const iType&,
const iType&,
const iType&)
const;
162 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
163 struct ViewFill<ViewType,Layout,ExecSpace,8,iType,ETIAvail> {
165 typename ViewType::const_value_type val;
166 typedef typename ViewType::non_const_value_type ST;
167 ViewFill(
const ViewType&,
const ST&);
168 KOKKOS_INLINE_FUNCTION
169 void operator() (
const iType&,
const iType&,
const iType&,
const iType&,
170 const iType&,
const iType&,
const iType&,
const iType&)
const;
173 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType>
174 struct ViewFill<ViewType,Layout,ExecSpace,0,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
175 typedef typename ViewType::non_const_value_type ST;
176 ViewFill(
const ViewType& a,
const ST& val) {
177 Kokkos::Impl::DeepCopy< typename ViewType::memory_space, Kokkos::HostSpace >( a.data() , &val,
sizeof(ST) );
182 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType>
183 struct ViewFill<ViewType,Layout,ExecSpace,1,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
185 typename ViewType::const_value_type val;
188 ViewFill(
const ViewType& a_,
typename ViewType::const_value_type& val_):a(a_),val(val_) {
194 KOKKOS_INLINE_FUNCTION
195 void operator() (
const iType& i)
const {
200 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType>
201 struct ViewFill<ViewType,Layout,ExecSpace,2,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
203 typename ViewType::const_value_type val;
205 typedef Kokkos::Rank<2,ViewFillLayoutSelector<Layout>::iterate,ViewFillLayoutSelector<Layout>::iterate> iterate_type;
206 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
208 ViewFill(
const ViewType& a_,
typename ViewType::const_value_type& val_):a(a_),val(val_) {
211 policy_type({0,0},{a.extent(0),a.extent(1)}),*
this);
215 KOKKOS_INLINE_FUNCTION
216 void operator() (
const iType& i0,
const iType& i1)
const {
221 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType>
222 struct ViewFill<ViewType,Layout,ExecSpace,3,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
224 typename ViewType::const_value_type val;
226 typedef Kokkos::Rank<3,ViewFillLayoutSelector<Layout>::iterate,ViewFillLayoutSelector<Layout>::iterate> iterate_type;
227 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
229 ViewFill(
const ViewType& a_,
typename ViewType::const_value_type& val_):a(a_),val(val_) {
232 policy_type({0,0,0},{a.extent(0),a.extent(1),a.extent(2)}),*
this);
236 KOKKOS_INLINE_FUNCTION
237 void operator() (
const iType& i0,
const iType& i1,
const iType& i2)
const {
242 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType>
243 struct ViewFill<ViewType,Layout,ExecSpace,4,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
245 typename ViewType::const_value_type val;
247 typedef Kokkos::Rank<4,ViewFillLayoutSelector<Layout>::iterate,ViewFillLayoutSelector<Layout>::iterate> iterate_type;
248 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
250 ViewFill(
const ViewType& a_,
typename ViewType::const_value_type& val_):a(a_),val(val_) {
253 policy_type({0,0,0,0},{a.extent(0),a.extent(1),a.extent(2),a.extent(3)}),*
this);
257 KOKKOS_INLINE_FUNCTION
258 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
const iType& i3)
const {
259 a(i0,i1,i2,i3) = val;
263 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType>
264 struct ViewFill<ViewType,Layout,ExecSpace,5,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
266 typename ViewType::const_value_type val;
268 typedef Kokkos::Rank<5,ViewFillLayoutSelector<Layout>::iterate,ViewFillLayoutSelector<Layout>::iterate> iterate_type;
269 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
271 ViewFill(
const ViewType& a_,
typename ViewType::const_value_type& val_):a(a_),val(val_) {
274 policy_type({0,0,0,0,0},{a.extent(0),a.extent(1),a.extent(2),a.extent(3),a.extent(4)}),*
this);
278 KOKKOS_INLINE_FUNCTION
279 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
const iType& i3,
const iType& i4)
const {
280 a(i0,i1,i2,i3,i4) = val;
284 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType>
285 struct ViewFill<ViewType,Layout,ExecSpace,6,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
287 typename ViewType::const_value_type val;
289 typedef Kokkos::Rank<6,ViewFillLayoutSelector<Layout>::iterate,ViewFillLayoutSelector<Layout>::iterate> iterate_type;
290 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
292 ViewFill(
const ViewType& a_,
typename ViewType::const_value_type& val_):a(a_),val(val_) {
295 policy_type({0,0,0,0,0,0},{a.extent(0),a.extent(1),a.extent(2),a.extent(3),a.extent(4),a.extent(5)}),*
this);
299 KOKKOS_INLINE_FUNCTION
300 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
const iType& i3,
const iType& i4,
const iType& i5)
const {
301 a(i0,i1,i2,i3,i4,i5) = val;
305 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType>
306 struct ViewFill<ViewType,Layout,ExecSpace,7,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
308 typename ViewType::const_value_type val;
310 typedef Kokkos::Rank<6,ViewFillLayoutSelector<Layout>::iterate,ViewFillLayoutSelector<Layout>::iterate> iterate_type;
311 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
313 ViewFill(
const ViewType& a_,
typename ViewType::const_value_type& val_):a(a_),val(val_) {
316 policy_type({0,0,0,0,0,0},{a.extent(0),a.extent(1),a.extent(2),a.extent(3),
317 a.extent(5),a.extent(6)}),*
this);
321 KOKKOS_INLINE_FUNCTION
322 void operator() (
const iType& i0,
const iType& i1,
const iType& i3,
323 const iType& i4,
const iType& i5,
const iType& i6)
const {
324 for(iType i2=0; i2<iType(a.extent(2));i2++)
325 a(i0,i1,i2,i3,i4,i5,i6) = val;
329 template<
class ViewType,
class Layout,
class ExecSpace,
typename iType>
330 struct ViewFill<ViewType,Layout,ExecSpace,8,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
332 typename ViewType::const_value_type val;
334 typedef Kokkos::Rank<6,ViewFillLayoutSelector<Layout>::iterate,ViewFillLayoutSelector<Layout>::iterate> iterate_type;
335 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
337 ViewFill(
const ViewType& a_,
typename ViewType::const_value_type& val_):a(a_),val(val_) {
340 policy_type({0,0,0,0,0,0},{a.extent(0),a.extent(1),a.extent(3),
341 a.extent(5),a.extent(6),a.extent(7)}),*
this);
345 KOKKOS_INLINE_FUNCTION
346 void operator() (
const iType& i0,
const iType& i1,
const iType& i3,
347 const iType& i5,
const iType& i6,
const iType& i7)
const {
348 for(iType i2=0; i2<iType(a.extent(2));i2++)
349 for(iType i4=0; i4<iType(a.extent(4));i4++)
350 a(i0,i1,i2,i3,i4,i5,i6,i7) = val;
354 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
355 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,1,iType,ETIAvail> {
358 ViewCopy(
const ViewTypeA&,
const ViewTypeB&);
359 KOKKOS_INLINE_FUNCTION
360 void operator() (
const iType& i0)
const;
363 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
364 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,2,iType,ETIAvail> {
367 ViewCopy(
const ViewTypeA&,
const ViewTypeB&);
368 KOKKOS_INLINE_FUNCTION
369 void operator() (
const iType& i0,
const iType& i1)
const;
372 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
373 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,3,iType,ETIAvail> {
376 ViewCopy(
const ViewTypeA&,
const ViewTypeB&);
377 KOKKOS_INLINE_FUNCTION
378 void operator() (
const iType& i0,
const iType& i1,
const iType& i2)
const;
381 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
382 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,4,iType,ETIAvail> {
385 ViewCopy(
const ViewTypeA&,
const ViewTypeB&);
386 KOKKOS_INLINE_FUNCTION
387 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
const iType& i3)
const;
390 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
391 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,5,iType,ETIAvail> {
394 ViewCopy(
const ViewTypeA&,
const ViewTypeB&);
395 KOKKOS_INLINE_FUNCTION
396 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
const iType& i3,
397 const iType& i4)
const;
400 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
401 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,6,iType,ETIAvail> {
404 ViewCopy(
const ViewTypeA&,
const ViewTypeB&);
405 KOKKOS_INLINE_FUNCTION
406 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
const iType& i3,
407 const iType& i4,
const iType& i5)
const;
410 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
411 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,7,iType,ETIAvail> {
414 ViewCopy(
const ViewTypeA&,
const ViewTypeB&);
415 KOKKOS_INLINE_FUNCTION
416 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
const iType& i3,
417 const iType& i4,
const iType& i5,
const iType& i6)
const;
420 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType,
bool ETIAvail>
421 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,8,iType,ETIAvail> {
424 ViewCopy(
const ViewTypeA&,
const ViewTypeB&);
425 KOKKOS_INLINE_FUNCTION
426 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
const iType& i3,
427 const iType& i4,
const iType& i5,
const iType& i6,
const iType& i7)
const;
432 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType>
433 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,1,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
439 ViewCopy(
const ViewTypeA& a_,
const ViewTypeB& b_):a(a_),b(b_) {
442 policy_type(0,a.extent(0)),*
this);
446 KOKKOS_INLINE_FUNCTION
447 void operator() (
const iType& i0)
const {
452 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType>
453 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,2,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
456 static const Kokkos::Iterate outer_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::outer_iteration_pattern;
457 static const Kokkos::Iterate inner_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::inner_iteration_pattern;
458 typedef Kokkos::Rank<2,outer_iteration_pattern,inner_iteration_pattern> iterate_type;
459 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
461 ViewCopy(
const ViewTypeA& a_,
const ViewTypeB& b_):a(a_),b(b_) {
464 policy_type({0,0},{a.extent(0),a.extent(1)}),*
this);
468 KOKKOS_INLINE_FUNCTION
469 void operator() (
const iType& i0,
const iType& i1)
const {
474 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType>
475 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,3,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
479 static const Kokkos::Iterate outer_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::outer_iteration_pattern;
480 static const Kokkos::Iterate inner_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::inner_iteration_pattern;
481 typedef Kokkos::Rank<3,outer_iteration_pattern,inner_iteration_pattern> iterate_type;
482 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
484 ViewCopy(
const ViewTypeA& a_,
const ViewTypeB& b_):a(a_),b(b_) {
487 policy_type({0,0,0},{a.extent(0),a.extent(1),a.extent(2)}),*
this);
491 KOKKOS_INLINE_FUNCTION
492 void operator() (
const iType& i0,
const iType& i1,
const iType& i2)
const {
493 a(i0,i1,i2) = b(i0,i1,i2);
497 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType>
498 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,4,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
502 static const Kokkos::Iterate outer_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::outer_iteration_pattern;
503 static const Kokkos::Iterate inner_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::inner_iteration_pattern;
504 typedef Kokkos::Rank<4,outer_iteration_pattern,inner_iteration_pattern> iterate_type;
505 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
507 ViewCopy(
const ViewTypeA& a_,
const ViewTypeB& b_):a(a_),b(b_) {
510 policy_type({0,0,0,0},{a.extent(0),a.extent(1),a.extent(2),
511 a.extent(3)}),*
this);
515 KOKKOS_INLINE_FUNCTION
516 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
517 const iType& i3)
const {
518 a(i0,i1,i2,i3) = b(i0,i1,i2,i3);
522 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType>
523 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,5,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
527 static const Kokkos::Iterate outer_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::outer_iteration_pattern;
528 static const Kokkos::Iterate inner_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::inner_iteration_pattern;
529 typedef Kokkos::Rank<5,outer_iteration_pattern,inner_iteration_pattern> iterate_type;
530 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
532 ViewCopy(
const ViewTypeA& a_,
const ViewTypeB& b_):a(a_),b(b_) {
535 policy_type({0,0,0,0,0},{a.extent(0),a.extent(1),a.extent(2),
536 a.extent(3),a.extent(4)}),*
this);
540 KOKKOS_INLINE_FUNCTION
541 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
542 const iType& i3,
const iType& i4)
const {
543 a(i0,i1,i2,i3,i4) = b(i0,i1,i2,i3,i4);
547 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType>
548 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,6,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
552 static const Kokkos::Iterate outer_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::outer_iteration_pattern;
553 static const Kokkos::Iterate inner_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::inner_iteration_pattern;
554 typedef Kokkos::Rank<6,outer_iteration_pattern,inner_iteration_pattern> iterate_type;
555 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
557 ViewCopy(
const ViewTypeA& a_,
const ViewTypeB& b_):a(a_),b(b_) {
560 policy_type({0,0,0,0,0,0},{a.extent(0),a.extent(1),a.extent(2),
561 a.extent(3),a.extent(4),a.extent(5)}),*
this);
565 KOKKOS_INLINE_FUNCTION
566 void operator() (
const iType& i0,
const iType& i1,
const iType& i2,
567 const iType& i3,
const iType& i4,
const iType& i5)
const {
568 a(i0,i1,i2,i3,i4,i5) = b(i0,i1,i2,i3,i4,i5);
573 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType>
574 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,7,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
578 static const Kokkos::Iterate outer_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::outer_iteration_pattern;
579 static const Kokkos::Iterate inner_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::inner_iteration_pattern;
580 typedef Kokkos::Rank<6,outer_iteration_pattern,inner_iteration_pattern> iterate_type;
581 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
583 ViewCopy(
const ViewTypeA& a_,
const ViewTypeB& b_):a(a_),b(b_) {
586 policy_type({0,0,0,0,0,0},{a.extent(0),a.extent(1),a.extent(3),
587 a.extent(4),a.extent(5),a.extent(6)}),*
this);
591 KOKKOS_INLINE_FUNCTION
592 void operator() (
const iType& i0,
const iType& i1,
const iType& i3,
593 const iType& i4,
const iType& i5,
const iType& i6)
const {
594 for(iType i2=0; i2<iType(a.extent(2));i2++)
595 a(i0,i1,i2,i3,i4,i5,i6) = b(i0,i1,i2,i3,i4,i5,i6);
599 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
typename iType>
600 struct ViewCopy<ViewTypeA,ViewTypeB,Layout,ExecSpace,8,iType,KOKKOS_IMPL_COMPILING_LIBRARY> {
604 static const Kokkos::Iterate outer_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::outer_iteration_pattern;
605 static const Kokkos::Iterate inner_iteration_pattern = Kokkos::layout_iterate_type_selector<Layout>::inner_iteration_pattern;
606 typedef Kokkos::Rank<6,outer_iteration_pattern,inner_iteration_pattern> iterate_type;
607 typedef Kokkos::MDRangePolicy<ExecSpace,iterate_type,Kokkos::IndexType<iType>> policy_type;
609 ViewCopy(
const ViewTypeA& a_,
const ViewTypeB& b_):a(a_),b(b_) {
612 policy_type({0,0,0,0,0,0},{a.extent(0),a.extent(1),a.extent(3),
613 a.extent(5),a.extent(6),a.extent(7)}),*
this);
617 KOKKOS_INLINE_FUNCTION
618 void operator() (
const iType& i0,
const iType& i1,
const iType& i3,
619 const iType& i5,
const iType& i6,
const iType& i7)
const {
620 for(iType i2=0; i2<iType(a.extent(2));i2++)
621 for(iType i4=0; i4<iType(a.extent(4));i4++)
622 a(i0,i1,i2,i3,i4,i5,i6,i7) = b(i0,i1,i2,i3,i4,i5,i6,i7);
629 #include<impl/Kokkos_ViewFillCopyETIDecl.hpp>
634 template<
class DstType,
class SrcType>
635 void view_copy(
const DstType& dst,
const SrcType& src) {
636 typedef typename DstType::execution_space dst_execution_space;
637 typedef typename SrcType::execution_space src_execution_space;
638 typedef typename DstType::memory_space dst_memory_space;
639 typedef typename SrcType::memory_space src_memory_space;
641 enum { DstExecCanAccessSrc =
644 enum { SrcExecCanAccessDst =
647 if( ! DstExecCanAccessSrc && ! SrcExecCanAccessDst) {
648 std::string message(
"Error: Kokkos::deep_copy with no available copy mechanism: ");
649 message += src.label(); message +=
" to ";
650 message += dst.label();
651 Kokkos::Impl::throw_runtime_exception(message);
655 int64_t strides[DstType::Rank+1];
657 Kokkos::Iterate iterate;
658 if ( Kokkos::is_layouttiled<typename DstType::array_layout>::value ) {
659 iterate = Kokkos::layout_iterate_type_selector<typename DstType::array_layout>::outer_iteration_pattern;
660 }
else if ( std::is_same<typename DstType::array_layout,Kokkos::LayoutRight>::value ) {
661 iterate = Kokkos::Iterate::Right;
662 }
else if ( std::is_same<typename DstType::array_layout,Kokkos::LayoutLeft>::value ) {
663 iterate = Kokkos::Iterate::Left;
664 }
else if ( std::is_same<typename DstType::array_layout,Kokkos::LayoutStride>::value ) {
665 if( strides[0] > strides[DstType::Rank-1] )
666 iterate = Kokkos::Iterate::Right;
668 iterate = Kokkos::Iterate::Left;
670 if( std::is_same<typename DstType::execution_space::array_layout, Kokkos::LayoutRight>::value )
671 iterate = Kokkos::Iterate::Right;
673 iterate = Kokkos::Iterate::Left;
676 if( (dst.span() >= size_t(std::numeric_limits<int>::max())) ||
677 (src.span() >= size_t(std::numeric_limits<int>::max())) ){
678 if(DstExecCanAccessSrc) {
679 if(iterate == Kokkos::Iterate::Right)
680 Kokkos::Impl::ViewCopy<
typename DstType::uniform_runtime_nomemspace_type,
typename SrcType::uniform_runtime_const_nomemspace_type,
Kokkos::LayoutRight, dst_execution_space,
681 DstType::Rank, int64_t >( dst , src );
683 Kokkos::Impl::ViewCopy<
typename DstType::uniform_runtime_nomemspace_type,
typename SrcType::uniform_runtime_const_nomemspace_type,
Kokkos::LayoutLeft, dst_execution_space,
684 DstType::Rank, int64_t >( dst , src );
686 if(iterate == Kokkos::Iterate::Right)
687 Kokkos::Impl::ViewCopy<
typename DstType::uniform_runtime_nomemspace_type,
typename SrcType::uniform_runtime_const_nomemspace_type,
Kokkos::LayoutRight, src_execution_space,
688 DstType::Rank, int64_t >( dst , src );
690 Kokkos::Impl::ViewCopy<
typename DstType::uniform_runtime_nomemspace_type,
typename SrcType::uniform_runtime_const_nomemspace_type,
Kokkos::LayoutLeft, src_execution_space,
691 DstType::Rank, int64_t >( dst , src );
694 if(DstExecCanAccessSrc) {
695 if(iterate == Kokkos::Iterate::Right)
696 Kokkos::Impl::ViewCopy<
typename DstType::uniform_runtime_nomemspace_type,
typename SrcType::uniform_runtime_const_nomemspace_type,
Kokkos::LayoutRight, dst_execution_space,
697 DstType::Rank,
int >( dst , src );
699 Kokkos::Impl::ViewCopy<
typename DstType::uniform_runtime_nomemspace_type,
typename SrcType::uniform_runtime_const_nomemspace_type,
Kokkos::LayoutLeft, dst_execution_space,
700 DstType::Rank,
int >( dst , src );
702 if(iterate == Kokkos::Iterate::Right)
703 Kokkos::Impl::ViewCopy<
typename DstType::uniform_runtime_nomemspace_type,
typename SrcType::uniform_runtime_const_nomemspace_type,
Kokkos::LayoutRight, src_execution_space,
704 DstType::Rank,
int >( dst , src );
706 Kokkos::Impl::ViewCopy<
typename DstType::uniform_runtime_nomemspace_type,
typename SrcType::uniform_runtime_const_nomemspace_type,
Kokkos::LayoutLeft, src_execution_space,
707 DstType::Rank,
int >( dst , src );
713 template<
class DstType,
class SrcType,
int Rank,
class ... Args>
714 struct CommonSubview;
716 template<
class DstType,
class SrcType,
class Arg0,
class ... Args>
717 struct CommonSubview<DstType,SrcType,1,Arg0,Args...> {
718 typedef typename Kokkos::Subview<DstType,Arg0> dst_subview_type;
719 typedef typename Kokkos::Subview<SrcType,Arg0> src_subview_type;
720 dst_subview_type dst_sub;
721 src_subview_type src_sub;
722 CommonSubview(
const DstType& dst,
const SrcType& src,
const Arg0& arg0, Args... ):
723 dst_sub(dst,arg0),src_sub(src,arg0) {}
726 template<
class DstType,
class SrcType,
class Arg0,
class Arg1,
class ... Args>
727 struct CommonSubview<DstType,SrcType,2,Arg0,Arg1,Args...> {
728 typedef typename Kokkos::Subview<DstType,Arg0,Arg1> dst_subview_type;
729 typedef typename Kokkos::Subview<SrcType,Arg0,Arg1> src_subview_type;
730 dst_subview_type dst_sub;
731 src_subview_type src_sub;
732 CommonSubview(
const DstType& dst,
const SrcType& src,
const Arg0& arg0,
const Arg1& arg1, Args... ):
733 dst_sub(dst,arg0,arg1),src_sub(src,arg0,arg1) {}
736 template<
class DstType,
class SrcType,
class Arg0,
class Arg1,
class Arg2,
class ... Args>
737 struct CommonSubview<DstType,SrcType,3,Arg0,Arg1,Arg2,Args...> {
738 typedef typename Kokkos::Subview<DstType,Arg0,Arg1,Arg2> dst_subview_type;
739 typedef typename Kokkos::Subview<SrcType,Arg0,Arg1,Arg2> src_subview_type;
740 dst_subview_type dst_sub;
741 src_subview_type src_sub;
742 CommonSubview(
const DstType& dst,
const SrcType& src,
const Arg0& arg0,
const Arg1& arg1,
743 const Arg2& arg2, Args... ):
744 dst_sub(dst,arg0,arg1,arg2),src_sub(src,arg0,arg1,arg2) {}
747 template<
class DstType,
class SrcType,
class Arg0,
class Arg1,
class Arg2,
class Arg3,
749 struct CommonSubview<DstType,SrcType,4,Arg0,Arg1,Arg2,Arg3,Args...> {
750 typedef typename Kokkos::Subview<DstType,Arg0,Arg1,Arg2,Arg3> dst_subview_type;
751 typedef typename Kokkos::Subview<SrcType,Arg0,Arg1,Arg2,Arg3> src_subview_type;
752 dst_subview_type dst_sub;
753 src_subview_type src_sub;
754 CommonSubview(
const DstType& dst,
const SrcType& src,
const Arg0& arg0,
const Arg1& arg1,
755 const Arg2& arg2,
const Arg3& arg3,
757 dst_sub(dst,arg0,arg1,arg2,arg3),src_sub(src,arg0,arg1,arg2,arg3) {}
760 template<
class DstType,
class SrcType,
class Arg0,
class Arg1,
class Arg2,
class Arg3,
761 class Arg4,
class ... Args>
762 struct CommonSubview<DstType,SrcType,5,Arg0,Arg1,Arg2,Arg3,Arg4,Args...> {
763 typedef typename Kokkos::Subview<DstType,Arg0,Arg1,Arg2,Arg3,Arg4> dst_subview_type;
764 typedef typename Kokkos::Subview<SrcType,Arg0,Arg1,Arg2,Arg3,Arg4> src_subview_type;
765 dst_subview_type dst_sub;
766 src_subview_type src_sub;
767 CommonSubview(
const DstType& dst,
const SrcType& src,
const Arg0& arg0,
const Arg1& arg1,
768 const Arg2& arg2,
const Arg3& arg3,
const Arg4& arg4,
770 dst_sub(dst,arg0,arg1,arg2,arg3,arg4),src_sub(src,arg0,arg1,arg2,arg3,arg4) {}
773 template<
class DstType,
class SrcType,
class Arg0,
class Arg1,
class Arg2,
class Arg3,
774 class Arg4,
class Arg5,
class ... Args>
775 struct CommonSubview<DstType,SrcType,6,Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Args...> {
776 typedef typename Kokkos::Subview<DstType,Arg0,Arg1,Arg2,Arg3,Arg4,Arg5> dst_subview_type;
777 typedef typename Kokkos::Subview<SrcType,Arg0,Arg1,Arg2,Arg3,Arg4,Arg5> src_subview_type;
778 dst_subview_type dst_sub;
779 src_subview_type src_sub;
780 CommonSubview(
const DstType& dst,
const SrcType& src,
const Arg0& arg0,
const Arg1& arg1,
781 const Arg2& arg2,
const Arg3& arg3,
const Arg4& arg4,
const Arg5& arg5,
783 dst_sub(dst,arg0,arg1,arg2,arg3,arg4,arg5),src_sub(src,arg0,arg1,arg2,arg3,arg4,arg5) {}
786 template<
class DstType,
class SrcType,
class Arg0,
class Arg1,
class Arg2,
class Arg3,
787 class Arg4,
class Arg5,
class Arg6,
class ...Args>
788 struct CommonSubview<DstType,SrcType,7,Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Args...> {
789 typedef typename Kokkos::Subview<DstType,Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6> dst_subview_type;
790 typedef typename Kokkos::Subview<SrcType,Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6> src_subview_type;
791 dst_subview_type dst_sub;
792 src_subview_type src_sub;
793 CommonSubview(
const DstType& dst,
const SrcType& src,
const Arg0& arg0,
const Arg1& arg1,
794 const Arg2& arg2,
const Arg3& arg3,
const Arg4& arg4,
const Arg5& arg5,
795 const Arg6& arg6, Args...):
796 dst_sub(dst,arg0,arg1,arg2,arg3,arg4,arg5,arg6),src_sub(src,arg0,arg1,arg2,arg3,arg4,arg5,arg6) {}
799 template<
class DstType,
class SrcType,
class Arg0,
class Arg1,
class Arg2,
class Arg3,
800 class Arg4,
class Arg5,
class Arg6,
class Arg7>
801 struct CommonSubview<DstType,SrcType,8,Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7> {
802 typedef typename Kokkos::Subview<DstType,Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7> dst_subview_type;
803 typedef typename Kokkos::Subview<SrcType,Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7> src_subview_type;
804 dst_subview_type dst_sub;
805 src_subview_type src_sub;
806 CommonSubview(
const DstType& dst,
const SrcType& src,
const Arg0& arg0,
const Arg1& arg1,
807 const Arg2& arg2,
const Arg3& arg3,
const Arg4& arg4,
const Arg5& arg5,
808 const Arg6& arg6,
const Arg7& arg7):
809 dst_sub(dst,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7),src_sub(src,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7) {}
813 template<
class DstType,
class SrcType,
class ExecSpace =
typename DstType::execution_space,
int Rank = DstType::Rank>
816 template<
class DstType,
class SrcType,
class ExecSpace>
817 struct ViewRemap<DstType,SrcType,ExecSpace,1> {
820 ViewRemap(
const DstType& dst,
const SrcType& src) {
821 if(dst.extent(0) == src.extent(0)) {
824 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
825 typedef CommonSubview<DstType,SrcType,1,p_type> sv_adapter_type;
826 sv_adapter_type common_subview(dst,src,ext0);
827 view_copy(common_subview.dst_sub,common_subview.src_sub);
832 template<
class DstType,
class SrcType,
class ExecSpace>
833 struct ViewRemap<DstType,SrcType,ExecSpace,2> {
836 ViewRemap(
const DstType& dst,
const SrcType& src) {
837 if(dst.extent(0) == src.extent(0)) {
838 if(dst.extent(1) == src.extent(1)) {
841 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
842 typedef CommonSubview<DstType,SrcType,2,Kokkos::Impl::ALL_t,p_type> sv_adapter_type;
843 sv_adapter_type common_subview(dst,src,Kokkos::ALL,ext1);
844 view_copy(common_subview.dst_sub,common_subview.src_sub);
847 if(dst.extent(1) == src.extent(1)) {
848 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
849 typedef CommonSubview<DstType,SrcType,2,p_type,Kokkos::Impl::ALL_t> sv_adapter_type;
850 sv_adapter_type common_subview(dst,src,ext0,Kokkos::ALL);
851 view_copy(common_subview.dst_sub,common_subview.src_sub);
853 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
854 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
855 typedef CommonSubview<DstType,SrcType,2,p_type,p_type> sv_adapter_type;
856 sv_adapter_type common_subview(dst,src,ext0,ext1);
857 view_copy(common_subview.dst_sub,common_subview.src_sub);
863 template<
class DstType,
class SrcType,
class ExecSpace>
864 struct ViewRemap<DstType,SrcType,ExecSpace,3> {
867 ViewRemap(
const DstType& dst,
const SrcType& src) {
868 if(dst.extent(0) == src.extent(0)) {
869 if(dst.extent(2) == src.extent(2)) {
870 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
871 typedef CommonSubview<DstType,SrcType,3,Kokkos::Impl::ALL_t,p_type,Kokkos::Impl::ALL_t> sv_adapter_type;
872 sv_adapter_type common_subview(dst,src,Kokkos::ALL,ext1,Kokkos::ALL);
873 view_copy(common_subview.dst_sub,common_subview.src_sub);
875 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
876 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
877 typedef CommonSubview<DstType,SrcType,3,Kokkos::Impl::ALL_t,p_type,p_type> sv_adapter_type;
878 sv_adapter_type common_subview(dst,src,Kokkos::ALL,ext1,ext2);
879 view_copy(common_subview.dst_sub,common_subview.src_sub);
882 if(dst.extent(2) == src.extent(2)) {
883 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
884 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
885 typedef CommonSubview<DstType,SrcType,3,p_type,p_type,Kokkos::Impl::ALL_t> sv_adapter_type;
886 sv_adapter_type common_subview(dst,src,ext0,ext1,Kokkos::ALL);
887 view_copy(common_subview.dst_sub,common_subview.src_sub);
889 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
890 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
891 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
892 typedef CommonSubview<DstType,SrcType,3,p_type,p_type,p_type> sv_adapter_type;
893 sv_adapter_type common_subview(dst,src,ext0,ext1,ext2);
894 view_copy(common_subview.dst_sub,common_subview.src_sub);
900 template<
class DstType,
class SrcType,
class ExecSpace>
901 struct ViewRemap<DstType,SrcType,ExecSpace,4> {
904 ViewRemap(
const DstType& dst,
const SrcType& src) {
905 if(dst.extent(0) == src.extent(0)) {
906 if(dst.extent(3) == src.extent(3)) {
907 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
908 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
909 typedef CommonSubview<DstType,SrcType,4,Kokkos::Impl::ALL_t,
911 Kokkos::Impl::ALL_t> sv_adapter_type;
912 sv_adapter_type common_subview(dst,src,Kokkos::ALL,
915 view_copy(common_subview.dst_sub,common_subview.src_sub);
917 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
918 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
919 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
920 typedef CommonSubview<DstType,SrcType,4,Kokkos::Impl::ALL_t,
922 p_type> sv_adapter_type;
923 sv_adapter_type common_subview(dst,src,Kokkos::ALL,
926 view_copy(common_subview.dst_sub,common_subview.src_sub);
929 if(dst.extent(7) == src.extent(7)) {
930 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
931 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
932 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
933 typedef CommonSubview<DstType,SrcType,4,p_type,
935 Kokkos::Impl::ALL_t> sv_adapter_type;
936 sv_adapter_type common_subview(dst,src,ext0,
939 view_copy(common_subview.dst_sub,common_subview.src_sub);
941 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
942 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
943 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
944 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
945 typedef CommonSubview<DstType,SrcType,4,p_type,
947 p_type> sv_adapter_type;
948 sv_adapter_type common_subview(dst,src,ext0,
951 view_copy(common_subview.dst_sub,common_subview.src_sub);
957 template<
class DstType,
class SrcType,
class ExecSpace>
958 struct ViewRemap<DstType,SrcType,ExecSpace,5> {
961 ViewRemap(
const DstType& dst,
const SrcType& src) {
962 if(dst.extent(0) == src.extent(0)) {
963 if(dst.extent(4) == src.extent(4)) {
964 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
965 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
966 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
967 typedef CommonSubview<DstType,SrcType,5,Kokkos::Impl::ALL_t,
968 p_type,p_type,p_type,
969 Kokkos::Impl::ALL_t> sv_adapter_type;
970 sv_adapter_type common_subview(dst,src,Kokkos::ALL,
973 view_copy(common_subview.dst_sub,common_subview.src_sub);
975 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
976 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
977 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
978 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
979 typedef CommonSubview<DstType,SrcType,5,Kokkos::Impl::ALL_t,
980 p_type,p_type,p_type,
981 p_type> sv_adapter_type;
982 sv_adapter_type common_subview(dst,src,Kokkos::ALL,
985 view_copy(common_subview.dst_sub,common_subview.src_sub);
988 if(dst.extent(4) == src.extent(4)) {
989 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
990 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
991 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
992 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
993 typedef CommonSubview<DstType,SrcType,5,p_type,
994 p_type,p_type,p_type,
995 Kokkos::Impl::ALL_t> sv_adapter_type;
996 sv_adapter_type common_subview(dst,src,ext0,
999 view_copy(common_subview.dst_sub,common_subview.src_sub);
1001 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
1002 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1003 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1004 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1005 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1006 typedef CommonSubview<DstType,SrcType,5,p_type,
1007 p_type,p_type,p_type,
1008 p_type> sv_adapter_type;
1009 sv_adapter_type common_subview(dst,src,ext0,
1012 view_copy(common_subview.dst_sub,common_subview.src_sub);
1017 template<
class DstType,
class SrcType,
class ExecSpace>
1018 struct ViewRemap<DstType,SrcType,ExecSpace,6> {
1021 ViewRemap(
const DstType& dst,
const SrcType& src) {
1022 if(dst.extent(0) == src.extent(0)) {
1023 if(dst.extent(5) == src.extent(5)) {
1024 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1025 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1026 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1027 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1028 typedef CommonSubview<DstType,SrcType,6,Kokkos::Impl::ALL_t,
1029 p_type,p_type,p_type,p_type,
1030 Kokkos::Impl::ALL_t> sv_adapter_type;
1031 sv_adapter_type common_subview(dst,src,Kokkos::ALL,
1032 ext1,ext2,ext3,ext4,
1034 view_copy(common_subview.dst_sub,common_subview.src_sub);
1036 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1037 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1038 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1039 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1040 p_type ext5(0,std::min(dst.extent(5),src.extent(5)));
1041 typedef CommonSubview<DstType,SrcType,6,Kokkos::Impl::ALL_t,
1042 p_type,p_type,p_type,p_type,
1043 p_type> sv_adapter_type;
1044 sv_adapter_type common_subview(dst,src,Kokkos::ALL,
1045 ext1,ext2,ext3,ext4,
1047 view_copy(common_subview.dst_sub,common_subview.src_sub);
1050 if(dst.extent(5) == src.extent(5)) {
1051 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
1052 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1053 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1054 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1055 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1057 typedef CommonSubview<DstType,SrcType,6,p_type,
1058 p_type,p_type,p_type,p_type,
1059 Kokkos::Impl::ALL_t> sv_adapter_type;
1060 sv_adapter_type common_subview(dst,src,ext0,
1061 ext1,ext2,ext3,ext4,
1063 view_copy(common_subview.dst_sub,common_subview.src_sub);
1065 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
1066 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1067 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1068 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1069 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1070 p_type ext5(0,std::min(dst.extent(5),src.extent(5)));
1072 typedef CommonSubview<DstType,SrcType,6,p_type,
1073 p_type,p_type,p_type,p_type,
1074 p_type> sv_adapter_type;
1075 sv_adapter_type common_subview(dst,src,ext0,
1076 ext1,ext2,ext3,ext4,
1078 view_copy(common_subview.dst_sub,common_subview.src_sub);
1084 template<
class DstType,
class SrcType,
class ExecSpace>
1085 struct ViewRemap<DstType,SrcType,ExecSpace,7> {
1088 ViewRemap(
const DstType& dst,
const SrcType& src) {
1089 if(dst.extent(0) == src.extent(0)) {
1090 if(dst.extent(6) == src.extent(6)) {
1091 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1092 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1093 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1094 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1095 p_type ext5(0,std::min(dst.extent(5),src.extent(5)));
1096 typedef CommonSubview<DstType,SrcType,7,Kokkos::Impl::ALL_t,
1097 p_type,p_type,p_type,p_type,p_type,
1098 Kokkos::Impl::ALL_t> sv_adapter_type;
1099 sv_adapter_type common_subview(dst,src,Kokkos::ALL,
1100 ext1,ext2,ext3,ext4,ext5,
1102 view_copy(common_subview.dst_sub,common_subview.src_sub);
1104 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1105 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1106 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1107 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1108 p_type ext5(0,std::min(dst.extent(5),src.extent(5)));
1109 p_type ext6(0,std::min(dst.extent(6),src.extent(6)));
1110 typedef CommonSubview<DstType,SrcType,7,Kokkos::Impl::ALL_t,
1111 p_type,p_type,p_type,p_type,p_type,
1112 p_type> sv_adapter_type;
1113 sv_adapter_type common_subview(dst,src,Kokkos::ALL,
1114 ext1,ext2,ext3,ext4,ext5,
1116 view_copy(common_subview.dst_sub,common_subview.src_sub);
1119 if(dst.extent(6) == src.extent(6)) {
1120 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
1121 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1122 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1123 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1124 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1125 p_type ext5(0,std::min(dst.extent(5),src.extent(5)));
1126 typedef CommonSubview<DstType,SrcType,7,p_type,
1127 p_type,p_type,p_type,p_type,p_type,
1128 Kokkos::Impl::ALL_t> sv_adapter_type;
1129 sv_adapter_type common_subview(dst,src,ext0,
1130 ext1,ext2,ext3,ext4,ext5,
1132 view_copy(common_subview.dst_sub,common_subview.src_sub);
1134 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
1135 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1136 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1137 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1138 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1139 p_type ext5(0,std::min(dst.extent(5),src.extent(5)));
1140 p_type ext6(0,std::min(dst.extent(6),src.extent(6)));
1141 typedef CommonSubview<DstType,SrcType,7,p_type,
1142 p_type,p_type,p_type,p_type,p_type,
1143 p_type> sv_adapter_type;
1144 sv_adapter_type common_subview(dst,src,ext0,
1145 ext1,ext2,ext3,ext4,ext5,
1147 view_copy(common_subview.dst_sub,common_subview.src_sub);
1153 template<
class DstType,
class SrcType,
class ExecSpace>
1154 struct ViewRemap<DstType,SrcType,ExecSpace,8> {
1157 ViewRemap(
const DstType& dst,
const SrcType& src) {
1158 if(dst.extent(0) == src.extent(0)) {
1159 if(dst.extent(7) == src.extent(7)) {
1160 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1161 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1162 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1163 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1164 p_type ext5(0,std::min(dst.extent(5),src.extent(5)));
1165 p_type ext6(0,std::min(dst.extent(6),src.extent(6)));
1166 typedef CommonSubview<DstType,SrcType,8,Kokkos::Impl::ALL_t,
1167 p_type,p_type,p_type,p_type,p_type,p_type,
1168 Kokkos::Impl::ALL_t> sv_adapter_type;
1169 sv_adapter_type common_subview(dst,src,Kokkos::ALL,
1170 ext1,ext2,ext3,ext4,ext5,ext6,
1172 view_copy(common_subview.dst_sub,common_subview.src_sub);
1174 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1175 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1176 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1177 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1178 p_type ext5(0,std::min(dst.extent(5),src.extent(5)));
1179 p_type ext6(0,std::min(dst.extent(6),src.extent(6)));
1180 p_type ext7(0,std::min(dst.extent(7),src.extent(7)));
1181 typedef CommonSubview<DstType,SrcType,8,Kokkos::Impl::ALL_t,
1182 p_type,p_type,p_type,p_type,p_type,p_type,
1183 p_type> sv_adapter_type;
1184 sv_adapter_type common_subview(dst,src,Kokkos::ALL,
1185 ext1,ext2,ext3,ext4,ext5,ext6,
1187 view_copy(common_subview.dst_sub,common_subview.src_sub);
1190 if(dst.extent(7) == src.extent(7)) {
1191 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
1192 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1193 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1194 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1195 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1196 p_type ext5(0,std::min(dst.extent(5),src.extent(5)));
1197 p_type ext6(0,std::min(dst.extent(6),src.extent(6)));
1198 typedef CommonSubview<DstType,SrcType,8,p_type,
1199 p_type,p_type,p_type,p_type,p_type,p_type,
1200 Kokkos::Impl::ALL_t> sv_adapter_type;
1201 sv_adapter_type common_subview(dst,src,ext0,
1202 ext1,ext2,ext3,ext4,ext5,ext6,
1204 view_copy(common_subview.dst_sub,common_subview.src_sub);
1206 p_type ext0(0,std::min(dst.extent(0),src.extent(0)));
1207 p_type ext1(0,std::min(dst.extent(1),src.extent(1)));
1208 p_type ext2(0,std::min(dst.extent(2),src.extent(2)));
1209 p_type ext3(0,std::min(dst.extent(3),src.extent(3)));
1210 p_type ext4(0,std::min(dst.extent(4),src.extent(4)));
1211 p_type ext5(0,std::min(dst.extent(5),src.extent(5)));
1212 p_type ext6(0,std::min(dst.extent(6),src.extent(6)));
1213 p_type ext7(0,std::min(dst.extent(7),src.extent(7)));
1214 typedef CommonSubview<DstType,SrcType,8,p_type,
1215 p_type,p_type,p_type,p_type,p_type,p_type,
1216 p_type> sv_adapter_type;
1217 sv_adapter_type common_subview(dst,src,ext0,
1218 ext1,ext2,ext3,ext4,ext5,ext6,
1220 view_copy(common_subview.dst_sub,common_subview.src_sub);
1229 template<
class DT ,
class ... DP >
1233 ,
typename ViewTraits<DT,DP...>::const_value_type & value
1234 ,
typename std::enable_if<
1235 std::is_same<
typename ViewTraits<DT,DP...>::specialize ,
void >::value
1238 typedef View<DT,DP...> ViewType;
1239 if(dst.data() == NULL ) {
1246 std::is_same<
typename ViewType::non_const_value_type ,
1247 typename ViewType::value_type >::value
1248 ,
"deep_copy requires non-const type" );
1251 if(dst.span_is_contiguous()) {
1253 Kokkos::Device<
typename ViewType::execution_space,
1254 typename std::conditional<ViewType::Rank==0,
1255 typename ViewType::memory_space,Kokkos::AnonymousSpace
1257 Kokkos::MemoryTraits<0> >
1260 ViewTypeFlat dst_flat(dst.data(),dst.size());
1261 if(dst.span() < std::numeric_limits<int>::max()) {
1262 Kokkos::Impl::ViewFill< ViewTypeFlat , Kokkos::LayoutRight, typename ViewType::execution_space, ViewTypeFlat::Rank, int >( dst_flat , value );
1264 Kokkos::Impl::ViewFill< ViewTypeFlat , Kokkos::LayoutRight, typename ViewType::execution_space, ViewTypeFlat::Rank, int64_t >( dst_flat , value );
1270 int64_t strides[ViewType::Rank+1];
1271 dst.stride(strides);
1272 Kokkos::Iterate iterate;
1273 if ( std::is_same<typename ViewType::array_layout,Kokkos::LayoutRight>::value ) {
1274 iterate = Kokkos::Iterate::Right;
1275 }
else if ( std::is_same<typename ViewType::array_layout,Kokkos::LayoutLeft>::value ) {
1276 iterate = Kokkos::Iterate::Left;
1277 }
else if ( std::is_same<typename ViewType::array_layout,Kokkos::LayoutStride>::value ) {
1278 if( strides[0] > strides[ViewType::Rank>0?ViewType::Rank-1:0] )
1279 iterate = Kokkos::Iterate::Right;
1281 iterate = Kokkos::Iterate::Left;
1283 if( std::is_same<typename ViewType::execution_space::array_layout, Kokkos::LayoutRight>::value )
1284 iterate = Kokkos::Iterate::Right;
1286 iterate = Kokkos::Iterate::Left;
1290 typedef typename std::conditional<ViewType::Rank==0,
1291 typename ViewType::uniform_runtime_type,
1292 typename ViewType::uniform_runtime_nomemspace_type>::type ViewTypeUniform;
1293 if(dst.span() > std::numeric_limits<int>::max()) {
1294 if(iterate == Kokkos::Iterate::Right)
1295 Kokkos::Impl::ViewFill< ViewTypeUniform, Kokkos::LayoutRight, typename ViewType::execution_space, ViewType::Rank, int64_t >( dst , value );
1297 Kokkos::Impl::ViewFill< ViewTypeUniform, Kokkos::LayoutLeft, typename ViewType::execution_space, ViewType::Rank, int64_t >( dst , value );
1299 if(iterate == Kokkos::Iterate::Right)
1300 Kokkos::Impl::ViewFill< ViewTypeUniform, Kokkos::LayoutRight, typename ViewType::execution_space, ViewType::Rank, int >( dst , value );
1302 Kokkos::Impl::ViewFill< ViewTypeUniform, Kokkos::LayoutLeft, typename ViewType::execution_space, ViewType::Rank, int >( dst , value );
1308 template<
class ST ,
class ... SP >
1311 (
typename ViewTraits<ST,SP...>::non_const_value_type & dst
1313 ,
typename std::enable_if<
1314 std::is_same<
typename ViewTraits<ST,SP...>::specialize ,
void >::value
1318 ,
"ERROR: Non-rank-zero view in deep_copy( value , View )" );
1320 if(src.data() == NULL) {
1326 typedef typename src_traits::memory_space src_memory_space ;
1327 Kokkos::Impl::DeepCopy< HostSpace , src_memory_space >( & dst , src.data() ,
sizeof(ST) );
1332 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
1337 ,
typename std::enable_if<(
1338 std::is_same<
typename ViewTraits<DT,DP...>::specialize ,
void >::value &&
1339 std::is_same<
typename ViewTraits<ST,SP...>::specialize ,
void >::value &&
1345 std::is_same<
typename ViewTraits<DT,DP...>::value_type ,
1346 typename ViewTraits<ST,SP...>::non_const_value_type >::value
1347 ,
"deep_copy requires matching non-const destination type" );
1349 if(dst.data() == NULL && src.data() == NULL) {
1354 typedef View<DT,DP...> dst_type ;
1355 typedef View<ST,SP...> src_type ;
1357 typedef typename dst_type::value_type value_type ;
1358 typedef typename dst_type::memory_space dst_memory_space ;
1359 typedef typename src_type::memory_space src_memory_space ;
1362 if ( dst.data() != src.data() ) {
1363 Kokkos::Impl::DeepCopy< dst_memory_space , src_memory_space >( dst.data() , src.data() ,
sizeof(value_type) );
1372 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
1377 ,
typename std::enable_if<(
1378 std::is_same<
typename ViewTraits<DT,DP...>::specialize ,
void >::value &&
1379 std::is_same<
typename ViewTraits<ST,SP...>::specialize ,
void >::value &&
1384 typedef View<DT,DP...> dst_type ;
1385 typedef View<ST,SP...> src_type ;
1388 std::is_same<
typename dst_type::value_type ,
1389 typename dst_type::non_const_value_type >::value
1390 ,
"deep_copy requires non-const destination type" );
1393 (
unsigned(dst_type::rank) ==
1394 unsigned(src_type::rank) )
1395 ,
"deep_copy requires Views of equal rank" );
1398 typedef typename dst_type::execution_space dst_execution_space ;
1399 typedef typename src_type::execution_space src_execution_space ;
1400 typedef typename dst_type::memory_space dst_memory_space ;
1401 typedef typename src_type::memory_space src_memory_space ;
1402 typedef typename dst_type::value_type dst_value_type ;
1403 typedef typename src_type::value_type src_value_type ;
1404 if(dst.data() == NULL || src.data() == NULL) {
1405 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
1418 std::string message(
"Deprecation Error: Kokkos::deep_copy extents of views don't match: ");
1419 message += dst.label(); message +=
"(";
1420 for(
int r = 0; r<dst_type::Rank-1; r++)
1421 { message+= std::to_string(dst.
extent(r)); message +=
","; }
1422 message+= std::to_string(dst.
extent(dst_type::Rank-1)); message +=
") ";
1423 message += src.label(); message +=
"(";
1424 for(
int r = 0; r<src_type::Rank-1; r++)
1425 { message+= std::to_string(src.
extent(r)); message +=
","; }
1426 message+= std::to_string(src.
extent(src_type::Rank-1)); message +=
") ";
1428 Kokkos::Impl::throw_runtime_exception(message);
1435 enum { DstExecCanAccessSrc =
1438 enum { SrcExecCanAccessDst =
1442 dst_value_type* dst_start = dst.data();
1443 dst_value_type* dst_end = dst.data() + dst.span();
1444 src_value_type* src_start = src.data();
1445 src_value_type* src_end = src.data() + src.span();
1446 if( ((std::ptrdiff_t)dst_start == (std::ptrdiff_t)src_start) &&
1447 ((std::ptrdiff_t)dst_end == (std::ptrdiff_t)src_end) &&
1448 (dst.span_is_contiguous() && src.span_is_contiguous()) ) {
1453 if( ( ( (std::ptrdiff_t)dst_start < (std::ptrdiff_t)src_end ) && ( (std::ptrdiff_t)dst_end > (std::ptrdiff_t)src_start ) ) &&
1454 ( ( dst.span_is_contiguous() && src.span_is_contiguous() ))) {
1455 std::string message(
"Error: Kokkos::deep_copy of overlapping views: ");
1456 message += dst.label(); message +=
"(";
1457 message += std::to_string((std::ptrdiff_t)dst_start); message +=
",";
1458 message += std::to_string((std::ptrdiff_t)dst_end); message +=
") ";
1459 message += src.label(); message +=
"(";
1460 message += std::to_string((std::ptrdiff_t)src_start); message +=
",";
1461 message += std::to_string((std::ptrdiff_t)src_end); message +=
") ";
1462 Kokkos::Impl::throw_runtime_exception(message);
1475 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
1477 if ( DstExecCanAccessSrc ) {
1479 Kokkos::Impl::ViewRemap< dst_type , src_type >( dst , src );
1481 else if ( SrcExecCanAccessDst ) {
1483 Kokkos::Impl::ViewRemap< dst_type , src_type , src_execution_space >( dst , src );
1486 Kokkos::Impl::throw_runtime_exception(
"deep_copy given views that would require a temporary allocation");
1491 std::string message(
"Deprecation Error: Kokkos::deep_copy extents of views don't match: ");
1492 message += dst.label(); message +=
"(";
1493 for(
int r = 0; r<dst_type::Rank-1; r++)
1494 { message+= std::to_string(dst.
extent(r)); message +=
","; }
1495 message+= std::to_string(dst.
extent(dst_type::Rank-1)); message +=
") ";
1496 message += src.label(); message +=
"(";
1497 for(
int r = 0; r<src_type::Rank-1; r++)
1498 { message+= std::to_string(src.
extent(r)); message +=
","; }
1499 message+= std::to_string(src.
extent(src_type::Rank-1)); message +=
") ";
1501 Kokkos::Impl::throw_runtime_exception(message);
1507 if ( std::is_same<
typename dst_type::value_type ,
1508 typename src_type::non_const_value_type >::value &&
1510 std::is_same<
typename dst_type::array_layout ,
1511 typename src_type::array_layout >::value
1513 ( dst_type::rank == 1 &&
1514 src_type::rank == 1 )
1516 dst.span_is_contiguous() &&
1517 src.span_is_contiguous() &&
1518 ((dst_type::rank < 1) || (dst.stride_0() == src.stride_0())) &&
1519 ((dst_type::rank < 2) || (dst.stride_1() == src.stride_1())) &&
1520 ((dst_type::rank < 3) || (dst.stride_2() == src.stride_2())) &&
1521 ((dst_type::rank < 4) || (dst.stride_3() == src.stride_3())) &&
1522 ((dst_type::rank < 5) || (dst.stride_4() == src.stride_4())) &&
1523 ((dst_type::rank < 6) || (dst.stride_5() == src.stride_5())) &&
1524 ((dst_type::rank < 7) || (dst.stride_6() == src.stride_6())) &&
1525 ((dst_type::rank < 8) || (dst.stride_7() == src.stride_7()))
1527 const size_t nbytes =
sizeof(
typename dst_type::value_type) * dst.span();
1529 if((
void*)dst.data()!=(
void*)src.data()) {
1530 Kokkos::Impl::DeepCopy< dst_memory_space , src_memory_space >
1531 ( dst.data() , src.data() , nbytes );
1536 Impl::view_copy(dst, src);
1543 namespace Experimental {
1547 template<
class TeamType,
class DT ,
class ... DP ,
class ST ,
class ... SP >
1548 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
const TeamType& team,
const View<DT,DP...> & dst,
const View<ST,SP...> & src) {
1550 dst.data()[i] = src.data()[i];
1554 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
1555 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
const View<DT,DP...> & dst,
const View<ST,SP...> & src) {
1557 for(
size_t i=0;i<src.span();++i) {
1558 dst.data()[i] = src.data()[i];
1562 template<
class TeamType,
class DT ,
class ... DP ,
class ST ,
class ... SP >
1563 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
1564 const View<ST,SP...> & src,
1565 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 1 &&
1566 unsigned(ViewTraits<ST,SP...>::rank) == 1
1569 if( dst.data() == nullptr ) {
1573 const size_t N = dst.extent(0);
1575 team.team_barrier();
1579 team.team_barrier();
1582 template<
class TeamType,
class DT ,
class ... DP ,
class ST ,
class ... SP >
1583 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
1584 const View<ST,SP...> & src,
1585 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 2 &&
1586 unsigned(ViewTraits<ST,SP...>::rank) == 2
1589 if( dst.data() == nullptr ) {
1593 const size_t N = dst.extent(0)*dst.extent(1);
1595 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1596 team.team_barrier();
1597 local_deep_copy_contiguous(team,dst,src);
1598 team.team_barrier();
1600 team.team_barrier();
1602 int i0 = i%dst.extent(0);
1603 int i1 = i/dst.extent(0);
1604 dst(i0,i1) = src(i0,i1);
1606 team.team_barrier();
1610 template<
class TeamType,
class DT ,
class ... DP ,
class ST ,
class ... SP >
1611 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
1612 const View<ST,SP...> & src,
1613 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 3 &&
1614 unsigned(ViewTraits<ST,SP...>::rank) == 3
1617 if( dst.data() == nullptr ) {
1621 const size_t N = dst.extent(0)*dst.extent(1)*dst.extent(2);
1623 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1624 team.team_barrier();
1625 local_deep_copy_contiguous(team,dst,src);
1626 team.team_barrier();
1628 team.team_barrier();
1630 int i0 = i%dst.extent(0);
1631 int itmp = i/dst.extent(0);
1632 int i1 = itmp%dst.extent(1);
1633 int i2 = itmp/dst.extent(1);
1634 dst(i0,i1,i2) = src(i0,i1,i2);
1636 team.team_barrier();
1640 template<
class TeamType,
class DT ,
class ... DP ,
class ST ,
class ... SP >
1641 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
1642 const View<ST,SP...> & src,
1643 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 4 &&
1644 unsigned(ViewTraits<ST,SP...>::rank) == 4
1647 if( dst.data() == nullptr ) {
1651 const size_t N = dst.extent(0)*dst.extent(1)*dst.extent(2)*dst.extent(3);
1653 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1654 team.team_barrier();
1655 local_deep_copy_contiguous(team,dst,src);
1656 team.team_barrier();
1658 team.team_barrier();
1660 int i0 = i%dst.extent(0);
1661 int itmp = i/dst.extent(0);
1662 int i1 = itmp%dst.extent(1);
1663 itmp = itmp/dst.extent(1);
1664 int i2 = itmp%dst.extent(2);
1665 int i3 = itmp/dst.extent(2);
1666 dst(i0,i1,i2,i3) = src(i0,i1,i2,i3);
1668 team.team_barrier();
1672 template<
class TeamType,
class DT ,
class ... DP ,
class ST ,
class ... SP >
1673 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
1674 const View<ST,SP...> & src,
1675 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 5 &&
1676 unsigned(ViewTraits<ST,SP...>::rank) == 5
1679 if( dst.data() == nullptr ) {
1683 const size_t N = dst.extent(0)*dst.extent(1)*dst.extent(2)*dst.extent(3)*dst.extent(4);
1685 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1686 team.team_barrier();
1687 local_deep_copy_contiguous(team,dst,src);
1688 team.team_barrier();
1690 team.team_barrier();
1692 int i0 = i%dst.extent(0);
1693 int itmp = i/dst.extent(0);
1694 int i1 = itmp%dst.extent(1);
1695 itmp = itmp/dst.extent(1);
1696 int i2 = itmp%dst.extent(2);
1697 itmp = itmp/dst.extent(2);
1698 int i3 = itmp%dst.extent(3);
1699 int i4 = itmp/dst.extent(3);
1700 dst(i0,i1,i2,i3,i4) = src(i0,i1,i2,i3,i4);
1702 team.team_barrier();
1706 template<
class TeamType,
class DT ,
class ... DP ,
class ST ,
class ... SP >
1707 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
1708 const View<ST,SP...> & src,
1709 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 6 &&
1710 unsigned(ViewTraits<ST,SP...>::rank) == 6
1713 if( dst.data() == nullptr ) {
1717 const size_t N = dst.extent(0)*dst.extent(1)*dst.extent(2)*dst.extent(3)*dst.extent(4)*dst.extent(5);
1719 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1720 team.team_barrier();
1721 local_deep_copy_contiguous(team,dst,src);
1722 team.team_barrier();
1724 team.team_barrier();
1726 int i0 = i%dst.extent(0);
1727 int itmp = i/dst.extent(0);
1728 int i1 = itmp%dst.extent(1);
1729 itmp = itmp/dst.extent(1);
1730 int i2 = itmp%dst.extent(2);
1731 itmp = itmp/dst.extent(2);
1732 int i3 = itmp%dst.extent(3);
1733 itmp = itmp/dst.extent(3);
1734 int i4 = itmp%dst.extent(4);
1735 int i5 = itmp/dst.extent(4);
1736 dst(i0,i1,i2,i3,i4,i5) = src(i0,i1,i2,i3,i4,i5);
1738 team.team_barrier();
1742 template<
class TeamType,
class DT ,
class ... DP ,
class ST ,
class ... SP >
1743 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
1744 const View<ST,SP...> & src,
1745 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 7 &&
1746 unsigned(ViewTraits<ST,SP...>::rank) == 7
1749 if( dst.data() == nullptr ) {
1753 const size_t N = dst.extent(0)*dst.extent(1)*dst.extent(2)*dst.extent(3)*dst.extent(4)*dst.extent(5)*dst.extent(6);
1755 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1756 team.team_barrier();
1757 local_deep_copy_contiguous(team,dst,src);
1758 team.team_barrier();
1760 team.team_barrier();
1762 int i0 = i%dst.extent(0);
1763 int itmp = i/dst.extent(0);
1764 int i1 = itmp%dst.extent(1);
1765 itmp = itmp/dst.extent(1);
1766 int i2 = itmp%dst.extent(2);
1767 itmp = itmp/dst.extent(2);
1768 int i3 = itmp%dst.extent(3);
1769 itmp = itmp/dst.extent(3);
1770 int i4 = itmp%dst.extent(4);
1771 itmp = itmp/dst.extent(4);
1772 int i5 = itmp%dst.extent(5);
1773 int i6 = itmp/dst.extent(5);
1774 dst(i0,i1,i2,i3,i4,i5,i6) = src(i0,i1,i2,i3,i4,i5,i6);
1776 team.team_barrier();
1780 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
1781 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
1782 const View<ST,SP...> & src,
1783 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 1 &&
1784 unsigned(ViewTraits<ST,SP...>::rank) == 1
1787 if( dst.data() == nullptr ) {
1791 const size_t N = dst.extent(0);
1794 for(
size_t i=0;i<N;++i){
1799 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
1800 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
1801 const View<ST,SP...> & src,
1802 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 2 &&
1803 unsigned(ViewTraits<ST,SP...>::rank) == 2
1806 if( dst.data() == nullptr ) {
1810 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1811 local_deep_copy_contiguous(dst,src);
1814 for(
size_t i0=0;i0<dst.extent(0);++i0)
1815 for(
size_t i1=0;i1<dst.extent(1);++i1)
1816 dst(i0,i1) = src(i0,i1);
1820 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
1821 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
1822 const View<ST,SP...> & src,
1823 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 3 &&
1824 unsigned(ViewTraits<ST,SP...>::rank) == 3
1827 if( dst.data() == nullptr ) {
1831 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1832 local_deep_copy_contiguous(dst,src);
1835 for(
size_t i0=0;i0<dst.extent(0);++i0)
1836 for(
size_t i1=0;i1<dst.extent(1);++i1)
1837 for(
size_t i2=0;i2<dst.extent(2);++i2)
1838 dst(i0,i1,i2) = src(i0,i1,i2);
1842 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
1843 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
1844 const View<ST,SP...> & src,
1845 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 4 &&
1846 unsigned(ViewTraits<ST,SP...>::rank) == 4
1849 if( dst.data() == nullptr ) {
1853 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1854 local_deep_copy_contiguous(dst,src);
1857 for(
size_t i0=0;i0<dst.extent(0);++i0)
1858 for(
size_t i1=0;i1<dst.extent(1);++i1)
1859 for(
size_t i2=0;i2<dst.extent(2);++i2)
1860 for(
size_t i3=0;i3<dst.extent(3);++i3)
1861 dst(i0,i1,i2,i3) = src(i0,i1,i2,i3);
1865 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
1866 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
1867 const View<ST,SP...> & src,
1868 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 5 &&
1869 unsigned(ViewTraits<ST,SP...>::rank) == 5
1872 if( dst.data() == nullptr ) {
1876 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1877 local_deep_copy_contiguous(dst,src);
1880 for(
size_t i0=0;i0<dst.extent(0);++i0)
1881 for(
size_t i1=0;i1<dst.extent(1);++i1)
1882 for(
size_t i2=0;i2<dst.extent(2);++i2)
1883 for(
size_t i3=0;i3<dst.extent(3);++i3)
1884 for(
size_t i4=0;i4<dst.extent(4);++i4)
1885 dst(i0,i1,i2,i3,i4) = src(i0,i1,i2,i3,i4);
1889 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
1890 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
1891 const View<ST,SP...> & src,
1892 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 6 &&
1893 unsigned(ViewTraits<ST,SP...>::rank) == 6
1896 if( dst.data() == nullptr ) {
1900 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1901 local_deep_copy_contiguous(dst,src);
1904 for(
size_t i0=0;i0<dst.extent(0);++i0)
1905 for(
size_t i1=0;i1<dst.extent(1);++i1)
1906 for(
size_t i2=0;i2<dst.extent(2);++i2)
1907 for(
size_t i3=0;i3<dst.extent(3);++i3)
1908 for(
size_t i4=0;i4<dst.extent(4);++i4)
1909 for(
size_t i5=0;i5<dst.extent(5);++i5)
1910 dst(i0,i1,i2,i3,i4,i5) = src(i0,i1,i2,i3,i4,i5);
1914 template<
class DT ,
class ... DP ,
class ST ,
class ... SP >
1915 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
1916 const View<ST,SP...> & src,
1917 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 7 &&
1918 unsigned(ViewTraits<ST,SP...>::rank) == 7
1921 if( dst.data() == nullptr ) {
1925 if ( dst.span_is_contiguous() && src.span_is_contiguous() ) {
1926 local_deep_copy_contiguous(dst,src);
1929 for(
size_t i0=0;i0<dst.extent(0);++i0)
1930 for(
size_t i1=0;i1<dst.extent(1);++i1)
1931 for(
size_t i2=0;i2<dst.extent(2);++i2)
1932 for(
size_t i3=0;i3<dst.extent(3);++i3)
1933 for(
size_t i4=0;i4<dst.extent(4);++i4)
1934 for(
size_t i5=0;i5<dst.extent(5);++i5)
1935 for(
size_t i6=0;i6<dst.extent(6);++i6)
1936 dst(i0,i1,i2,i3,i4,i5,i6) = src(i0,i1,i2,i3,i4,i5,i6);
1942 template<
class TeamType,
class DT ,
class ... DP >
1943 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
const TeamType& team,
const View<DT,DP...> & dst,
typename ViewTraits<DT,DP...>::const_value_type & value) {
1945 dst.data()[i] = value;
1949 template<
class DT ,
class ... DP >
1950 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
const View<DT,DP...> & dst,
typename ViewTraits<DT,DP...>::const_value_type & value) {
1952 for(
size_t i=0;i<dst.span();++i) {
1953 dst.data()[i] = value;
1957 template<
class TeamType,
class DT ,
class ... DP >
1958 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
1959 typename ViewTraits<DT,DP...>::const_value_type & value,
1960 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 1 )>::type * = 0 )
1962 if( dst.data() == nullptr ) {
1966 const size_t N = dst.extent(0);
1968 team.team_barrier();
1972 team.team_barrier();
1975 template<
class TeamType,
class DT ,
class ... DP >
1976 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
1977 typename ViewTraits<DT,DP...>::const_value_type & value,
1978 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 2 )>::type * = 0 )
1980 if( dst.data() == nullptr ) {
1984 const size_t N = dst.extent(0)*dst.extent(1);
1986 if ( dst.span_is_contiguous() ) {
1987 team.team_barrier();
1988 local_deep_copy_contiguous(team,dst,value);
1989 team.team_barrier();
1991 team.team_barrier();
1993 int i0 = i%dst.extent(0);
1994 int i1 = i/dst.extent(0);
1997 team.team_barrier();
2001 template<
class TeamType,
class DT ,
class ... DP >
2002 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
2003 typename ViewTraits<DT,DP...>::const_value_type & value,
2004 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 3 )>::type * = 0 )
2006 if( dst.data() == nullptr ) {
2010 const size_t N = dst.extent(0)*dst.extent(1)*dst.extent(2);
2012 if ( dst.span_is_contiguous() ) {
2013 team.team_barrier();
2014 local_deep_copy_contiguous(team,dst,value);
2015 team.team_barrier();
2017 team.team_barrier();
2019 int i0 = i%dst.extent(0);
2020 int itmp = i/dst.extent(0);
2021 int i1 = itmp%dst.extent(1);
2022 int i2 = itmp/dst.extent(1);
2023 dst(i0,i1,i2) = value;
2025 team.team_barrier();
2029 template<
class TeamType,
class DT ,
class ... DP >
2030 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
2031 typename ViewTraits<DT,DP...>::const_value_type & value,
2032 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 4 )>::type * = 0 )
2034 if( dst.data() == nullptr ) {
2038 const size_t N = dst.extent(0)*dst.extent(1)*dst.extent(2)*dst.extent(3);
2040 if ( dst.span_is_contiguous() ) {
2041 team.team_barrier();
2042 local_deep_copy_contiguous(team,dst,value);
2043 team.team_barrier();
2045 team.team_barrier();
2047 int i0 = i%dst.extent(0);
2048 int itmp = i/dst.extent(0);
2049 int i1 = itmp%dst.extent(1);
2050 itmp = itmp/dst.extent(1);
2051 int i2 = itmp%dst.extent(2);
2052 int i3 = itmp/dst.extent(2);
2053 dst(i0,i1,i2,i3) = value;
2055 team.team_barrier();
2059 template<
class TeamType,
class DT ,
class ... DP >
2060 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
2061 typename ViewTraits<DT,DP...>::const_value_type & value,
2062 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 5 )>::type * = 0 )
2064 if( dst.data() == nullptr ) {
2068 const size_t N = dst.extent(0)*dst.extent(1)*dst.extent(2)*dst.extent(3)*dst.extent(4);
2070 if ( dst.span_is_contiguous() ) {
2071 team.team_barrier();
2072 local_deep_copy_contiguous(team,dst,value);
2073 team.team_barrier();
2075 team.team_barrier();
2077 int i0 = i%dst.extent(0);
2078 int itmp = i/dst.extent(0);
2079 int i1 = itmp%dst.extent(1);
2080 itmp = itmp/dst.extent(1);
2081 int i2 = itmp%dst.extent(2);
2082 itmp = itmp/dst.extent(2);
2083 int i3 = itmp%dst.extent(3);
2084 int i4 = itmp/dst.extent(3);
2085 dst(i0,i1,i2,i3,i4) = value;
2087 team.team_barrier();
2091 template<
class TeamType,
class DT ,
class ... DP >
2092 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
2093 typename ViewTraits<DT,DP...>::const_value_type & value,
2094 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 6 )>::type * = 0 )
2096 if( dst.data() == nullptr ) {
2100 const size_t N = dst.extent(0)*dst.extent(1)*dst.extent(2)*dst.extent(3)*dst.extent(4)*dst.extent(5);
2102 if ( dst.span_is_contiguous() ) {
2103 team.team_barrier();
2104 local_deep_copy_contiguous(team,dst,value);
2105 team.team_barrier();
2107 team.team_barrier();
2109 int i0 = i%dst.extent(0);
2110 int itmp = i/dst.extent(0);
2111 int i1 = itmp%dst.extent(1);
2112 itmp = itmp/dst.extent(1);
2113 int i2 = itmp%dst.extent(2);
2114 itmp = itmp/dst.extent(2);
2115 int i3 = itmp%dst.extent(3);
2116 itmp = itmp/dst.extent(3);
2117 int i4 = itmp%dst.extent(4);
2118 int i5 = itmp/dst.extent(4);
2119 dst(i0,i1,i2,i3,i4,i5) = value;
2121 team.team_barrier();
2125 template<
class TeamType,
class DT ,
class ... DP >
2126 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const TeamType& team,
const View<DT,DP...> & dst,
2127 typename ViewTraits<DT,DP...>::const_value_type & value,
2128 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 7 )>::type * = 0 )
2130 if( dst.data() == nullptr ) {
2134 const size_t N = dst.extent(0)*dst.extent(1)*dst.extent(2)*dst.extent(3)*dst.extent(4)*dst.extent(5)*dst.extent(6);
2136 if ( dst.span_is_contiguous() ) {
2137 team.team_barrier();
2138 local_deep_copy_contiguous(team,dst,value);
2139 team.team_barrier();
2141 team.team_barrier();
2143 int i0 = i%dst.extent(0);
2144 int itmp = i/dst.extent(0);
2145 int i1 = itmp%dst.extent(1);
2146 itmp = itmp/dst.extent(1);
2147 int i2 = itmp%dst.extent(2);
2148 itmp = itmp/dst.extent(2);
2149 int i3 = itmp%dst.extent(3);
2150 itmp = itmp/dst.extent(3);
2151 int i4 = itmp%dst.extent(4);
2152 itmp = itmp/dst.extent(4);
2153 int i5 = itmp%dst.extent(5);
2154 int i6 = itmp/dst.extent(5);
2155 dst(i0,i1,i2,i3,i4,i5,i6) = value;
2157 team.team_barrier();
2161 template<
class DT ,
class ... DP >
2162 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
2163 typename ViewTraits<DT,DP...>::const_value_type & value,
2164 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 1
2167 if( dst.data() == nullptr ) {
2171 const size_t N = dst.extent(0);
2174 for(
size_t i=0;i<N;++i){
2179 template<
class DT ,
class ... DP >
2180 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
2181 typename ViewTraits<DT,DP...>::const_value_type & value,
2182 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 2
2185 if( dst.data() == nullptr ) {
2189 if ( dst.span_is_contiguous() ) {
2190 local_deep_copy_contiguous(dst,value);
2193 for(
size_t i0=0;i0<dst.extent(0);++i0)
2194 for(
size_t i1=0;i1<dst.extent(1);++i1)
2199 template<
class DT ,
class ... DP >
2200 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
2201 typename ViewTraits<DT,DP...>::const_value_type & value,
2202 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 3
2205 if( dst.data() == nullptr ) {
2209 if ( dst.span_is_contiguous() ) {
2210 local_deep_copy_contiguous(dst,value);
2213 for(
size_t i0=0;i0<dst.extent(0);++i0)
2214 for(
size_t i1=0;i1<dst.extent(1);++i1)
2215 for(
size_t i2=0;i2<dst.extent(2);++i2)
2216 dst(i0,i1,i2) = value;
2220 template<
class DT ,
class ... DP >
2221 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
2222 typename ViewTraits<DT,DP...>::const_value_type & value,
2223 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 4
2226 if( dst.data() == nullptr ) {
2230 if ( dst.span_is_contiguous() ) {
2231 local_deep_copy_contiguous(dst,value);
2234 for(
size_t i0=0;i0<dst.extent(0);++i0)
2235 for(
size_t i1=0;i1<dst.extent(1);++i1)
2236 for(
size_t i2=0;i2<dst.extent(2);++i2)
2237 for(
size_t i3=0;i3<dst.extent(3);++i3)
2238 dst(i0,i1,i2,i3) = value;
2242 template<
class DT ,
class ... DP >
2243 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
2244 typename ViewTraits<DT,DP...>::const_value_type & value,
2245 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 5
2248 if( dst.data() == nullptr ) {
2252 if ( dst.span_is_contiguous() ) {
2253 local_deep_copy_contiguous(dst,value);
2256 for(
size_t i0=0;i0<dst.extent(0);++i0)
2257 for(
size_t i1=0;i1<dst.extent(1);++i1)
2258 for(
size_t i2=0;i2<dst.extent(2);++i2)
2259 for(
size_t i3=0;i3<dst.extent(3);++i3)
2260 for(
size_t i4=0;i4<dst.extent(4);++i4)
2261 dst(i0,i1,i2,i3,i4) = value;
2265 template<
class DT ,
class ... DP >
2266 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
2267 typename ViewTraits<DT,DP...>::const_value_type & value,
2268 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 6
2271 if( dst.data() == nullptr ) {
2275 if ( dst.span_is_contiguous() ) {
2276 local_deep_copy_contiguous(dst,value);
2279 for(
size_t i0=0;i0<dst.extent(0);++i0)
2280 for(
size_t i1=0;i1<dst.extent(1);++i1)
2281 for(
size_t i2=0;i2<dst.extent(2);++i2)
2282 for(
size_t i3=0;i3<dst.extent(3);++i3)
2283 for(
size_t i4=0;i4<dst.extent(4);++i4)
2284 for(
size_t i5=0;i5<dst.extent(5);++i5)
2285 dst(i0,i1,i2,i3,i4,i5) = value;
2289 template<
class DT ,
class ... DP >
2290 void KOKKOS_INLINE_FUNCTION local_deep_copy (
const View<DT,DP...> & dst,
2291 typename ViewTraits<DT,DP...>::const_value_type & value,
2292 typename std::enable_if<(
unsigned(ViewTraits<DT,DP...>::rank) == 7
2295 if( dst.data() == nullptr ) {
2299 if ( dst.span_is_contiguous() ) {
2300 local_deep_copy_contiguous(dst,value);
2303 for(
size_t i0=0;i0<dst.extent(0);++i0)
2304 for(
size_t i1=0;i1<dst.extent(1);++i1)
2305 for(
size_t i2=0;i2<dst.extent(2);++i2)
2306 for(
size_t i3=0;i3<dst.extent(3);++i3)
2307 for(
size_t i4=0;i4<dst.extent(4);++i4)
2308 for(
size_t i5=0;i5<dst.extent(5);++i5)
2309 for(
size_t i6=0;i6<dst.extent(6);++i6)
2310 dst(i0,i1,i2,i3,i4,i5,i6) = value;
2322 template<
class ExecSpace ,
class DT ,
class ... DP >
2327 ,
typename ViewTraits<DT,DP...>::const_value_type & value
2328 ,
typename std::enable_if<
2329 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
2330 std::is_same<
typename ViewTraits<DT,DP...>::specialize ,
void >::value
2334 std::is_same<
typename ViewTraits<DT,DP...>::non_const_value_type ,
2335 typename ViewTraits<DT,DP...>::value_type >::value
2336 ,
"deep_copy requires non-const type" );
2338 ExecSpace().fence();
2339 typedef typename View<DT,DP...>::uniform_runtime_nomemspace_type ViewTypeUniform;
2340 Kokkos::Impl::ViewFill< ViewTypeUniform >( dst , value );
2341 ExecSpace().fence();
2345 template<
class ExecSpace ,
class ST ,
class ... SP >
2348 (
const ExecSpace & exec_space
2349 ,
typename ViewTraits<ST,SP...>::non_const_value_type & dst
2351 ,
typename std::enable_if<
2352 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
2353 std::is_same<
typename ViewTraits<ST,SP...>::specialize ,
void >::value
2357 ,
"ERROR: Non-rank-zero view in deep_copy( value , View )" );
2359 if(src.data() == NULL) {
2365 typedef typename src_traits::memory_space src_memory_space ;
2366 Kokkos::Impl::DeepCopy< HostSpace , src_memory_space , ExecSpace >
2367 ( exec_space , & dst , src.data() ,
sizeof(ST) );
2372 template<
class ExecSpace ,
class DT ,
class ... DP ,
class ST ,
class ... SP >
2375 (
const ExecSpace & exec_space
2378 ,
typename std::enable_if<(
2379 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
2380 std::is_same<
typename ViewTraits<DT,DP...>::specialize ,
void >::value &&
2381 std::is_same<
typename ViewTraits<ST,SP...>::specialize ,
void >::value &&
2387 std::is_same<
typename ViewTraits<DT,DP...>::value_type ,
2388 typename ViewTraits<ST,SP...>::non_const_value_type >::value
2389 ,
"deep_copy requires matching non-const destination type" );
2391 typedef View<DT,DP...> dst_type ;
2392 typedef View<ST,SP...> src_type ;
2394 typedef typename dst_type::value_type value_type ;
2395 typedef typename dst_type::memory_space dst_memory_space ;
2396 typedef typename src_type::memory_space src_memory_space ;
2397 if(dst.data() == NULL && src.data() == NULL) {
2403 if ( dst.data() != src.data() ) {
2404 Kokkos::Impl::DeepCopy< dst_memory_space , src_memory_space , ExecSpace >
2405 ( exec_space , dst.data() , src.data() ,
sizeof(value_type) );
2414 template<
class ExecSpace ,
class DT,
class ... DP,
class ST,
class ... SP >
2417 (
const ExecSpace & exec_space
2420 ,
typename std::enable_if<(
2421 Kokkos::Impl::is_execution_space< ExecSpace >::value &&
2422 std::is_same<
typename ViewTraits<DT,DP...>::specialize ,
void >::value &&
2423 std::is_same<
typename ViewTraits<ST,SP...>::specialize ,
void >::value &&
2428 typedef View<DT,DP...> dst_type ;
2429 typedef View<ST,SP...> src_type ;
2432 std::is_same<
typename dst_type::value_type ,
2433 typename dst_type::non_const_value_type >::value
2434 ,
"deep_copy requires non-const destination type" );
2437 (
unsigned(dst_type::rank) ==
2438 unsigned(src_type::rank) )
2439 ,
"deep_copy requires Views of equal rank" );
2441 typedef typename dst_type::execution_space dst_execution_space ;
2442 typedef typename src_type::execution_space src_execution_space ;
2443 typedef typename dst_type::memory_space dst_memory_space ;
2444 typedef typename src_type::memory_space src_memory_space ;
2445 typedef typename dst_type::value_type dst_value_type ;
2446 typedef typename src_type::value_type src_value_type ;
2448 if(dst.data() == NULL || src.data() == NULL) {
2449 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
2462 std::string message(
"Deprecation Error: Kokkos::deep_copy extents of views don't match: ");
2463 message += dst.label(); message +=
"(";
2464 for(
int r = 0; r<dst_type::Rank-1; r++)
2465 { message+= std::to_string(dst.
extent(r)); message +=
","; }
2466 message+= std::to_string(dst.
extent(dst_type::Rank-1)); message +=
") ";
2467 message += src.label(); message +=
"(";
2468 for(
int r = 0; r<src_type::Rank-1; r++)
2469 { message+= std::to_string(src.
extent(r)); message +=
","; }
2470 message+= std::to_string(src.
extent(src_type::Rank-1)); message +=
") ";
2472 Kokkos::Impl::throw_runtime_exception(message);
2479 enum { ExecCanAccessSrcDst =
2483 enum { DstExecCanAccessSrc =
2486 enum { SrcExecCanAccessDst =
2490 dst_value_type* dst_start = dst.data();
2491 dst_value_type* dst_end = dst.data() + dst.span();
2492 src_value_type* src_start = src.data();
2493 src_value_type* src_end = src.data() + src.span();
2494 if( ( ( (std::ptrdiff_t)dst_start < (std::ptrdiff_t)src_end ) && ( (std::ptrdiff_t)dst_end > (std::ptrdiff_t)src_start ) ) &&
2495 ( ( dst.span_is_contiguous() && src.span_is_contiguous() ))) {
2496 std::string message(
"Error: Kokkos::deep_copy of overlapping views: ");
2497 message += dst.label(); message +=
"(";
2498 message += std::to_string((std::ptrdiff_t)dst_start); message +=
",";
2499 message += std::to_string((std::ptrdiff_t)dst_end); message +=
") ";
2500 message += src.label(); message +=
"(";
2501 message += std::to_string((std::ptrdiff_t)src_start); message +=
",";
2502 message += std::to_string((std::ptrdiff_t)src_end); message +=
") ";
2503 Kokkos::Impl::throw_runtime_exception(message);
2516 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
2518 if ( ExecCanAccessSrcDst ) {
2519 Kokkos::Impl::ViewRemap< dst_type , src_type , ExecSpace >( dst , src );
2521 else if ( DstExecCanAccessSrc ) {
2523 Kokkos::Impl::ViewRemap< dst_type , src_type >( dst , src );
2525 else if ( SrcExecCanAccessDst ) {
2527 Kokkos::Impl::ViewRemap< dst_type , src_type , src_execution_space >( dst , src );
2530 Kokkos::Impl::throw_runtime_exception(
"deep_copy given views that would require a temporary allocation");
2535 std::string message(
"Deprecation Error: Kokkos::deep_copy extents of views don't match: ");
2536 message += dst.label(); message +=
"(";
2537 for(
int r = 0; r<dst_type::Rank-1; r++)
2538 { message+= std::to_string(dst.
extent(r)); message +=
","; }
2539 message+= std::to_string(dst.
extent(dst_type::Rank-1)); message +=
") ";
2540 message += src.label(); message +=
"(";
2541 for(
int r = 0; r<src_type::Rank-1; r++)
2542 { message+= std::to_string(src.
extent(r)); message +=
","; }
2543 message+= std::to_string(src.
extent(src_type::Rank-1)); message +=
") ";
2545 Kokkos::Impl::throw_runtime_exception(message);
2551 if ( std::is_same<
typename dst_type::value_type ,
2552 typename src_type::non_const_value_type >::value &&
2554 std::is_same<
typename dst_type::array_layout ,
2555 typename src_type::array_layout >::value
2557 ( dst_type::rank == 1 &&
2558 src_type::rank == 1 )
2560 dst.span_is_contiguous() &&
2561 src.span_is_contiguous() &&
2562 ((dst_type::rank < 1) || (dst.stride_0() == src.stride_0())) &&
2563 ((dst_type::rank < 2) || (dst.stride_1() == src.stride_1())) &&
2564 ((dst_type::rank < 3) || (dst.stride_2() == src.stride_2())) &&
2565 ((dst_type::rank < 4) || (dst.stride_3() == src.stride_3())) &&
2566 ((dst_type::rank < 5) || (dst.stride_4() == src.stride_4())) &&
2567 ((dst_type::rank < 6) || (dst.stride_5() == src.stride_5())) &&
2568 ((dst_type::rank < 7) || (dst.stride_6() == src.stride_6())) &&
2569 ((dst_type::rank < 8) || (dst.stride_7() == src.stride_7()))
2572 const size_t nbytes =
sizeof(
typename dst_type::value_type) * dst.span();
2574 if((
void*)dst.data() != (
void*)src.data()) {
2575 Kokkos::Impl::DeepCopy< dst_memory_space , src_memory_space , ExecSpace >
2576 ( exec_space , dst.data() , src.data() , nbytes );
2581 Impl::view_copy(dst, src);
2594 template<
class T ,
class ... P >
2596 typename std::enable_if<
2601 const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2602 const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2603 const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2604 const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2605 const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2606 const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2607 const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2608 const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG )
2619 if (view_type::Rank == 1 &&
2620 n0 == static_cast<size_t> (v.
extent(0))) {
2623 if (view_type::Rank == 2 &&
2624 n0 == static_cast<size_t> (v.
extent(0)) &&
2625 n1 == static_cast<size_t> (v.
extent(1))) {
2628 if (view_type::Rank == 3 &&
2629 n0 == static_cast<size_t> (v.
extent(0)) &&
2630 n1 == static_cast<size_t> (v.
extent(1)) &&
2631 n2 == static_cast<size_t> (v.
extent(2))) {
2634 if (view_type::Rank == 4 &&
2635 n0 == static_cast<size_t> (v.
extent(0)) &&
2636 n1 == static_cast<size_t> (v.
extent(1)) &&
2637 n2 == static_cast<size_t> (v.
extent(2)) &&
2638 n3 == static_cast<size_t> (v.
extent(3))) {
2641 if (view_type::Rank == 5 &&
2642 n0 == static_cast<size_t> (v.
extent(0)) &&
2643 n1 == static_cast<size_t> (v.
extent(1)) &&
2644 n2 == static_cast<size_t> (v.
extent(2)) &&
2645 n3 == static_cast<size_t> (v.
extent(3)) &&
2646 n4 == static_cast<size_t> (v.
extent(4))) {
2649 if (view_type::Rank == 6 &&
2650 n0 == static_cast<size_t> (v.
extent(0)) &&
2651 n1 == static_cast<size_t> (v.
extent(1)) &&
2652 n2 == static_cast<size_t> (v.
extent(2)) &&
2653 n3 == static_cast<size_t> (v.
extent(3)) &&
2654 n4 == static_cast<size_t> (v.
extent(4)) &&
2655 n5 == static_cast<size_t> (v.
extent(5))) {
2658 if (view_type::Rank == 7 &&
2659 n0 == static_cast<size_t> (v.
extent(0)) &&
2660 n1 == static_cast<size_t> (v.
extent(1)) &&
2661 n2 == static_cast<size_t> (v.
extent(2)) &&
2662 n3 == static_cast<size_t> (v.
extent(3)) &&
2663 n4 == static_cast<size_t> (v.
extent(4)) &&
2664 n5 == static_cast<size_t> (v.
extent(5)) &&
2665 n6 == static_cast<size_t> (v.
extent(6))) {
2668 if (view_type::Rank == 8 &&
2669 n0 == static_cast<size_t> (v.
extent(0)) &&
2670 n1 == static_cast<size_t> (v.
extent(1)) &&
2671 n2 == static_cast<size_t> (v.
extent(2)) &&
2672 n3 == static_cast<size_t> (v.
extent(3)) &&
2673 n4 == static_cast<size_t> (v.
extent(4)) &&
2674 n5 == static_cast<size_t> (v.
extent(5)) &&
2675 n6 == static_cast<size_t> (v.
extent(6)) &&
2676 n7 == static_cast<size_t> (v.
extent(7))) {
2690 view_type v_resized( v.label(), n0, n1, n2, n3, n4, n5, n6, n7 );
2692 Kokkos::Impl::ViewRemap< view_type , view_type >( v_resized , v );
2698 template<
class T ,
class ... P >
2701 const typename Kokkos::View<T,P...>::array_layout & layout)
2707 view_type v_resized( v.label(), layout );
2709 Kokkos::Impl::ViewRemap< view_type , view_type >( v_resized , v );
2715 template<
class T ,
class ... P >
2717 typename std::enable_if<
2722 const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2723 const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2724 const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2725 const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2726 const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2727 const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2728 const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG ,
2729 const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG )
2735 const std::string label = v.label();
2738 v = view_type( label, n0, n1, n2, n3, n4, n5, n6, n7 );
2742 template<
class T ,
class ... P >
2745 const typename Kokkos::View<T,P...>::array_layout & layout)
2751 const std::string label = v.label();
2754 v = view_type( label, layout );
2765 template<
class Space,
class T,
class ... P>
2766 struct MirrorViewType {
2770 typedef typename Space::memory_space memory_space;
2772 enum { is_same_memspace = std::is_same<memory_space,typename src_view_type::memory_space>::value };
2774 typedef typename src_view_type::array_layout array_layout;
2776 typedef typename src_view_type::non_const_data_type data_type;
2781 typedef typename std::conditional<is_same_memspace,src_view_type,dest_view_type>::type view_type;
2784 template<
class Space,
class T,
class ... P>
2789 typedef typename Space::memory_space memory_space;
2791 enum { is_same_memspace = std::is_same<memory_space,typename src_view_type::memory_space>::value };
2793 typedef typename src_view_type::array_layout array_layout;
2795 typedef typename src_view_type::non_const_data_type data_type;
2802 template<
class T ,
class ... P >
2806 ,
typename std::enable_if<
2807 std::is_same<
typename ViewTraits<T,P...>::specialize ,
void >::value &&
2808 ! std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
2813 typedef View<T,P...> src_type ;
2814 typedef typename src_type::HostMirror dst_type ;
2816 return dst_type( std::string( src.label() ).append(
"_mirror")
2817 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
2827 , src.rank_dynamic > 0 ? src.
extent(0): KOKKOS_IMPL_CTOR_DEFAULT_ARG
2828 , src.rank_dynamic > 1 ? src.
extent(1): KOKKOS_IMPL_CTOR_DEFAULT_ARG
2829 , src.rank_dynamic > 2 ? src.
extent(2): KOKKOS_IMPL_CTOR_DEFAULT_ARG
2830 , src.rank_dynamic > 3 ? src.
extent(3): KOKKOS_IMPL_CTOR_DEFAULT_ARG
2831 , src.rank_dynamic > 4 ? src.
extent(4): KOKKOS_IMPL_CTOR_DEFAULT_ARG
2832 , src.rank_dynamic > 5 ? src.
extent(5): KOKKOS_IMPL_CTOR_DEFAULT_ARG
2833 , src.rank_dynamic > 6 ? src.
extent(6): KOKKOS_IMPL_CTOR_DEFAULT_ARG
2834 , src.rank_dynamic > 7 ? src.
extent(7): KOKKOS_IMPL_CTOR_DEFAULT_ARG );
2838 template<
class T ,
class ... P >
2842 ,
typename std::enable_if<
2843 std::is_same<
typename ViewTraits<T,P...>::specialize ,
void >::value &&
2844 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout
2849 typedef View<T,P...> src_type ;
2850 typedef typename src_type::HostMirror dst_type ;
2854 layout.dimension[0] = src.
extent(0);
2855 layout.dimension[1] = src.
extent(1);
2856 layout.dimension[2] = src.
extent(2);
2857 layout.dimension[3] = src.
extent(3);
2858 layout.dimension[4] = src.
extent(4);
2859 layout.dimension[5] = src.
extent(5);
2860 layout.dimension[6] = src.
extent(6);
2861 layout.dimension[7] = src.
extent(7);
2863 layout.stride[0] = src.stride_0();
2864 layout.stride[1] = src.stride_1();
2865 layout.stride[2] = src.stride_2();
2866 layout.stride[3] = src.stride_3();
2867 layout.stride[4] = src.stride_4();
2868 layout.stride[5] = src.stride_5();
2869 layout.stride[6] = src.stride_6();
2870 layout.stride[7] = src.stride_7();
2872 return dst_type( std::string( src.label() ).append(
"_mirror") , layout );
2877 template<
class Space,
class T,
class ... P>
2878 typename Impl::MirrorType<Space,T,P ...>::view_type
2880 ,
typename std::enable_if<
2881 std::is_same<
typename ViewTraits<T,P...>::specialize ,
void >::value
2883 return typename Impl::MirrorType<Space,T,P ...>::view_type(src.label(),src.layout());
2886 template<
class T ,
class ... P >
2890 ,
typename std::enable_if<(
2891 std::is_same<
typename Kokkos::View<T,P...>::memory_space
2892 ,
typename Kokkos::View<T,P...>::HostMirror::memory_space
2895 std::is_same<
typename Kokkos::View<T,P...>::data_type
2896 ,
typename Kokkos::View<T,P...>::HostMirror::data_type
2904 template<
class T ,
class ... P >
2908 ,
typename std::enable_if< ! (
2909 std::is_same<
typename Kokkos::View<T,P...>::memory_space
2910 ,
typename Kokkos::View<T,P...>::HostMirror::memory_space
2913 std::is_same<
typename Kokkos::View<T,P...>::data_type
2914 ,
typename Kokkos::View<T,P...>::HostMirror::data_type
2919 return Kokkos::create_mirror( src );
2923 template<
class Space,
class T,
class ... P>
2924 typename Impl::MirrorViewType<Space,T,P ...>::view_type
2926 ,
typename std::enable_if<Impl::MirrorViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
2931 template<
class Space,
class T,
class ... P>
2932 typename Impl::MirrorViewType<Space,T,P ...>::view_type
2934 ,
typename std::enable_if<!Impl::MirrorViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
2935 return typename Impl::MirrorViewType<Space,T,P ...>::view_type(src.label(),src.layout());
2939 template<
class Space,
class T,
class ... P>
2940 typename Impl::MirrorViewType<Space,T,P ...>::view_type
2942 , std::string
const& name =
""
2943 ,
typename std::enable_if<Impl::MirrorViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
2949 template<
class Space,
class T,
class ... P>
2950 typename Impl::MirrorViewType<Space,T,P ...>::view_type
2952 , std::string
const& name =
""
2953 ,
typename std::enable_if<!Impl::MirrorViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
2954 using Mirror =
typename Impl::MirrorViewType<Space,T,P ...>::view_type;
2955 std::string label = name.empty() ? src.label() : name;
2956 auto mirror = Mirror(ViewAllocateWithoutInitializing(label), src.layout());
2962 template<
class Space,
class T,
class ... P>
2963 typename Impl::MirrorViewType<Space,T,P ...>::view_type
2965 , Kokkos::Impl::WithoutInitializing_t
2966 ,
typename std::enable_if<Impl::MirrorViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
2971 template<
class Space,
class T,
class ... P>
2972 typename Impl::MirrorViewType<Space,T,P ...>::view_type
2974 , Kokkos::Impl::WithoutInitializing_t
2975 ,
typename std::enable_if<!Impl::MirrorViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
2976 using Mirror =
typename Impl::MirrorViewType<Space,T,P ...>::view_type;
2977 return Mirror(Kokkos::ViewAllocateWithoutInitializing(src.label()), src.layout());
void parallel_for(const ExecPolicy &policy, const FunctorType &functor, const std::string &str="", typename Impl::enable_if< Kokkos::Impl::is_execution_policy< ExecPolicy >::value >::type *=0)
Execute functor in parallel according to the execution policy.
KOKKOS_INLINE_FUNCTION_DELETED Impl::TeamThreadRangeBoundariesStruct< iType, TeamMemberType > TeamThreadRange(const TeamMemberType &, const iType &count)=delete
Execution policy for parallel work over a threads within a team.
Memory layout tag indicating left-to-right (Fortran scheme) striding of multi-indices.
Can AccessSpace access MemorySpace ?
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=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n1=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n2=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n3=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n4=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n5=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n6=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n7=KOKKOS_IMPL_CTOR_DEFAULT_ARG)
Resize a view with copying old data to new data at the corresponding indices.
Replacement for std::pair that works on CUDA devices.
Memory layout tag indicated arbitrarily strided multi-index mapping into contiguous memory...
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.
View to an array of data.
Memory layout tag indicating right-to-left (C or lexigraphical 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=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n1=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n2=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n3=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n4=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n5=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n6=KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n7=KOKKOS_IMPL_CTOR_DEFAULT_ARG)
Resize a view with discarding old data.
Execution policy for work over a range of an integral type.
Traits class for accessing attributes of a View.
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< std::is_integral< iType >::value, size_t >::type extent(const iType &r) const noexcept
rank() to be implemented