42 #ifndef TPETRA_MULTIVECTOR_DECL_HPP
43 #define TPETRA_MULTIVECTOR_DECL_HPP
57 #include "Tpetra_DistObject.hpp"
59 #include "Kokkos_DualView.hpp"
60 #include "Teuchos_BLAS_types.hpp"
61 #include "Teuchos_DataAccess.hpp"
62 #include "Teuchos_Range1D.hpp"
63 #include "Kokkos_ArithTraits.hpp"
64 #include "Kokkos_InnerProductSpaceTraits.hpp"
65 #include "Tpetra_KokkosRefactor_Details_MultiVectorLocalDeepCopy.hpp"
66 #include <type_traits>
96 template<
class DstMultiVectorType,
class SrcMultiVectorType>
98 typedef DstMultiVectorType dst_mv_type;
99 typedef SrcMultiVectorType src_mv_type;
101 static Teuchos::RCP<dst_mv_type>
102 clone (
const src_mv_type& X,
103 const Teuchos::RCP<typename dst_mv_type::node_type>& node2);
127 template <
class DS,
class DL,
class DG,
class DN,
128 class SS,
class SL,
class SG,
class SN>
140 template <
class ST,
class LO,
class GO,
class NT>
153 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
154 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
156 const size_t numVectors);
162 template<
class SC,
class LO,
class GO,
class NT>
163 Teuchos::ArrayView<const size_t>
385 template <
class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
387 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
390 public DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>
435 typedef typename Kokkos::Details::InnerProductSpaceTraits<impl_scalar_type>::dot_type
dot_type;
443 typedef typename Kokkos::Details::ArithTraits<impl_scalar_type>::mag_type
mag_type;
494 MultiVector (
const Teuchos::RCP<const map_type>& map,
495 const size_t numVecs,
496 const bool zeroOut =
true);
514 const Teuchos::DataAccess copyOrView);
531 MultiVector (
const Teuchos::RCP<const map_type>& map,
532 const Teuchos::ArrayView<const Scalar>& A,
534 const size_t NumVectors);
549 MultiVector (
const Teuchos::RCP<const map_type>& map,
550 const Teuchos::ArrayView<
const Teuchos::ArrayView<const Scalar> >&ArrayOfPtrs,
551 const size_t NumVectors);
565 MultiVector (
const Teuchos::RCP<const map_type>& map,
606 MultiVector (
const Teuchos::RCP<const map_type>& map,
607 const typename dual_view_type::t_dev& d_view);
631 MultiVector (
const Teuchos::RCP<const map_type>& map,
663 MultiVector (
const Teuchos::RCP<const map_type>& map,
665 const Teuchos::ArrayView<const size_t>& whichVectors);
694 MultiVector (
const Teuchos::RCP<const map_type>& map,
697 const Teuchos::ArrayView<const size_t>& whichVectors);
759 const size_t offset = 0);
769 template <
class Node2>
770 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node2> >
771 clone (
const Teuchos::RCP<Node2>& node2)
const;
792 #ifdef KOKKOS_ENABLE_SERIAL
793 ! std::is_same<execution_space, Kokkos::Serial>::value;
796 #endif // KOKKOS_ENABLE_SERIAL
865 typename std::enable_if<! std::is_same<T, impl_scalar_type>::value && std::is_convertible<T, impl_scalar_type>::value,
void>::type
868 const T& value)
const
930 typename std::enable_if<! std::is_same<T, impl_scalar_type>::value && std::is_convertible<T, impl_scalar_type>::value,
void>::type
1004 template<
typename T>
1005 typename std::enable_if<! std::is_same<T, impl_scalar_type>::value && std::is_convertible<T, impl_scalar_type>::value,
void>::type
1067 template<
typename T>
1068 typename std::enable_if<! std::is_same<T, impl_scalar_type>::value && std::is_convertible<T, impl_scalar_type>::value,
void>::type
1088 template<
typename T>
1089 typename std::enable_if<! std::is_same<T, impl_scalar_type>::value && std::is_convertible<T, impl_scalar_type>::value,
void>::type
1092 putScalar (static_cast<impl_scalar_type> (value));
1122 void randomize (
const Scalar& minVal,
const Scalar& maxVal);
1189 void replaceMap (
const Teuchos::RCP<const map_type>& map);
1233 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
1234 subCopy (
const Teuchos::Range1D& colRng)
const;
1237 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
1238 subCopy (
const Teuchos::ArrayView<const size_t>& cols)
const;
1241 Teuchos::RCP<const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
1242 subView (
const Teuchos::Range1D& colRng)
const;
1245 Teuchos::RCP<const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
1246 subView (
const Teuchos::ArrayView<const size_t>& cols)
const;
1249 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
1253 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
1318 Teuchos::RCP<const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
1319 offsetView (
const Teuchos::RCP<const map_type>& subMap,
1320 const size_t offset)
const;
1339 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
1341 const size_t offset);
1344 Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
1348 Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
1352 Teuchos::ArrayRCP<const Scalar>
getData (
size_t j)
const;
1365 get1dCopy (
const Teuchos::ArrayView<Scalar>& A,
1366 const size_t LDA)
const;
1375 get2dCopy (
const Teuchos::ArrayView<
const Teuchos::ArrayView<Scalar> >& ArrayOfPtrs)
const;
1382 Teuchos::ArrayRCP<const Scalar>
get1dView ()
const;
1385 Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >
get2dView ()
const;
1431 template<
class TargetDeviceType>
1433 getDualView ().template sync<TargetDeviceType> ();
1437 template<
class TargetDeviceType>
1439 return getDualView ().template need_sync<TargetDeviceType> ();
1447 template<
class TargetDeviceType>
1449 getDualView ().template modify<TargetDeviceType> ();
1483 template<
class TargetDeviceType>
1484 typename Kokkos::Impl::if_c<
1486 typename device_type::memory_space,
1487 typename TargetDeviceType::memory_space>::value,
1488 typename dual_view_type::t_dev,
1489 typename dual_view_type::t_host>::type
1491 return getDualView ().template view<TargetDeviceType> ();
1513 const Teuchos::ArrayView<dot_type>& dots)
const;
1526 template <
typename T>
1527 typename std::enable_if< ! (std::is_same<dot_type, T>::value),
void >::type
1529 const Teuchos::ArrayView<T> &dots)
const
1531 const size_t sz = static_cast<size_t> (dots.size ());
1532 Teuchos::Array<dot_type> dts (sz);
1534 for (
size_t i = 0; i < sz; ++i) {
1541 template <
typename T>
1542 typename std::enable_if< ! (std::is_same<dot_type, T>::value),
void >::type
1544 std::vector<T>& dots)
const
1546 const size_t sz = dots.size ();
1547 Teuchos::Array<dot_type> dts (sz);
1549 for (
size_t i = 0; i < sz; ++i) {
1574 const Kokkos::View<dot_type*, Kokkos::HostSpace>& norms)
const;
1576 template<
class ViewType>
1578 dot (
typename std::enable_if<std::is_same<typename ViewType::value_type,dot_type>::value &&
1579 std::is_same<typename ViewType::memory_space,typename device_type::memory_space>::value,
1581 const ViewType& dots)
const {
1582 const Kokkos::View<dot_type*, Kokkos::HostSpace> h_dots(
"Tpetra::Dots",dots.extent(0));
1583 this->
dot (A, h_dots);
1599 template <
typename T>
1600 typename std::enable_if< ! (std::is_same<dot_type, T>::value),
void >::type
1602 const Kokkos::View<T*, device_type>& dots)
const
1604 const size_t numDots = dots.extent (0);
1605 Kokkos::View<dot_type*, device_type> dts (
"MV::dot tmp", numDots);
1631 void scale (
const Scalar& alpha);
1641 void scale (
const Teuchos::ArrayView<const Scalar>& alpha);
1651 void scale (
const Kokkos::View<const impl_scalar_type*, device_type>& alpha);
1662 scale (
const Scalar& alpha,
1672 update (
const Scalar& alpha,
1674 const Scalar& beta);
1683 update (
const Scalar& alpha,
1687 const Scalar& gamma);
1706 template<
class ViewType>
1707 typename std::enable_if<std::is_same<typename ViewType::value_type,mag_type>::value &&
1708 std::is_same<typename ViewType::memory_space,typename device_type::memory_space>::value>::type
1710 typedef typename Kokkos::View<mag_type*, Kokkos::HostSpace> host_norms_view_type;
1711 host_norms_view_type h_norms(
"Tpetra::MV::h_norms",norms.extent(0));
1712 this->
normImpl (h_norms, NORM_ONE);
1715 void norm1 (
const Kokkos::View<mag_type*, Kokkos::HostSpace>& norms)
const;
1732 template <
typename T>
1733 typename std::enable_if< ! (std::is_same<mag_type, T>::value),
void >::type
1734 norm1 (
const Kokkos::View<T*, device_type>& norms)
const
1736 const size_t numNorms = norms.extent (0);
1737 Kokkos::View<mag_type*, device_type> tmpNorms (
"MV::norm1 tmp", numNorms);
1739 this->
norm1 (tmpNorms);
1751 void norm1 (
const Teuchos::ArrayView<mag_type>& norms)
const;
1767 template <
typename T>
1768 typename std::enable_if< ! (std::is_same<mag_type,T>::value),
void >::type
1769 norm1 (
const Teuchos::ArrayView<T>& norms)
const
1771 typedef typename Teuchos::ArrayView<T>::size_type size_type;
1772 const size_type sz = norms.size ();
1773 Teuchos::Array<mag_type> theNorms (sz);
1774 this->
norm1 (theNorms);
1775 for (size_type i = 0; i < sz; ++i) {
1777 norms[i] = theNorms[i];
1799 template<
class ViewType>
1800 typename std::enable_if<std::is_same<typename ViewType::value_type,mag_type>::value &&
1801 std::is_same<typename ViewType::memory_space,typename device_type::memory_space>::value>::type
1803 typedef typename Kokkos::View<mag_type*, Kokkos::HostSpace> host_norms_view_type;
1804 host_norms_view_type h_norms(
"Tpetra::MV::h_norms",norms.extent(0));
1805 this->
normImpl (h_norms, NORM_TWO);
1808 void norm2 (
const Kokkos::View<mag_type*, Kokkos::HostSpace>& norms)
const;
1823 template<
typename T>
1824 typename std::enable_if< ! (std::is_same<mag_type, T>::value),
void >::type
1825 norm2 (
const Kokkos::View<T*, device_type>& norms)
const
1827 const size_t numNorms = norms.extent (0);
1828 Kokkos::View<mag_type*, device_type> theNorms (
"MV::norm2 tmp", numNorms);
1830 this->
norm2 (theNorms);
1842 void norm2 (
const Teuchos::ArrayView<mag_type>& norms)
const;
1858 template <
typename T>
1859 typename std::enable_if< ! (std::is_same<mag_type,T>::value),
void >::type
1860 norm2 (
const Teuchos::ArrayView<T>& norms)
const
1862 typedef typename Teuchos::ArrayView<T>::size_type size_type;
1863 const size_type sz = norms.size ();
1864 Teuchos::Array<mag_type> theNorms (sz);
1865 this->
norm2 (theNorms);
1866 for (size_type i = 0; i < sz; ++i) {
1868 norms[i] = theNorms[i];
1884 template<
class ViewType>
1885 typename std::enable_if<std::is_same<typename ViewType::value_type,mag_type>::value &&
1886 std::is_same<typename ViewType::memory_space,typename device_type::memory_space>::value>::type
1888 typedef typename Kokkos::View<mag_type*, Kokkos::HostSpace> host_norms_view_type;
1889 host_norms_view_type h_norms(
"Tpetra::MV::h_norms",norms.extent(0));
1890 this->
normImpl (h_norms, NORM_INF);
1893 void normInf (
const Kokkos::View<mag_type*, Kokkos::HostSpace>& norms)
const;
1908 template<
typename T>
1909 typename std::enable_if< ! (std::is_same<mag_type, T>::value),
void >::type
1910 normInf (
const Kokkos::View<T*, device_type>& norms)
const
1912 const size_t numNorms = norms.extent (0);
1913 Kokkos::View<mag_type*, device_type> theNorms (
"MV::normInf tmp", numNorms);
1928 void normInf (
const Teuchos::ArrayView<mag_type>& norms)
const;
1945 template <
typename T>
1946 typename std::enable_if< ! (std::is_same<mag_type,T>::value),
void >::type
1947 normInf (
const Teuchos::ArrayView<T>& norms)
const
1949 typedef typename Teuchos::ArrayView<T>::size_type size_type;
1950 const size_type sz = norms.size ();
1951 Teuchos::Array<mag_type> theNorms (sz);
1952 this->
norm2 (theNorms);
1953 for (size_type i = 0; i < sz; ++i) {
1955 norms[i] = theNorms[i];
1965 void TPETRA_DEPRECATED
1967 const Teuchos::ArrayView<mag_type>& norms)
const;
1985 template <
typename T>
1986 typename std::enable_if< ! (std::is_same<mag_type,T>::value),
void >::type
1989 const Teuchos::ArrayView<T>& norms)
const
1991 typedef typename Teuchos::ArrayView<T>::size_type size_type;
1992 const size_type sz = norms.size ();
1993 Teuchos::Array<mag_type> theNorms (sz);
1995 for (size_type i = 0; i < sz; ++i) {
1997 norms[i] = theNorms[i];
2005 void meanValue (
const Teuchos::ArrayView<impl_scalar_type>& means)
const;
2007 template <
typename T>
2008 typename std::enable_if<! std::is_same<impl_scalar_type, T>::value,
void>::type
2009 meanValue (
const Teuchos::ArrayView<T>& means)
const
2011 typedef typename Teuchos::Array<T>::size_type size_type;
2012 const size_type numMeans = means.size ();
2014 Teuchos::Array<impl_scalar_type> theMeans (numMeans);
2016 for (size_type k = 0; k < numMeans; ++k) {
2017 means[k] = static_cast<T> (theMeans[k]);
2028 Teuchos::ETransp transB,
2029 const Scalar& alpha,
2030 const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
2031 const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& B,
2032 const Scalar& beta);
2056 const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
2057 const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& B,
2121 describe (Teuchos::FancyOStream& out,
2122 const Teuchos::EVerbosityLevel verbLevel =
2123 Teuchos::Describable::verbLevel_default)
const;
2153 TEUCHOS_TEST_FOR_EXCEPTION(
2154 copyOrView == Teuchos::Copy, std::invalid_argument,
2155 "Tpetra::MultiVector::setCopyOrView: The Kokkos refactor version of "
2156 "MultiVector _only_ implements view semantics. You may not call this "
2157 "method with copyOrView = Teuchos::Copy. The only valid argument is "
2170 return Teuchos::View;
2202 template <
class DS,
class DL,
class DG,
class DN,
2203 class SS,
class SL,
class SG,
class SN>
2261 template<
class SC,
class LO,
class GO,
class NT>
2262 friend ::Teuchos::ArrayView<const size_t> getMultiVectorWhichVectors (const ::Tpetra::MultiVector<SC, LO, GO, NT>& X);
2282 normImpl (
const Kokkos::View<mag_type*, Kokkos::HostSpace>& norms,
2327 const std::string& className,
2328 const Teuchos::EVerbosityLevel verbLevel =
2329 Teuchos::Describable::verbLevel_default)
const;
2332 bool vectorIndexOutOfRange (
const size_t VectorIndex)
const;
2339 Teuchos::ArrayRCP<T>
2369 typedef typename DistObject<Scalar, LocalOrdinal, GlobalOrdinal,
2374 const size_t numSameIDs,
2375 const Kokkos::DualView<const local_ordinal_type*, device_type>& permuteToLIDs,
2376 const Kokkos::DualView<const local_ordinal_type*, device_type>& permuteFromLIDs);
2380 const Kokkos::DualView<const local_ordinal_type*, device_type>& exportLIDs,
2381 Kokkos::DualView<impl_scalar_type*, buffer_device_type>& exports,
2382 const Kokkos::DualView<size_t*, buffer_device_type>& ,
2383 size_t& constantNumPackets,
2387 unpackAndCombineNew (
const Kokkos::DualView<const LocalOrdinal*, device_type>& importLIDs,
2388 const Kokkos::DualView<const impl_scalar_type*, buffer_device_type>& imports,
2389 const Kokkos::DualView<const size_t*, buffer_device_type>& ,
2390 const size_t constantNumPackets,
2396 template<
class SC,
class LO,
class GO,
class NT>
2397 Teuchos::ArrayView<const size_t>
2406 template<
class DstMultiVectorType,
2407 class SrcMultiVectorType>
2408 Teuchos::RCP<typename MultiVectorCloner<DstMultiVectorType, SrcMultiVectorType>::dst_mv_type>
2409 MultiVectorCloner<DstMultiVectorType, SrcMultiVectorType>::
2410 clone (
const src_mv_type& X,
2411 const Teuchos::RCP<typename dst_mv_type::node_type>& node2)
2414 typedef typename src_mv_type::map_type src_map_type;
2415 typedef typename dst_mv_type::map_type dst_map_type;
2416 typedef typename dst_mv_type::node_type dst_node_type;
2417 typedef typename dst_mv_type::dual_view_type dst_dual_view_type;
2420 RCP<const src_map_type> map1 = X.getMap ();
2421 RCP<const dst_map_type> map2 = map1.is_null () ?
2422 Teuchos::null : map1->template clone<dst_node_type> (node2);
2424 const size_t lclNumRows = X.getLocalLength ();
2425 const size_t numCols = X.getNumVectors ();
2426 dst_dual_view_type Y_view (
"MV::dual_view", lclNumRows, numCols);
2428 RCP<dst_mv_type> Y (
new dst_mv_type (map2, Y_view));
2438 template <
class ST,
class LO,
class GO,
class NT>
2450 template <
class DS,
class DL,
class DG,
class DN,
2451 class SS,
class SL,
class SG,
class SN>
2456 typedef typename DN::device_type DD;
2458 using ::Tpetra::Classes::getMultiVectorWhichVectors;
2460 TEUCHOS_TEST_FOR_EXCEPTION(
2463 "Tpetra::deep_copy: Global dimensions of the two Tpetra::MultiVector "
2464 "objects do not match. src has dimensions [" << src.
getGlobalLength ()
2465 <<
"," << src.
getNumVectors () <<
"], and dst has dimensions ["
2469 TEUCHOS_TEST_FOR_EXCEPTION(
2471 "Tpetra::deep_copy: The local row counts of the two Tpetra::MultiVector "
2472 "objects do not match. src has " << src.
getLocalLength () <<
" row(s) "
2480 const bool useHostVersion = src.template need_sync<typename SN::device_type> ();
2482 if (! useHostVersion) {
2484 dst.template modify<DES> ();
2486 Details::localDeepCopyConstStride (dst.template getLocalView<DES> (),
2487 src.template getLocalView<typename SN::device_type> ());
2488 dst.template sync<HES> ();
2491 dst.template modify<HES> ();
2493 Details::localDeepCopyConstStride (dst.template getLocalView<Kokkos::HostSpace> (),
2494 src.template getLocalView<Kokkos::HostSpace> ());
2495 dst.template sync<DES> ();
2499 typedef Kokkos::DualView<SL*, DD> whichvecs_type;
2500 typedef typename whichvecs_type::t_dev::execution_space DES;
2501 typedef typename whichvecs_type::t_host::execution_space HES;
2504 const SL numWhichVecs =
2505 static_cast<SL> (getMultiVectorWhichVectors (src).size ());
2506 const std::string whichVecsLabel (
"MV::deep_copy::whichVecs");
2513 const bool useHostVersion = src.template need_sync<typename SN::device_type> ();
2515 if (! useHostVersion) {
2518 whichvecs_type whichVecs (whichVecsLabel, numWhichVecs);
2519 whichVecs.template modify<HES> ();
2521 Teuchos::ArrayView<const size_t> src_whichVectors =
2522 getMultiVectorWhichVectors (src);
2523 for (SL i = 0; i < numWhichVecs; ++i) {
2524 whichVecs.h_view(i) = static_cast<SL> (src_whichVectors[i]);
2527 whichVecs.template sync<DES> ();
2530 dst.template modify<DES> ();
2532 Details::localDeepCopy (dst.template getLocalView<typename DN::device_type> (),
2533 src.template getLocalView<typename SN::device_type> (),
2540 dst.template sync<HES> ();
2547 typedef Kokkos::View<SL*, HES> the_whichvecs_type;
2548 the_whichvecs_type whichVecs (whichVecsLabel, numWhichVecs);
2549 Teuchos::ArrayView<const size_t> src_whichVectors =
2550 getMultiVectorWhichVectors (src);
2551 for (SL i = 0; i < numWhichVecs; ++i) {
2552 whichVecs(i) = static_cast<SL> (src_whichVectors[i]);
2557 Details::localDeepCopy (dst.template getLocalView<Kokkos::HostSpace> (),
2558 src.template getLocalView<Kokkos::HostSpace> (),
2561 whichVecs, whichVecs);
2563 dst.template sync<DES> ();
2570 const bool useHostVersion = src.template need_sync<typename SN::device_type> ();
2572 if (! useHostVersion) {
2575 typedef Kokkos::DualView<DL*, DES> the_whichvecs_type;
2576 const std::string whichVecsLabel (
"MV::deep_copy::whichVecs");
2577 Teuchos::ArrayView<const size_t> dst_whichVectors =
2578 getMultiVectorWhichVectors (dst);
2579 const DL numWhichVecs = static_cast<DL> (dst_whichVectors.size ());
2580 the_whichvecs_type whichVecs (whichVecsLabel, numWhichVecs);
2581 whichVecs.template modify<HES> ();
2582 for (DL i = 0; i < numWhichVecs; ++i) {
2583 whichVecs.h_view(i) = dst_whichVectors[i];
2586 whichVecs.template sync<DES> ();
2589 Details::localDeepCopy (dst.template getLocalView<typename DN::device_type> (),
2590 src.template getLocalView<typename SN::device_type> (),
2600 dst.template sync<HES> ();
2607 typedef Kokkos::View<DL*, HES> the_whichvecs_type;
2608 Teuchos::ArrayView<const size_t> dst_whichVectors =
2609 getMultiVectorWhichVectors (dst);
2610 const DL numWhichVecs = static_cast<DL> (dst_whichVectors.size ());
2611 the_whichvecs_type whichVecs (
"MV::deep_copy::whichVecs",
2613 for (DL i = 0; i < numWhichVecs; ++i) {
2614 whichVecs(i) = static_cast<DL> (dst_whichVectors[i]);
2617 Details::localDeepCopy (dst.template getLocalView<Kokkos::HostSpace> (),
2618 src.template getLocalView<Kokkos::HostSpace> (),
2621 whichVecs, whichVecs);
2626 dst.template sync<DES> ();
2632 const bool useHostVersion = src.template need_sync<typename SN::device_type> ();
2634 if (! useHostVersion) {
2637 Teuchos::ArrayView<const size_t> dst_whichVectors =
2638 getMultiVectorWhichVectors (dst);
2639 const DL dstNumWhichVecs =
2640 static_cast<DL> (dst_whichVectors.size ());
2641 Kokkos::DualView<DL*, DES> whichVecsDst (
"MV::deep_copy::whichVecsDst",
2643 whichVecsDst.template modify<HES> ();
2644 for (DL i = 0; i < dstNumWhichVecs; ++i) {
2645 whichVecsDst.h_view(i) = static_cast<DL> (dst_whichVectors[i]);
2648 whichVecsDst.template sync<DES> ();
2654 Teuchos::ArrayView<const size_t> src_whichVectors =
2655 getMultiVectorWhichVectors (src);
2656 const DL srcNumWhichVecs =
2657 static_cast<DL> (src_whichVectors.size ());
2658 Kokkos::DualView<DL*, DES> whichVecsSrc (
"MV::deep_copy::whichVecsSrc",
2660 whichVecsSrc.template modify<HES> ();
2661 for (DL i = 0; i < srcNumWhichVecs; ++i) {
2662 whichVecsSrc.h_view(i) = static_cast<DL> (src_whichVectors[i]);
2665 whichVecsSrc.template sync<DES> ();
2669 Details::localDeepCopy (dst.template getLocalView<typename DN::device_type> (),
2670 src.template getLocalView<typename SN::device_type> (),
2673 whichVecsDst.d_view,
2674 whichVecsSrc.d_view);
2677 Teuchos::ArrayView<const size_t> dst_whichVectors =
2678 getMultiVectorWhichVectors (dst);
2679 const DL dstNumWhichVecs =
2680 static_cast<DL> (dst_whichVectors.size ());
2681 Kokkos::View<DL*, HES> whichVectorsDst (
"dstWhichVecs",
2683 for (DL i = 0; i < dstNumWhichVecs; ++i) {
2684 whichVectorsDst(i) = dst_whichVectors[i];
2687 Teuchos::ArrayView<const size_t> src_whichVectors =
2688 getMultiVectorWhichVectors (src);
2690 const DL srcNumWhichVecs =
2691 static_cast<DL> (src_whichVectors.size ());
2692 Kokkos::View<DL*, HES> whichVectorsSrc (
"srcWhichVecs",
2694 for (DL i = 0; i < srcNumWhichVecs; ++i) {
2695 whichVectorsSrc(i) = src_whichVectors[i];
2700 Details::localDeepCopy (dst.template getLocalView<Kokkos::HostSpace> (),
2701 src.template getLocalView<Kokkos::HostSpace> (),
2704 whichVectorsDst, whichVectorsSrc);
2710 dst.template sync<HES> ();
2723 template<
class SC,
class LO,
class GO,
class NT>
2726 static std::string name () {
2727 return std::string (
"Tpetra::MultiVector<") +
2728 TypeNameTraits<SC>::name () +
"," +
2729 TypeNameTraits<LO>::name () +
"," +
2730 TypeNameTraits<GO>::name () +
"," +
2731 TypeNameTraits<NT>::name () +
">";
2741 #endif // TPETRA_MULTIVECTOR_DECL_HPP