42 #ifndef TPETRA_MULTIVECTOR_DECL_HPP 43 #define TPETRA_MULTIVECTOR_DECL_HPP 54 #include "Tpetra_ConfigDefs.hpp" 55 #include "Tpetra_DistObject.hpp" 58 #include "Kokkos_DualView.hpp" 59 #include "Kokkos_MultiVector.hpp" 61 #include "Teuchos_BLAS_types.hpp" 62 #include "Teuchos_DataAccess.hpp" 63 #include "Teuchos_Range1D.hpp" 65 #include "KokkosCompat_ClassicNodeAPI_Wrapper.hpp" 66 #include "Kokkos_InnerProductSpaceTraits.hpp" 67 #include "Kokkos_ArithTraits.hpp" 69 #include "Tpetra_KokkosRefactor_DistObject.hpp" 70 #include "Tpetra_KokkosRefactor_Details_MultiVectorLocalDeepCopy.hpp" 71 #include <type_traits> 75 #ifndef DOXYGEN_SHOULD_SKIP_THIS 77 template<
class LO,
class GO,
class N>
class Map;
80 template<
class S,
class LO,
class GO,
class N, const
bool classic>
class Vector;
83 template<
class S,
class LO,
class GO,
class N, const
bool classic>
class MultiVector;
84 #endif // DOXYGEN_SHOULD_SKIP_THIS 112 template<
class DstMultiVectorType,
class SrcMultiVectorType>
114 typedef DstMultiVectorType dst_mv_type;
115 typedef SrcMultiVectorType src_mv_type;
117 static Teuchos::RCP<dst_mv_type>
118 clone (
const src_mv_type& X,
119 const Teuchos::RCP<typename dst_mv_type::node_type>& node2);
144 template <
class DS,
class DL,
class DG,
class DN,
const bool dstClassic,
145 class SS,
class SL,
class SG,
class SN,
const bool srcClassic>
157 template <
class ST,
class LO,
class GO,
class NT, const
bool classic = NT::
classic>
170 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node, const
bool classic = Node::
classic>
171 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
173 const size_t numVectors);
397 class GlobalOrdinal = Details::DefaultTypes::global_ordinal_type,
399 const bool classic = Node::classic>
401 public DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>
403 static_assert (! classic,
"The 'classic' version of Tpetra was deprecated long ago, and has been removed.");
448 typedef typename Kokkos::Details::InnerProductSpaceTraits<impl_scalar_type>::dot_type
dot_type;
456 typedef typename Kokkos::Details::ArithTraits<impl_scalar_type>::mag_type
mag_type;
488 typedef Kokkos::DualView<impl_scalar_type**, Kokkos::LayoutLeft,
507 MultiVector (
const Teuchos::RCP<const map_type>& map,
508 const size_t numVecs,
509 const bool zeroOut =
true);
523 const Teuchos::DataAccess copyOrView);
540 MultiVector (
const Teuchos::RCP<const map_type>& map,
541 const Teuchos::ArrayView<const Scalar>& A,
543 const size_t NumVectors);
558 MultiVector (
const Teuchos::RCP<const map_type>& map,
559 const Teuchos::ArrayView<
const Teuchos::ArrayView<const Scalar> >&ArrayOfPtrs,
560 const size_t NumVectors);
574 MultiVector (
const Teuchos::RCP<const map_type>& map,
575 const dual_view_type& view);
615 MultiVector (
const Teuchos::RCP<const map_type>& map,
616 const typename dual_view_type::t_dev& d_view);
640 MultiVector (
const Teuchos::RCP<const map_type>& map,
641 const dual_view_type& view,
642 const dual_view_type& origView);
661 MultiVector (
const Teuchos::RCP<const map_type>& map,
662 const dual_view_type& view,
663 const Teuchos::ArrayView<const size_t>& whichVectors);
692 MultiVector (
const Teuchos::RCP<const map_type>& map,
693 const dual_view_type& view,
694 const dual_view_type& origView,
695 const Teuchos::ArrayView<const size_t>& whichVectors);
705 template <
class Node2>
706 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node2> >
707 clone (
const Teuchos::RCP<Node2>& node2)
const;
733 replaceGlobalValue (GlobalOrdinal globalRow,
735 const impl_scalar_type& value);
755 typename std::enable_if<! std::is_same<T, impl_scalar_type>::value && std::is_convertible<T, impl_scalar_type>::value,
void>::type
760 replaceGlobalValue (globalRow, col, static_cast<impl_scalar_type> (value));
780 sumIntoGlobalValue (GlobalOrdinal globalRow,
782 const impl_scalar_type& value);
802 typename std::enable_if<! std::is_same<T, impl_scalar_type>::value && std::is_convertible<T, impl_scalar_type>::value,
void>::type
807 sumIntoGlobalValue (globalRow, col, static_cast<impl_scalar_type> (value));
827 replaceLocalValue (LocalOrdinal localRow,
829 const impl_scalar_type& value);
849 typename std::enable_if<! std::is_same<T, impl_scalar_type>::value && std::is_convertible<T, impl_scalar_type>::value,
void>::type
854 replaceLocalValue (localRow, col, static_cast<impl_scalar_type> (value));
874 sumIntoLocalValue (LocalOrdinal localRow,
876 const impl_scalar_type& value);
896 typename std::enable_if<! std::is_same<T, impl_scalar_type>::value && std::is_convertible<T, impl_scalar_type>::value,
void>::type
901 sumIntoLocalValue (localRow, col, static_cast<impl_scalar_type> (value));
905 void putScalar (
const Scalar& value);
989 void replaceMap (
const Teuchos::RCP<const map_type>& map);
1029 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
1030 subCopy (
const Teuchos::Range1D& colRng)
const;
1033 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
1034 subCopy (
const Teuchos::ArrayView<const size_t>& cols)
const;
1037 Teuchos::RCP<const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
1038 subView (
const Teuchos::Range1D& colRng)
const;
1041 Teuchos::RCP<const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
1042 subView (
const Teuchos::ArrayView<const size_t>& cols)
const;
1045 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
1046 subViewNonConst (
const Teuchos::Range1D& colRng);
1049 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
1050 subViewNonConst (
const Teuchos::ArrayView<const size_t>& cols);
1114 Teuchos::RCP<const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
1115 offsetView (
const Teuchos::RCP<const map_type>& subMap,
1116 const size_t offset)
const;
1135 Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
1136 offsetViewNonConst (
const Teuchos::RCP<const map_type>& subMap,
1137 const size_t offset);
1140 Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
1141 getVector (
const size_t j)
const;
1144 Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic> >
1145 getVectorNonConst (
const size_t j);
1148 Teuchos::ArrayRCP<const Scalar> getData (
size_t j)
const;
1151 Teuchos::ArrayRCP<Scalar> getDataNonConst (
size_t j);
1161 get1dCopy (
const Teuchos::ArrayView<Scalar>& A,
1162 const size_t LDA)
const;
1171 get2dCopy (
const Teuchos::ArrayView<
const Teuchos::ArrayView<Scalar> >& ArrayOfPtrs)
const;
1178 Teuchos::ArrayRCP<const Scalar> get1dView ()
const;
1181 Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> > get2dView ()
const;
1188 Teuchos::ArrayRCP<Scalar> get1dViewNonConst ();
1191 Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> > get2dViewNonConst ();
1201 KokkosClassic::MultiVector<Scalar, Node> getLocalMV ()
const;
1214 dual_view_type getDualView ()
const;
1234 template<
class TargetDeviceType>
1236 getDualView ().template sync<TargetDeviceType> ();
1244 template<
class TargetDeviceType>
1246 getDualView ().template modify<TargetDeviceType> ();
1280 template<
class TargetDeviceType>
1281 typename Kokkos::Impl::if_c<
1283 typename device_type::memory_space,
1284 typename TargetDeviceType::memory_space>::value,
1285 typename dual_view_type::t_dev,
1286 typename dual_view_type::t_host>::type
1288 return getDualView ().template view<TargetDeviceType> ();
1310 const Teuchos::ArrayView<dot_type>& dots)
const;
1323 template <
typename T>
1324 typename std::enable_if< ! (std::is_same<dot_type, T>::value),
void >::type
1326 const Teuchos::ArrayView<T> &dots)
const 1328 const size_t sz =
static_cast<size_t> (dots.size ());
1329 Teuchos::Array<dot_type> dts (sz);
1331 for (
size_t i = 0; i < sz; ++i) {
1338 template <
typename T>
1339 typename std::enable_if< ! (std::is_same<dot_type, T>::value),
void >::type
1341 std::vector<T>& dots)
const 1343 const size_t sz = dots.size ();
1344 Teuchos::Array<dot_type> dts (sz);
1346 for (
size_t i = 0; i < sz; ++i) {
1371 const Kokkos::View<dot_type*, device_type>& dots)
const;
1385 template <
typename T>
1386 typename std::enable_if< ! (std::is_same<dot_type, T>::value),
void >::type
1388 const Kokkos::View<T*, device_type>& dots)
const 1390 const size_t numDots = dots.dimension_0 ();
1391 Kokkos::View<dot_type*, device_type> dts (
"MV::dot tmp", numDots);
1416 void scale (
const Scalar& alpha);
1426 void scale (
const Teuchos::ArrayView<const Scalar>& alpha);
1436 void scale (
const Kokkos::View<const impl_scalar_type*, device_type>& alpha);
1447 scale (
const Scalar& alpha,
1457 update (
const Scalar& alpha,
1459 const Scalar& beta);
1468 update (
const Scalar& alpha,
1472 const Scalar& gamma);
1485 void norm1 (
const Kokkos::View<mag_type*, device_type>& norms)
const;
1500 template <
typename T>
1501 typename std::enable_if< ! (std::is_same<mag_type, T>::value),
void >::type
1502 norm1 (
const Kokkos::View<T*, device_type>& norms)
const 1504 const size_t numNorms = norms.dimension_0 ();
1505 Kokkos::View<mag_type*, device_type> tmpNorms (
"MV::norm1 tmp", numNorms);
1507 this->norm1 (tmpNorms);
1522 void norm1 (
const Teuchos::ArrayView<mag_type>& norms)
const;
1536 template <
typename T>
1537 typename std::enable_if< ! (std::is_same<mag_type,T>::value),
void >::type
1538 norm1 (
const Teuchos::ArrayView<T>& norms)
const 1540 typedef typename Teuchos::ArrayView<T>::size_type size_type;
1541 const size_type sz = norms.size ();
1542 Teuchos::Array<mag_type> theNorms (sz);
1543 this->norm1 (theNorms);
1544 for (size_type i = 0; i < sz; ++i) {
1546 norms[i] = theNorms[i];
1562 void norm2 (
const Kokkos::View<mag_type*, device_type>& norms)
const;
1575 template<
typename T>
1576 typename std::enable_if< ! (std::is_same<mag_type, T>::value),
void >::type
1577 norm2 (
const Kokkos::View<T*, device_type>& norms)
const 1579 const size_t numNorms = norms.dimension_0 ();
1580 Kokkos::View<mag_type*, device_type> theNorms (
"MV::norm2 tmp", numNorms);
1582 this->norm2 (theNorms);
1597 void norm2 (
const Teuchos::ArrayView<mag_type>& norms)
const;
1611 template <
typename T>
1612 typename std::enable_if< ! (std::is_same<mag_type,T>::value),
void >::type
1613 norm2 (
const Teuchos::ArrayView<T>& norms)
const 1615 typedef typename Teuchos::ArrayView<T>::size_type size_type;
1616 const size_type sz = norms.size ();
1617 Teuchos::Array<mag_type> theNorms (sz);
1618 this->norm2 (theNorms);
1619 for (size_type i = 0; i < sz; ++i) {
1621 norms[i] = theNorms[i];
1631 void normInf (
const Kokkos::View<mag_type*, device_type>& norms)
const;
1644 template<
typename T>
1645 typename std::enable_if< ! (std::is_same<mag_type, T>::value),
void >::type
1646 normInf (
const Kokkos::View<T*, device_type>& norms)
const 1648 const size_t numNorms = norms.dimension_0 ();
1649 Kokkos::View<mag_type*, device_type> theNorms (
"MV::normInf tmp", numNorms);
1651 this->normInf (theNorms);
1665 void normInf (
const Teuchos::ArrayView<mag_type>& norms)
const;
1679 template <
typename T>
1680 typename std::enable_if< ! (std::is_same<mag_type,T>::value),
void >::type
1681 normInf (
const Teuchos::ArrayView<T>& norms)
const 1683 typedef typename Teuchos::ArrayView<T>::size_type size_type;
1684 const size_type sz = norms.size ();
1685 Teuchos::Array<mag_type> theNorms (sz);
1686 this->norm2 (theNorms);
1687 for (size_type i = 0; i < sz; ++i) {
1689 norms[i] = theNorms[i];
1697 const Teuchos::ArrayView<mag_type>& norms)
const;
1713 template <
typename T>
1714 typename std::enable_if< ! (std::is_same<mag_type,T>::value),
void >::type
1716 const Teuchos::ArrayView<T>& norms)
const 1718 typedef typename Teuchos::ArrayView<T>::size_type size_type;
1719 const size_type sz = norms.size ();
1720 Teuchos::Array<mag_type> theNorms (sz);
1721 this->normWeighted (weights, theNorms);
1722 for (size_type i = 0; i < sz; ++i) {
1724 norms[i] = theNorms[i];
1732 void meanValue (
const Teuchos::ArrayView<impl_scalar_type>& means)
const;
1734 template <
typename T>
1735 typename std::enable_if<! std::is_same<impl_scalar_type, T>::value,
void>::type
1736 meanValue (
const Teuchos::ArrayView<T>& means)
const 1738 typedef typename Teuchos::Array<T>::size_type size_type;
1739 const size_type numMeans = means.size ();
1741 Teuchos::Array<impl_scalar_type> theMeans (numMeans);
1742 this->meanValue (theMeans ());
1743 for (size_type k = 0; k < numMeans; ++k) {
1744 means[k] =
static_cast<T
> (theMeans[k]);
1754 multiply (Teuchos::ETransp transA,
1755 Teuchos::ETransp transB,
1756 const Scalar& alpha,
1759 const Scalar& beta);
1782 elementWiseMultiply (Scalar scalarAB,
1791 size_t getNumVectors()
const;
1794 size_t getLocalLength()
const;
1804 size_t getStride()
const;
1809 bool isConstantStride()
const;
1817 virtual std::string description()
const;
1848 describe (Teuchos::FancyOStream& out,
1849 const Teuchos::EVerbosityLevel verbLevel =
1850 Teuchos::Describable::verbLevel_default)
const;
1880 TEUCHOS_TEST_FOR_EXCEPTION(
1881 copyOrView == Teuchos::Copy, std::invalid_argument,
1882 "Tpetra::MultiVector::setCopyOrView: The Kokkos refactor version of " 1883 "MultiVector _only_ implements view semantics. You may not call this " 1884 "method with copyOrView = Teuchos::Copy. The only valid argument is " 1899 return Teuchos::View;
1920 template <
class DS,
class DL,
class DG,
class DN,
const bool dstClassic,
1921 class SS,
class SL,
class SG,
class SN,
const bool srcClassic>
1997 normImpl (
const Kokkos::View<mag_type*, device_type>& norms,
2005 bool vectorIndexOutOfRange (
const size_t VectorIndex)
const;
2012 Teuchos::ArrayRCP<T>
2013 getSubArrayRCP (Teuchos::ArrayRCP<T> arr,
size_t j)
const;
2016 size_t getOrigNumLocalRows ()
const;
2019 size_t getOrigNumLocalCols ()
const;
2033 virtual size_t constantNumberOfPackets ()
const;
2042 const Kokkos::View<const local_ordinal_type*, execution_space>& permuteToLIDs,
2043 const Kokkos::View<const local_ordinal_type*, execution_space>& permuteFromLIDs);
2048 const Kokkos::View<const local_ordinal_type*, execution_space>& exportLIDs,
2049 Kokkos::View<impl_scalar_type*, execution_space>& exports,
2050 const Kokkos::View<size_t*, execution_space>& numPacketsPerLID,
2051 size_t& constantNumPackets,
2055 unpackAndCombineNew (
2056 const Kokkos::View<const LocalOrdinal*, execution_space>& importLIDs,
2057 const Kokkos::View<const impl_scalar_type*, execution_space>& imports,
2058 const Kokkos::View<size_t*, execution_space>& numPacketsPerLID,
2059 size_t constantNumPackets,
2063 void createViews ()
const;
2064 void createViewsNonConst (KokkosClassic::ReadWriteOption rwo);
2065 void releaseViews ()
const;
2068 typename dual_view_type::t_dev getKokkosView()
const {
return view_.d_view; }
2074 template<
class DstMultiVectorType,
2075 class SrcMultiVectorType>
2076 Teuchos::RCP<typename MultiVectorCloner<DstMultiVectorType, SrcMultiVectorType>::dst_mv_type>
2077 MultiVectorCloner<DstMultiVectorType, SrcMultiVectorType>::
2078 clone (
const src_mv_type& X,
2079 const Teuchos::RCP<typename dst_mv_type::node_type>& node2)
2081 typedef typename src_mv_type::map_type src_map_type;
2082 typedef typename dst_mv_type::map_type dst_map_type;
2083 typedef typename dst_mv_type::node_type dst_node_type;
2084 typedef typename dst_mv_type::dual_view_type dst_dual_view_type;
2087 RCP<const src_map_type> map1 = X.getMap ();
2088 RCP<const dst_map_type> map2 = map1.is_null () ?
2089 Teuchos::null : map1->template clone<dst_node_type> (node2);
2091 const size_t lclNumRows = X.getLocalLength ();
2092 const size_t numCols = X.getNumVectors ();
2093 dst_dual_view_type Y_view (
"MV::dual_view", lclNumRows, numCols);
2095 RCP<dst_mv_type> Y (
new dst_mv_type (map2, Y_view));
2105 template <
class ST,
class LO,
class GO,
class NT, const
bool classic>
2117 template <
class DS,
class DL,
class DG,
class DN,
const bool dstClassic,
2118 class SS,
class SL,
class SG,
class SN,
const bool srcClassic>
2123 typedef typename DN::device_type DD;
2126 TEUCHOS_TEST_FOR_EXCEPTION(
2129 "Tpetra::deep_copy: Global dimensions of the two Tpetra::MultiVector " 2130 "objects do not match. src has dimensions [" << src.
getGlobalLength ()
2131 <<
"," << src.
getNumVectors () <<
"], and dst has dimensions [" 2135 TEUCHOS_TEST_FOR_EXCEPTION(
2137 "Tpetra::deep_copy: The local row counts of the two Tpetra::MultiVector " 2138 "objects do not match. src has " << src.
getLocalLength () <<
" row(s) " 2147 dst.template modify<DES> ();
2149 Details::localDeepCopyConstStride (dst.
getDualView ().d_view,
2151 dst.template sync<HES> ();
2154 dst.template modify<HES> ();
2156 Details::localDeepCopyConstStride (dst.
getDualView ().h_view,
2158 dst.template sync<DES> ();
2162 typedef Kokkos::DualView<SL*, DD> whichvecs_type;
2163 typedef typename whichvecs_type::t_dev::execution_space DES;
2164 typedef typename whichvecs_type::t_host::execution_space HES;
2167 const SL numWhichVecs =
static_cast<SL
> (src.
whichVectors_.size ());
2168 const std::string whichVecsLabel (
"MV::deep_copy::whichVecs");
2178 whichvecs_type whichVecs (whichVecsLabel, numWhichVecs);
2179 whichVecs.template modify<HES> ();
2180 for (SL i = 0; i < numWhichVecs; ++i) {
2181 whichVecs.h_view(i) =
static_cast<SL
> (src.
whichVectors_[i]);
2184 whichVecs.template sync<DES> ();
2187 dst.template modify<DES> ();
2189 Details::localDeepCopy (dst.
getDualView ().d_view,
2197 dst.template sync<HES> ();
2204 typedef Kokkos::View<SL*, HES> the_whichvecs_type;
2205 the_whichvecs_type whichVecs (whichVecsLabel, numWhichVecs);
2206 for (SL i = 0; i < numWhichVecs; ++i) {
2212 Details::localDeepCopy (dst.
getDualView ().h_view,
2216 whichVecs, whichVecs);
2218 dst.template sync<DES> ();
2228 typedef Kokkos::DualView<DL*, DES> the_whichvecs_type;
2229 const std::string whichVecsLabel (
"MV::deep_copy::whichVecs");
2230 const DL numWhichVecs =
static_cast<DL
> (dst.
whichVectors_.size ());
2231 the_whichvecs_type whichVecs (whichVecsLabel, numWhichVecs);
2232 whichVecs.template modify<HES> ();
2233 for (DL i = 0; i < numWhichVecs; ++i) {
2237 whichVecs.template sync<DES> ();
2240 Details::localDeepCopy (dst.
getDualView ().d_view,
2251 dst.template sync<HES> ();
2258 typedef Kokkos::View<DL*, HES> the_whichvecs_type;
2259 const DL numWhichVecs =
static_cast<DL
> (dst.
whichVectors_.size ());
2260 the_whichvecs_type whichVecs (
"MV::deep_copy::whichVecs", numWhichVecs);
2261 for (DL i = 0; i < numWhichVecs; ++i) {
2265 Details::localDeepCopy (dst.
getDualView ().h_view,
2269 whichVecs, whichVecs);
2274 dst.template sync<DES> ();
2284 const DL dstNumWhichVecs =
static_cast<DL
> (dst.
whichVectors_.size ());
2285 Kokkos::DualView<DL*, DES> whichVecsDst (
"MV::deep_copy::whichVecsDst",
2287 whichVecsDst.template modify<HES> ();
2288 for (DL i = 0; i < dstNumWhichVecs; ++i) {
2289 whichVecsDst.h_view(i) =
static_cast<DL
> (dst.
whichVectors_[i]);
2292 whichVecsDst.template sync<DES> ();
2298 const DL srcNumWhichVecs =
static_cast<DL
> (src.
whichVectors_.size ());
2299 Kokkos::DualView<DL*, DES> whichVecsSrc (
"MV::deep_copy::whichVecsSrc",
2301 whichVecsSrc.template modify<HES> ();
2302 for (DL i = 0; i < srcNumWhichVecs; ++i) {
2303 whichVecsSrc.h_view(i) =
static_cast<DL
> (src.
whichVectors_[i]);
2306 whichVecsSrc.template sync<DES> ();
2310 Details::localDeepCopy (dst.
getDualView ().d_view,
2314 whichVecsDst.d_view,
2315 whichVecsSrc.d_view);
2318 const DL dstNumWhichVecs =
static_cast<DL
> (dst.
whichVectors_.size ());
2319 Kokkos::View<DL*, HES> whichVectorsDst (
"dstWhichVecs", dstNumWhichVecs);
2320 for (DL i = 0; i < dstNumWhichVecs; ++i) {
2325 const DL srcNumWhichVecs =
static_cast<DL
> (src.
whichVectors_.size ());
2326 Kokkos::View<DL*, HES> whichVectorsSrc (
"srcWhichVecs", srcNumWhichVecs);
2327 for (DL i = 0; i < srcNumWhichVecs; ++i) {
2333 Details::localDeepCopy (dst.
getDualView ().h_view,
2337 whichVectorsDst, whichVectorsSrc);
2343 dst.template sync<HES> ();
2357 template<
class SC,
class LO,
class GO,
class NT, const
bool classic>
2358 class TypeNameTraits<Tpetra::
MultiVector<SC, LO, GO, NT, classic> > {
2360 static std::string name () {
2361 return std::string (
"Tpetra::MultiVector<") +
2362 TypeNameTraits<SC>::name () +
"," +
2363 TypeNameTraits<LO>::name () +
"," +
2364 TypeNameTraits<GO>::name () +
"," +
2365 TypeNameTraits<NT>::name () +
">";
2375 #endif // TPETRA_MULTIVECTOR_DECL_HPP size_t getLocalLength() const
Local number of rows on the calling process.
Node node_type
This class' fourth template parameter; the Kokkos Node type.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
void sync()
Update data on device or host only if data in the other space has been marked as modified.
MultiVector< ST, LO, GO, NT, classic > createCopy(const MultiVector< ST, LO, GO, NT, classic > &src)
Return a deep copy of the given MultiVector.
KokkosClassic::DefaultNode::DefaultNodeType node_type
Default value of Node template parameter.
void setCopyOrView(const Teuchos::DataAccess copyOrView)
Set whether this has copy (copyOrView = Teuchos::Copy) or view (copyOrView = Teuchos::View) semantics...
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type replaceGlobalValue(GlobalOrdinal globalRow, size_t col, const T &value)
Like the above replaceGlobalValue, but only enabled if T differs from impl_scalar_type.
Teuchos::Array< size_t > whichVectors_
Indices of columns this multivector is viewing.
One or more distributed dense vectors.
void deep_copy(MultiVector< ST, LO, GO, NT, classic > &dst, const MultiVector< ST, LO, GO, NT, classic > &src)
Specialization of deep_copy for MultiVector objects with the same template parameters.
void deep_copy(MultiVector< DS, DL, DG, DN, dstClassic > &dst, const MultiVector< SS, SL, SG, SN, srcClassic > &src)
Copy the contents of the MultiVector src into dst.
Node::device_type device_type
The Kokkos device type.
void removeEmptyProcessesInPlace(Teuchos::RCP< DistObjectType > &input, const Teuchos::RCP< const Map< typename DistObjectType::local_ordinal_type, typename DistObjectType::global_ordinal_type, typename DistObjectType::node_type > > &newMap)
Remove processes which contain no elements in this object's Map.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The type of the Map specialization used by this class.
bool isConstantStride() const
Whether this multivector has constant stride between columns.
dual_view_type view_
The Kokkos::DualView containing the MultiVector's data.
Kokkos::Details::InnerProductSpaceTraits< impl_scalar_type >::dot_type dot_type
Type of an inner ("dot") product result.
int local_ordinal_type
Default value of LocalOrdinal template parameter.
virtual bool useNewInterface()
Whether this class implements the old or new interface of DistObject.
Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node, classic > > createMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const size_t numVectors)
Nonmember MultiVector "constructor": Create a MultiVector from a given Map.
void modify()
Mark data as modified on the given device TargetDeviceType.
Implementation details of Tpetra.
size_t global_size_t
Global size_t object.
Declarations for the Tpetra::Map class and related nonmember constructors.
Scalar scalar_type
This class' first template parameter; the type of each entry in the MultiVector.
dual_view_type getDualView() const
Get the Kokkos::DualView which implements local storage.
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type sumIntoGlobalValue(GlobalOrdinal globalRow, size_t col, const T &value)
Like the above sumIntoGlobalValue, but only enabled if T differs from impl_scalar_type.
Node::execution_space execution_space
Type of the (new) Kokkos execution space.
Sets up and executes a communication plan for a Tpetra DistObject.
CombineMode
Rule for combining data in an Import or Export.
Abstract base class for objects that can be the source of an Import or Export operation.
double scalar_type
Default value of Scalar template parameter.
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type replaceLocalValue(LocalOrdinal localRow, size_t col, const T &value)
Like the above replaceLocalValue, but only enabled if T differs from impl_scalar_type.
Teuchos::DataAccess getCopyOrView() const
Get whether this has copy (copyOrView = Teuchos::Copy) or view (copyOrView = Teuchos::View) semantics...
global_size_t getGlobalLength() const
Global number of rows in the multivector.
Kokkos::Details::ArithTraits< Scalar >::val_type impl_scalar_type
The type used internally in place of Scalar.
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type sumIntoLocalValue(LocalOrdinal localRow, size_t col, const T &value)
Like the above sumIntoLocalValue, but only enabled if T differs from impl_scalar_type.
Implementation of Tpetra::MultiVector::clone().
Kokkos::Details::ArithTraits< impl_scalar_type >::mag_type mag_type
Type of a norm result.
Kokkos::DualView< impl_scalar_type **, Kokkos::LayoutLeft, typename execution_space::execution_space > dual_view_type
Kokkos::DualView specialization used by this class.
Describes a parallel distribution of objects over processes.
A distributed dense vector.
void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node, classic > &src)
Copy the contents of src into *this (deep copy).
LocalOrdinal local_ordinal_type
This class' second template parameter; the type of local indices.
size_t getNumVectors() const
Number of columns in the multivector.
Kokkos::Impl::if_c< std::is_same< typename device_type::memory_space, typename TargetDeviceType::memory_space >::value, typename dual_view_type::t_dev, typename dual_view_type::t_host >::type getLocalView() const
Return a view of the local data on a specific device.
EWhichNorm
Input argument for normImpl() (which see).
Base class for distributed Tpetra objects that support data redistribution.
GlobalOrdinal global_ordinal_type
This class' third template parameter; the type of global indices.
dual_view_type origView_
The "original view" of the MultiVector's data.