Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_CrsGraph_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10// clang-format off
11#ifndef TPETRA_CRSGRAPH_DECL_HPP
12#define TPETRA_CRSGRAPH_DECL_HPP
13
16
20#include "Tpetra_DistObject.hpp"
21#include "Tpetra_Exceptions.hpp"
22#include "Tpetra_RowGraph.hpp"
23#include "Tpetra_Util.hpp" // need this here for sort2
24#include "Tpetra_Details_WrappedDualView.hpp"
25
26#include "KokkosSparse_findRelOffset.hpp"
27#include "Kokkos_DualView.hpp"
28#include "Kokkos_StaticCrsGraph.hpp"
29
30#include "Teuchos_CommHelpers.hpp"
31#include "Teuchos_Describable.hpp"
32#include "Teuchos_OrdinalTraits.hpp"
33#include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
34
35#include <functional> // std::function
36#include <memory>
37
38namespace Tpetra {
39
40
41 // Forward declaration for CrsGraph::swap() test
42 template<class LocalOrdinal, class GlobalOrdinal, class Node> class crsGraph_Swap_Tester;
43
44#ifndef DOXYGEN_SHOULD_SKIP_THIS
45 namespace Details {
46 template<class LocalOrdinal,
47 class GlobalOrdinal>
48 class CrsPadding;
49 } // namespace Details
50
51 namespace { // (anonymous)
52
53 template<class ViewType>
54 struct UnmanagedView {
55 static_assert (Kokkos::is_view<ViewType>::value,
56 "ViewType must be a Kokkos::View specialization.");
57 // FIXME (mfh 02 Dec 2015) Right now, this strips away other
58 // memory traits. Christian will add an "AllTraits" enum which is
59 // the enum value of MemoryTraits<T>, that will help us fix this.
60 typedef Kokkos::View<typename ViewType::data_type,
61 typename ViewType::array_layout,
62 typename ViewType::device_type,
63 Kokkos::MemoryUnmanaged> type;
64 };
65
66 } // namespace (anonymous)
67#endif // DOXYGEN_SHOULD_SKIP_THIS
68
77 struct RowInfo {
78 size_t localRow;
79 size_t allocSize;
80 size_t numEntries;
81 size_t offset1D;
82 };
83
84 enum ELocalGlobal {
85 LocalIndices,
86 GlobalIndices
87 };
88
89 namespace Details {
121 STORAGE_1D_UNPACKED, //<! 1-D "unpacked" storage
122 STORAGE_1D_PACKED, //<! 1-D "packed" storage
123 STORAGE_UB //<! Invalid value; upper bound on enum values
124 };
125
126 } // namespace Details
127
186 template <class LocalOrdinal,
187 class GlobalOrdinal,
188 class Node>
189 class CrsGraph :
190 public RowGraph<LocalOrdinal, GlobalOrdinal, Node>,
191 public DistObject<GlobalOrdinal,
192 LocalOrdinal,
193 GlobalOrdinal,
194 Node>,
195 public Teuchos::ParameterListAcceptorDefaultBase
196 {
197 template <class S, class LO, class GO, class N>
198 friend class CrsMatrix;
199 template <class LO2, class GO2, class N2>
200 friend class CrsGraph;
201 template <class LO, class GO, class N>
202 friend class FECrsGraph;
203
206
207 public:
209 using local_ordinal_type = LocalOrdinal;
211 using global_ordinal_type = GlobalOrdinal;
213 using device_type = typename Node::device_type;
215 using execution_space = typename device_type::execution_space;
216
221 using node_type = Node;
222
225 Kokkos::StaticCrsGraph<local_ordinal_type, Kokkos::LayoutLeft,
226 device_type, void, size_t>;
227
229 using local_graph_host_type = typename local_graph_device_type::HostMirror;
230
237
238public:
239 // Types used for CrsGraph's storage of local column indices
240 using local_inds_dualv_type =
241 Kokkos::DualView<local_ordinal_type*, device_type>;
242 using local_inds_wdv_type =
244
245 // Types used for CrsGraph's storage of global column indices
246 using global_inds_dualv_type =
247 Kokkos::DualView<global_ordinal_type*, device_type>;
248 using global_inds_wdv_type =
250
251public:
252 using row_graph_type = RowGraph<LocalOrdinal, GlobalOrdinal, Node>;
253 using row_ptrs_device_view_type =
254 typename row_graph_type::row_ptrs_device_view_type;
255 using row_ptrs_host_view_type =
256 typename row_graph_type::row_ptrs_host_view_type;
257
260 typename row_graph_type::local_inds_device_view_type;
261 using local_inds_host_view_type =
262 typename row_graph_type::local_inds_host_view_type;
263 using nonconst_local_inds_host_view_type =
264 typename row_graph_type::nonconst_local_inds_host_view_type;
265
268 typename row_graph_type::global_inds_device_view_type;
269 using global_inds_host_view_type =
270 typename row_graph_type::global_inds_host_view_type;
271 using nonconst_global_inds_host_view_type =
272 typename row_graph_type::nonconst_global_inds_host_view_type;
273
274 using offset_device_view_type =
275 typename row_ptrs_device_view_type::non_const_type;
276
278
279
292 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
293 const size_t maxNumEntriesPerRow,
294 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
295
308 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
309 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
310 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
311
325 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
326 const Teuchos::ArrayView<const size_t>& numEntPerRow,
327 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
328
329
342
346 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
347 const Teuchos::RCP<const map_type>& colMap,
348 const size_t maxNumEntriesPerRow,
349 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
350
365 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
366 const Teuchos::RCP<const map_type>& colMap,
367 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
368 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
369
385 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
386 const Teuchos::RCP<const map_type>& colMap,
387 const Teuchos::ArrayView<const size_t>& numEntPerRow,
388 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
389
390
402 CrsGraph (CrsGraph<local_ordinal_type, global_ordinal_type, node_type>& originalGraph,
403 const Teuchos::RCP<const map_type>& rowMap,
404 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
405
428 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
429 const Teuchos::RCP<const map_type>& colMap,
430 const typename local_graph_device_type::row_map_type& rowPointers,
431 const typename local_graph_device_type::entries_type::non_const_type& columnIndices,
432 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
433
456 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
457 const Teuchos::RCP<const map_type>& colMap,
458 const Teuchos::ArrayRCP<size_t>& rowPointers,
459 const Teuchos::ArrayRCP<local_ordinal_type>& columnIndices,
460 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
461
483 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
484 const Teuchos::RCP<const map_type>& colMap,
485 const local_graph_device_type& lclGraph,
486 const Teuchos::RCP<Teuchos::ParameterList>& params);
487
515 const Teuchos::RCP<const map_type>& rowMap,
516 const Teuchos::RCP<const map_type>& colMap,
517 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
518 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
519 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
520
526 const Teuchos::RCP<const map_type>& rowMap,
527 const Teuchos::RCP<const map_type>& colMap,
528 const Teuchos::RCP<const map_type>& domainMap,
529 const Teuchos::RCP<const map_type>& rangeMap,
530 const Teuchos::RCP<const import_type>& importer,
531 const Teuchos::RCP<const export_type>& exporter,
532 const Teuchos::RCP<Teuchos::ParameterList>& params =
533 Teuchos::null);
534
576 CrsGraph (const row_ptrs_device_view_type& rowPointers,
577 const local_inds_wdv_type& columnIndices,
578 const Teuchos::RCP<const map_type>& rowMap,
579 const Teuchos::RCP<const map_type>& colMap,
580 const Teuchos::RCP<const map_type>& domainMap,
581 const Teuchos::RCP<const map_type>& rangeMap,
582 const Teuchos::RCP<const import_type>& importer,
583 const Teuchos::RCP<const export_type>& exporter,
584 const Teuchos::RCP<Teuchos::ParameterList>& params =
585 Teuchos::null);
586
588 CrsGraph (const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&) = default;
589
591 CrsGraph& operator= (const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&) = default;
592
594 CrsGraph (CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&&) = default;
595
597 CrsGraph& operator= (CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&&) = default;
598
608 virtual ~CrsGraph () = default;
609
637
654 bool isIdenticalTo(const CrsGraph<LocalOrdinal, GlobalOrdinal, Node> &graph) const;
655
657
659
661 void
662 setParameterList (const Teuchos::RCP<Teuchos::ParameterList>& params) override;
663
665 Teuchos::RCP<const Teuchos::ParameterList>
666 getValidParameters () const override;
667
669
671
693 void
695 const Teuchos::ArrayView<const global_ordinal_type>& indices);
696
703 void
705 const local_ordinal_type numEnt,
706 const global_ordinal_type inds[]);
707
709
723 void
725 const Teuchos::ArrayView<const local_ordinal_type>& indices);
726
733 void
735 const local_ordinal_type numEnt,
736 const local_ordinal_type inds[]);
737
739
749
751
753
762
781 void
782 resumeFill (const Teuchos::RCP<Teuchos::ParameterList>& params =
783 Teuchos::null);
784
822 void
823 fillComplete (const Teuchos::RCP<const map_type>& domainMap,
824 const Teuchos::RCP<const map_type>& rangeMap,
825 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
826
854 void
855 fillComplete (const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
856
885 void
886 expertStaticFillComplete (const Teuchos::RCP<const map_type>& domainMap,
887 const Teuchos::RCP<const map_type>& rangeMap,
888 const Teuchos::RCP<const import_type>& importer =
889 Teuchos::null,
890 const Teuchos::RCP<const export_type>& exporter =
891 Teuchos::null,
892 const Teuchos::RCP<Teuchos::ParameterList>& params =
893 Teuchos::null);
895
897
899 Teuchos::RCP<const Teuchos::Comm<int> > getComm() const override;
900
901
903 Teuchos::RCP<const map_type> getRowMap () const override;
904
906 Teuchos::RCP<const map_type> getColMap () const override;
907
909 Teuchos::RCP<const map_type> getDomainMap () const override;
910
912 Teuchos::RCP<const map_type> getRangeMap () const override;
913
915 Teuchos::RCP<const import_type> getImporter () const override;
916
918 Teuchos::RCP<const export_type> getExporter () const override;
919
921
924
926
930
932 size_t getLocalNumRows () const override;
933
935
937 size_t getLocalNumCols () const override;
938
941
943
946
956 size_t getLocalNumEntries() const override;
957
959
960 size_t
962
969 size_t
971
991 size_t getLocalAllocationSize () const;
992
1001
1010
1024 size_t getGlobalMaxNumRowEntries () const override;
1025
1030 size_t getLocalMaxNumRowEntries () const override;
1031
1047 bool hasColMap () const override;
1048
1049
1057 bool isLocallyIndexed () const override;
1058
1066 bool isGloballyIndexed () const override;
1067
1069 bool isFillComplete () const override;
1070
1072 bool isFillActive () const;
1073
1081 bool isSorted () const;
1082
1084
1090 bool isStorageOptimized () const;
1091
1092
1098 void
1100 nonconst_global_inds_host_view_type &gblColInds,
1101 size_t& numColInds) const override;
1102
1110 void
1112 nonconst_local_inds_host_view_type &gblColInds,
1113 size_t& numColInds) const override;
1114
1125 void
1127 const global_ordinal_type gblRow,
1128 global_inds_host_view_type &gblColInds) const override;
1129
1130
1133 bool supportsRowViews () const override;
1134
1135
1146 void
1148 const LocalOrdinal lclRow,
1149 local_inds_host_view_type &lclColInds) const override;
1150
1151
1153
1155
1157 std::string description () const override;
1158
1161 void
1162 describe (Teuchos::FancyOStream& out,
1163 const Teuchos::EVerbosityLevel verbLevel =
1164 Teuchos::Describable::verbLevel_default) const override;
1165
1167
1169
1177
1178 virtual bool
1179 checkSizes (const SrcDistObject& source) override;
1180
1181 // clang-format on
1182 using dist_object_type::
1183 copyAndPermute;
1185 // clang-format off
1186
1187 virtual void
1189 (const SrcDistObject& source,
1190 const size_t numSameIDs,
1191 const Kokkos::DualView<const local_ordinal_type*,
1192 buffer_device_type>& permuteToLIDs,
1193 const Kokkos::DualView<const local_ordinal_type*,
1194 buffer_device_type>& permuteFromLIDs,
1195 const CombineMode CM) override;
1196
1197 using padding_type = Details::CrsPadding<
1199
1200 void
1201 applyCrsPadding(const padding_type& padding,
1202 const bool verbose);
1203
1204 std::unique_ptr<padding_type>
1205 computeCrsPadding(
1207 node_type>& source,
1208 const size_t numSameIDs,
1209 const Kokkos::DualView<const local_ordinal_type*,
1210 buffer_device_type>& permuteToLIDs,
1211 const Kokkos::DualView<const local_ordinal_type*,
1212 buffer_device_type>& permuteFromLIDs,
1213 const bool verbose) const;
1214
1215 // This actually modifies imports by sorting it.
1216 std::unique_ptr<padding_type>
1217 computeCrsPaddingForImports(
1218 const Kokkos::DualView<const local_ordinal_type*,
1219 buffer_device_type>& importLIDs,
1220 Kokkos::DualView<packet_type*, buffer_device_type> imports,
1221 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1222 const bool verbose) const;
1223
1224 std::unique_ptr<padding_type>
1225 computePaddingForCrsMatrixUnpack(
1226 const Kokkos::DualView<const local_ordinal_type*,
1227 buffer_device_type>& importLIDs,
1228 Kokkos::DualView<char*, buffer_device_type> imports,
1229 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1230 const bool verbose) const;
1231
1232 void
1233 computeCrsPaddingForSameIDs(
1234 padding_type& padding,
1236 node_type>& source,
1237 const local_ordinal_type numSameIDs) const;
1238
1239 void
1240 computeCrsPaddingForPermutedIDs(
1241 padding_type& padding,
1243 node_type>& source,
1244 const Kokkos::DualView<const local_ordinal_type*,
1245 buffer_device_type>& permuteToLIDs,
1246 const Kokkos::DualView<const local_ordinal_type*,
1247 buffer_device_type>& permuteFromLIDs) const;
1248
1249 virtual void
1250 packAndPrepare(
1251 const SrcDistObject& source,
1252 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& exportLIDs,
1253 Kokkos::DualView<packet_type*, buffer_device_type>& exports,
1254 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1255 size_t& constantNumPackets) override;
1256
1257 // clang-format on
1262 // clang-format off
1263
1264 virtual void
1265 pack (const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1266 Teuchos::Array<global_ordinal_type>& exports,
1267 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1268 size_t& constantNumPackets) const override;
1269
1270 void
1271 packFillActive (const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1272 Teuchos::Array<global_ordinal_type>& exports,
1273 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1274 size_t& constantNumPackets) const;
1275
1276 void
1277 packFillActiveNew (const Kokkos::DualView<const local_ordinal_type*,
1278 buffer_device_type>& exportLIDs,
1279 Kokkos::DualView<packet_type*,
1280 buffer_device_type>& exports,
1281 Kokkos::DualView<size_t*,
1282 buffer_device_type> numPacketsPerLID,
1283 size_t& constantNumPackets) const;
1284
1285 // clang-format on
1290 // clang-format off
1291
1292 virtual void
1294 (const Kokkos::DualView<const local_ordinal_type*,
1295 buffer_device_type>& importLIDs,
1296 Kokkos::DualView<packet_type*,
1297 buffer_device_type> imports,
1298 Kokkos::DualView<size_t*,
1299 buffer_device_type> numPacketsPerLID,
1300 const size_t constantNumPackets,
1301 const CombineMode combineMode) override;
1302
1304
1306
1349 void
1350 getLocalDiagOffsets (const Kokkos::View<size_t*, device_type, Kokkos::MemoryUnmanaged>& offsets) const;
1351
1353 void
1354 getLocalOffRankOffsets (offset_device_view_type& offsets) const;
1355
1365 void
1366 getLocalDiagOffsets (Teuchos::ArrayRCP<size_t>& offsets) const;
1367
1377 void
1378 setAllIndices (const typename local_graph_device_type::row_map_type& rowPointers,
1379 const typename local_graph_device_type::entries_type::non_const_type& columnIndices);
1380
1390 void
1391 setAllIndices (const Teuchos::ArrayRCP<size_t> & rowPointers,
1392 const Teuchos::ArrayRCP<local_ordinal_type> & columnIndices);
1393
1396 row_ptrs_host_view_type getLocalRowPtrsHost () const;
1397
1400 row_ptrs_device_view_type getLocalRowPtrsDevice () const;
1401
1403 local_inds_host_view_type getLocalIndicesHost () const;
1404
1407
1426 void replaceColMap (const Teuchos::RCP<const map_type>& newColMap);
1427
1447 void
1448 reindexColumns (const Teuchos::RCP<const map_type>& newColMap,
1449 const Teuchos::RCP<const import_type>& newImport = Teuchos::null,
1450 const bool sortIndicesInEachRow = true);
1451
1458 void
1459 replaceDomainMap (const Teuchos::RCP<const map_type>& newDomainMap);
1460
1474 void
1475 replaceDomainMapAndImporter (const Teuchos::RCP<const map_type>& newDomainMap,
1476 const Teuchos::RCP<const import_type>& newImporter);
1477
1484 void
1485 replaceRangeMap (const Teuchos::RCP<const map_type>& newRangeMap);
1486
1500 void
1501 replaceRangeMapAndExporter (const Teuchos::RCP<const map_type>& newRangeMap,
1502 const Teuchos::RCP<const export_type>& newExporter);
1503
1532 virtual void
1533 removeEmptyProcessesInPlace (const Teuchos::RCP<const map_type>& newMap) override;
1535
1536 template<class DestViewType, class SrcViewType,
1537 class DestOffsetViewType, class SrcOffsetViewType >
1538 struct pack_functor {
1539 typedef typename DestViewType::execution_space execution_space;
1540 SrcViewType src;
1541 DestViewType dest;
1542 SrcOffsetViewType src_offset;
1543 DestOffsetViewType dest_offset;
1544 typedef typename DestOffsetViewType::non_const_value_type ScalarIndx;
1545
1546 pack_functor(DestViewType dest_,
1547 const SrcViewType src_,
1548 DestOffsetViewType dest_offset_,
1549 const SrcOffsetViewType src_offset_):
1550 src(src_),dest(dest_),
1551 src_offset(src_offset_),dest_offset(dest_offset_) {};
1552
1553 KOKKOS_INLINE_FUNCTION
1554 void operator() (size_t row) const {
1555 ScalarIndx i = src_offset(row);
1556 ScalarIndx j = dest_offset(row);
1557 const ScalarIndx k = dest_offset(row+1);
1558 for(;j<k;j++,i++) {
1559 dest(j) = src(i);
1560 }
1561 }
1562 };
1563
1564 private:
1565 // Friend declaration for nonmember function.
1566 template<class CrsGraphType>
1567 friend Teuchos::RCP<CrsGraphType>
1568 importAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1569 const Import<typename CrsGraphType::local_ordinal_type,
1570 typename CrsGraphType::global_ordinal_type,
1571 typename CrsGraphType::node_type>& importer,
1572 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1573 typename CrsGraphType::global_ordinal_type,
1574 typename CrsGraphType::node_type> >& domainMap,
1575 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1576 typename CrsGraphType::global_ordinal_type,
1577 typename CrsGraphType::node_type> >& rangeMap,
1578 const Teuchos::RCP<Teuchos::ParameterList>& params);
1579
1580 // Friend declaration for nonmember function.
1581 template<class CrsGraphType>
1582 friend Teuchos::RCP<CrsGraphType>
1583 importAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1584 const Import<typename CrsGraphType::local_ordinal_type,
1585 typename CrsGraphType::global_ordinal_type,
1586 typename CrsGraphType::node_type>& rowImporter,
1587 const Import<typename CrsGraphType::local_ordinal_type,
1588 typename CrsGraphType::global_ordinal_type,
1589 typename CrsGraphType::node_type>& domainImporter,
1590 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1591 typename CrsGraphType::global_ordinal_type,
1592 typename CrsGraphType::node_type> >& domainMap,
1593 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1594 typename CrsGraphType::global_ordinal_type,
1595 typename CrsGraphType::node_type> >& rangeMap,
1596 const Teuchos::RCP<Teuchos::ParameterList>& params);
1597
1598
1599 // Friend declaration for nonmember function.
1600 template<class CrsGraphType>
1601 friend Teuchos::RCP<CrsGraphType>
1602 exportAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1603 const Export<typename CrsGraphType::local_ordinal_type,
1604 typename CrsGraphType::global_ordinal_type,
1605 typename CrsGraphType::node_type>& exporter,
1606 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1607 typename CrsGraphType::global_ordinal_type,
1608 typename CrsGraphType::node_type> >& domainMap,
1609 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1610 typename CrsGraphType::global_ordinal_type,
1611 typename CrsGraphType::node_type> >& rangeMap,
1612 const Teuchos::RCP<Teuchos::ParameterList>& params);
1613
1614 // Friend declaration for nonmember function.
1615 template<class CrsGraphType>
1616 friend Teuchos::RCP<CrsGraphType>
1617 exportAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1618 const Export<typename CrsGraphType::local_ordinal_type,
1619 typename CrsGraphType::global_ordinal_type,
1620 typename CrsGraphType::node_type>& rowExporter,
1621 const Export<typename CrsGraphType::local_ordinal_type,
1622 typename CrsGraphType::global_ordinal_type,
1623 typename CrsGraphType::node_type>& domainExporter,
1624 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1625 typename CrsGraphType::global_ordinal_type,
1626 typename CrsGraphType::node_type> >& domainMap,
1627 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1628 typename CrsGraphType::global_ordinal_type,
1629 typename CrsGraphType::node_type> >& rangeMap,
1630 const Teuchos::RCP<Teuchos::ParameterList>& params);
1631
1632 public:
1648 void
1649 importAndFillComplete (Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node> >& destGraph,
1650 const import_type& importer,
1651 const Teuchos::RCP<const map_type>& domainMap,
1652 const Teuchos::RCP<const map_type>& rangeMap,
1653 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1654
1670 void
1671 importAndFillComplete (Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node> >& destGraph,
1672 const import_type& rowImporter,
1673 const import_type& domainImporter,
1674 const Teuchos::RCP<const map_type>& domainMap,
1675 const Teuchos::RCP<const map_type>& rangeMap,
1676 const Teuchos::RCP<Teuchos::ParameterList>& params) const;
1677
1678
1694 void
1695 exportAndFillComplete (Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node> >& destGraph,
1696 const export_type& exporter,
1697 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1698 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1699 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1700
1716 void
1717 exportAndFillComplete (Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node> >& destGraph,
1718 const export_type& rowExporter,
1719 const export_type& domainExporter,
1720 const Teuchos::RCP<const map_type>& domainMap,
1721 const Teuchos::RCP<const map_type>& rangeMap,
1722 const Teuchos::RCP<Teuchos::ParameterList>& params) const;
1723
1724
1725 private:
1746 void
1747 transferAndFillComplete (Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node> >& destGraph,
1748 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, Node>& rowTransfer,
1749 const Teuchos::RCP<const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, Node> > & domainTransfer,
1750 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1751 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1752 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1753
1754 protected:
1755 // these structs are conveniences, to cut down on the number of
1756 // arguments to some of the methods below.
1757 struct SLocalGlobalViews {
1758 Teuchos::ArrayView<const global_ordinal_type> ginds;
1759 Teuchos::ArrayView<const local_ordinal_type> linds;
1760 };
1761 struct SLocalGlobalNCViews {
1762 Teuchos::ArrayView<global_ordinal_type> ginds;
1763 Teuchos::ArrayView<local_ordinal_type> linds;
1764 };
1765
1766 bool indicesAreAllocated () const;
1767
1768 void
1769 allocateIndices(const ELocalGlobal lg, const bool verbose=false);
1770
1772
1773
1783 void makeColMap (Teuchos::Array<int>& remotePIDs);
1784
1805 std::pair<size_t, std::string>
1806 makeIndicesLocal(const bool verbose=false);
1807
1816 void
1817 makeImportExport (Teuchos::Array<int>& remotePIDs,
1818 const bool useRemotePIDs);
1819
1821
1823
1858 size_t
1860 const SLocalGlobalViews& newInds,
1861 const ELocalGlobal lg,
1862 const ELocalGlobal I);
1863
1873 size_t
1875 const global_ordinal_type inputGblColInds[],
1876 const size_t numInputInds);
1877
1887 size_t
1889 const global_ordinal_type inputGblColInds[],
1890 const size_t numInputInds,
1891 std::function<void(const size_t, const size_t, const size_t)> fun =
1892 std::function<void(const size_t, const size_t, const size_t)>());
1893
1894 void
1895 insertLocalIndicesImpl (const local_ordinal_type lclRow,
1896 const Teuchos::ArrayView<const local_ordinal_type>& gblColInds,
1897 std::function<void(const size_t, const size_t, const size_t)> fun =
1898 std::function<void(const size_t, const size_t, const size_t)>());
1899
1915 size_t
1917 const Teuchos::ArrayView<const global_ordinal_type>& indices,
1918 std::function<void(const size_t, const size_t, const size_t)> fun) const;
1919
1931 void
1933 const global_ordinal_type gblColInds[],
1934 const local_ordinal_type numGblColInds);
1935
1947 void
1949 const global_ordinal_type gblColInds[],
1950 const local_ordinal_type numGblColInds);
1951
1956 static const bool useAtomicUpdatesByDefault =
1957#ifdef KOKKOS_ENABLE_SERIAL
1958 ! std::is_same<execution_space, Kokkos::Serial>::value;
1959#else
1960 true;
1961#endif // KOKKOS_ENABLE_SERIAL
1962
1964
1966
1968 bool isMerged () const;
1969
1976
1977 private:
1982 void
1983 sortAndMergeAllIndices (const bool sorted, const bool merged);
1984
1985 // mfh 08 May 2017: I only restore "protected" here for backwards
1986 // compatibility.
1987 protected:
1996 size_t sortAndMergeRowIndices (const RowInfo& rowInfo,
1997 const bool sorted,
1998 const bool merged);
2000
2010 void
2011 setDomainRangeMaps (const Teuchos::RCP<const map_type>& domainMap,
2012 const Teuchos::RCP<const map_type>& rangeMap);
2013
2014 void staticAssertions() const;
2015 void clearGlobalConstants();
2016
2017 public:
2020
2039
2040 bool haveLocalOffRankOffsets() const { return haveLocalOffRankOffsets_;}
2041
2042 protected:
2063
2067
2081
2082 public:
2083
2092 local_graph_host_type getLocalGraphHost () const;
2093
2094 protected:
2095
2096 void fillLocalGraph (const Teuchos::RCP<Teuchos::ParameterList>& params);
2097
2099 void checkInternalState () const;
2100
2104 void swap(CrsGraph<local_ordinal_type, global_ordinal_type, Node> & graph);
2105
2106 // Friend the tester for CrsGraph::swap
2107 friend class Tpetra::crsGraph_Swap_Tester<local_ordinal_type, global_ordinal_type, Node>;
2108
2109
2111 Teuchos::RCP<const map_type> rowMap_;
2113 Teuchos::RCP<const map_type> colMap_;
2115 Teuchos::RCP<const map_type> rangeMap_;
2117 Teuchos::RCP<const map_type> domainMap_;
2118
2125 Teuchos::RCP<const import_type> importer_;
2126
2132 Teuchos::RCP<const export_type> exporter_;
2133
2139 Teuchos::OrdinalTraits<size_t>::invalid();
2140
2145 Teuchos::OrdinalTraits<global_size_t>::invalid();
2146
2152 Teuchos::OrdinalTraits<global_size_t>::invalid();
2153
2154 private:
2155 // Replacement for device view k_rowPtrs_
2156 // Device view rowPtrsUnpacked_dev_ takes place of k_rowPtrs_
2157 // Host view rowPtrsUnpacked_host_ takes place of copies and use of getEntryOnHost
2158 // Wish this could be a WrappedDualView, but deep_copies in DualView
2159 // don't work with const data views (e.g., StaticCrsGraph::row_map)
2160 // k_rowPtrs_ is offsets wrt the ALLOCATED indices array, not necessarily
2161 // the ACTUAL compressed indices array.
2162 // When !OptimizedStorage, k_rowPtrs_ may differ from ACTUAL compressed
2163 // indices array. (Karen is skeptical that !OptimizedStorage works)
2164 // When OptimizedStorage, rowPtrsUnpacked_ = k_rowPtrsPacked_
2165
2166 row_ptrs_device_view_type rowPtrsUnpacked_dev_;
2167 mutable row_ptrs_host_view_type rowPtrsUnpacked_host_;
2168
2169 // Row offsets into the actual graph local indices
2170 // Device view rowPtrsUnpacked_dev_ takes place of lclGraph_.row_map
2171
2172 row_ptrs_device_view_type rowPtrsPacked_dev_;
2173 mutable row_ptrs_host_view_type rowPtrsPacked_host_;
2174
2176 bool packedUnpackedRowPtrsMatch_ = false;
2177
2178 protected:
2179 void setRowPtrsUnpacked(const row_ptrs_device_view_type &dview) {
2180 packedUnpackedRowPtrsMatch_ = false;
2181 rowPtrsUnpacked_dev_ = dview;
2182 //Make sure stale host rowptrs are not kept
2183 rowPtrsUnpacked_host_ = row_ptrs_host_view_type();
2184 }
2185
2187 const row_ptrs_device_view_type& getRowPtrsUnpackedDevice() const
2188 {
2189 return rowPtrsUnpacked_dev_;
2190 }
2191
2193 const row_ptrs_host_view_type& getRowPtrsUnpackedHost() const
2194 {
2195 if(rowPtrsUnpacked_host_.extent(0) != rowPtrsUnpacked_dev_.extent(0))
2196 {
2197 //NOTE: not just using create_mirror_view here, because
2198 //we do want host/device to be in different memory, even if we're using a SharedSpace.
2199 //This is so that reads will never trigger a host-device transfer.
2200 //The exception is when 'device' views are HostSpace, then don't make another copy.
2201 if constexpr(std::is_same_v<typename Node::memory_space, Kokkos::HostSpace>)
2202 {
2203 rowPtrsUnpacked_host_ = rowPtrsUnpacked_dev_;
2204 }
2205 else
2206 {
2207 //Have to make this temporary because rowptrs are const-valued
2208 typename row_ptrs_host_view_type::non_const_type rowPtrsTemp(
2209 Kokkos::view_alloc(Kokkos::WithoutInitializing, "rowPtrsUnpacked_host_"), rowPtrsUnpacked_dev_.extent(0));
2210 Kokkos::deep_copy(rowPtrsTemp, rowPtrsUnpacked_dev_);
2211 rowPtrsUnpacked_host_= rowPtrsTemp;
2212 }
2213 //Also keep packed/unpacked views in sync, if they are known to have the same contents
2214 if(packedUnpackedRowPtrsMatch_)
2215 {
2216 rowPtrsPacked_host_ = rowPtrsUnpacked_host_;
2217 }
2218 }
2219 return rowPtrsUnpacked_host_;
2220 }
2221
2222 void setRowPtrsPacked(const row_ptrs_device_view_type &dview) {
2223 packedUnpackedRowPtrsMatch_ = false;
2224 rowPtrsPacked_dev_ = dview;
2225 //Make sure stale host rowptrs are not kept
2226 rowPtrsPacked_host_ = row_ptrs_host_view_type();
2227 }
2228
2230 const row_ptrs_device_view_type& getRowPtrsPackedDevice() const
2231 {
2232 return rowPtrsPacked_dev_;
2233 }
2234
2236 const row_ptrs_host_view_type& getRowPtrsPackedHost() const
2237 {
2238 if(rowPtrsPacked_host_.extent(0) != rowPtrsPacked_dev_.extent(0))
2239 {
2240 //NOTE: not just using create_mirror_view here, because
2241 //we do want host/device to be in different memory, even if we're using a SharedSpace.
2242 //This is so that reads will never trigger a host-device transfer.
2243 //The exception is when 'device' views are HostSpace, then don't make another copy.
2244 if constexpr(std::is_same_v<typename Node::memory_space, Kokkos::HostSpace>)
2245 {
2246 rowPtrsPacked_host_ = rowPtrsPacked_dev_;
2247 }
2248 else
2249 {
2250 //Have to make this temporary because rowptrs are const-valued
2251 typename row_ptrs_host_view_type::non_const_type rowPtrsTemp(
2252 Kokkos::view_alloc(Kokkos::WithoutInitializing, "rowPtrsPacked_host_"), rowPtrsPacked_dev_.extent(0));
2253 Kokkos::deep_copy(rowPtrsTemp, rowPtrsPacked_dev_);
2254 rowPtrsPacked_host_= rowPtrsTemp;
2255 }
2256 //Also keep packed/unpacked views in sync, if they are known to have the same contents
2257 if(packedUnpackedRowPtrsMatch_)
2258 {
2259 rowPtrsUnpacked_host_ = rowPtrsPacked_host_;
2260 }
2261 }
2262 return rowPtrsPacked_host_;
2263 }
2264
2265 // There are common cases where both packed and unpacked views are set to the same array.
2266 // Doing this in a single call can reduce dataspace on host, and reduce runtime by
2267 // removing a deep_copy from device to host.
2268
2269 void setRowPtrs(const row_ptrs_device_view_type &dview) {
2270 packedUnpackedRowPtrsMatch_ = true;
2271 rowPtrsUnpacked_dev_ = dview;
2272 rowPtrsPacked_dev_ = dview;
2273 //Make sure stale host rowptrs are not kept
2274 rowPtrsUnpacked_host_ = row_ptrs_host_view_type();
2275 rowPtrsPacked_host_ = row_ptrs_host_view_type();
2276 }
2277
2278 //TODO: Make private -- matrix shouldn't access directly the guts of graph
2279
2293 local_inds_wdv_type lclIndsUnpacked_wdv;
2294
2308 mutable local_inds_wdv_type lclIndsPacked_wdv;
2309
2310 //TODO: Make private -- matrix shouldn't access directly the guts of graph
2311
2321
2322 // TODO: Make private -- matrix shouldn't access directly
2323 global_inds_wdv_type gblInds_wdv;
2324
2328 typename local_inds_dualv_type::t_host::const_type
2329 getLocalIndsViewHost (const RowInfo& rowinfo) const;
2330
2334 typename local_inds_dualv_type::t_dev::const_type
2335 getLocalIndsViewDevice (const RowInfo& rowinfo) const;
2336
2340 typename global_inds_dualv_type::t_host::const_type
2341 getGlobalIndsViewHost (const RowInfo& rowinfo) const;
2342
2346 typename global_inds_dualv_type::t_dev::const_type
2347 getGlobalIndsViewDevice (const RowInfo& rowinfo) const;
2348
2352 typename local_inds_dualv_type::t_host
2354
2355 // FOR NOW...
2356 // KEEP k_numRowEntries_ (though switch from HostMirror to Host)
2357 // KEEP k_numAllocPerRow_ (though perhaps switch from HostMirror to Host)
2358
2384 typename Kokkos::View<const size_t*, device_type>::HostMirror
2386
2397
2399
2400
2422
2430 typedef typename Kokkos::View<size_t*, Kokkos::LayoutLeft, device_type>::HostMirror num_row_entries_type;
2431
2432 // typedef Kokkos::View<
2433 // size_t*,
2434 // Kokkos::LayoutLeft,
2435 // Kokkos::Device<
2436 // typename Kokkos::View<
2437 // size_t*,
2438 // Kokkos::LayoutLeft,
2439 // device_type>::HostMirror::execution_space,
2440 // Kokkos::HostSpace> > num_row_entries_type;
2441
2449
2455 mutable offset_device_view_type k_offRankOffsets_;
2456
2458
2469 Details::STORAGE_1D_UNPACKED;
2470
2471 bool indicesAreAllocated_ = false;
2472 bool indicesAreLocal_ = false;
2473 bool indicesAreGlobal_ = false;
2474 bool fillComplete_ = false;
2475
2480 bool noRedundancies_ = true;
2486 mutable bool haveLocalOffRankOffsets_ = false;
2487
2488 typedef typename std::map<global_ordinal_type, std::vector<global_ordinal_type> > nonlocals_type;
2489
2491 nonlocals_type nonlocals_;
2492
2508
2509 private:
2511 static bool getDebug();
2512
2515 bool debug_ = getDebug();
2516
2518 static bool getVerbose();
2519
2523 bool verbose_ = getVerbose();
2524
2525 private:
2527 mutable bool need_sync_host_uvm_access = false;
2528
2530 void set_need_sync_host_uvm_access() {
2531 need_sync_host_uvm_access = true;
2532 }
2533
2535 void execute_sync_host_uvm_access() const {
2536 if(need_sync_host_uvm_access) {
2537 Kokkos::fence("CrsGraph::execute_sync_host_uvm_access");
2538 need_sync_host_uvm_access = false;
2539 }
2540 }
2541 }; // class CrsGraph
2542
2550 template <class LocalOrdinal, class GlobalOrdinal, class Node>
2551 Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
2553 const Teuchos::RCP<
2555 size_t maxNumEntriesPerRow = 0,
2556 const Teuchos::RCP<Teuchos::ParameterList>& params =
2557 Teuchos::null)
2558 {
2559 using Teuchos::rcp;
2560 using graph_type = CrsGraph<LocalOrdinal, GlobalOrdinal, Node>;
2561 return rcp(new graph_type(map, maxNumEntriesPerRow,
2562 params));
2563 }
2564
2614 template<class CrsGraphType>
2615 Teuchos::RCP<CrsGraphType>
2616 importAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2617 const Import<typename CrsGraphType::local_ordinal_type,
2618 typename CrsGraphType::global_ordinal_type,
2619 typename CrsGraphType::node_type>& importer,
2620 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2621 typename CrsGraphType::global_ordinal_type,
2622 typename CrsGraphType::node_type> >& domainMap = Teuchos::null,
2623 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2624 typename CrsGraphType::global_ordinal_type,
2625 typename CrsGraphType::node_type> >& rangeMap = Teuchos::null,
2626 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
2627 {
2628 Teuchos::RCP<CrsGraphType> destGraph;
2629 sourceGraph->importAndFillComplete (destGraph,importer,domainMap, rangeMap, params);
2630 return destGraph;
2631 }
2632
2683 template<class CrsGraphType>
2684 Teuchos::RCP<CrsGraphType>
2685 importAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2686 const Import<typename CrsGraphType::local_ordinal_type,
2687 typename CrsGraphType::global_ordinal_type,
2688 typename CrsGraphType::node_type>& rowImporter,
2689 const Import<typename CrsGraphType::local_ordinal_type,
2690 typename CrsGraphType::global_ordinal_type,
2691 typename CrsGraphType::node_type>& domainImporter,
2692 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2693 typename CrsGraphType::global_ordinal_type,
2694 typename CrsGraphType::node_type> >& domainMap,
2695 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2696 typename CrsGraphType::global_ordinal_type,
2697 typename CrsGraphType::node_type> >& rangeMap,
2698 const Teuchos::RCP<Teuchos::ParameterList>& params)
2699 {
2700 Teuchos::RCP<CrsGraphType> destGraph;
2701 sourceGraph->importAndFillComplete (destGraph,rowImporter,domainImporter, domainMap, rangeMap, params);
2702 return destGraph;
2703 }
2704
2738 template<class CrsGraphType>
2739 Teuchos::RCP<CrsGraphType>
2740 exportAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2741 const Export<typename CrsGraphType::local_ordinal_type,
2742 typename CrsGraphType::global_ordinal_type,
2743 typename CrsGraphType::node_type>& exporter,
2744 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2745 typename CrsGraphType::global_ordinal_type,
2746 typename CrsGraphType::node_type> >& domainMap = Teuchos::null,
2747 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2748 typename CrsGraphType::global_ordinal_type,
2749 typename CrsGraphType::node_type> >& rangeMap = Teuchos::null,
2750 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
2751 {
2752 Teuchos::RCP<CrsGraphType> destGraph;
2753 sourceGraph->exportAndFillComplete (destGraph,exporter,domainMap, rangeMap, params);
2754 return destGraph;
2755 }
2756
2790 template<class CrsGraphType>
2791 Teuchos::RCP<CrsGraphType>
2792 exportAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2793 const Export<typename CrsGraphType::local_ordinal_type,
2794 typename CrsGraphType::global_ordinal_type,
2795 typename CrsGraphType::node_type>& rowExporter,
2796 const Export<typename CrsGraphType::local_ordinal_type,
2797 typename CrsGraphType::global_ordinal_type,
2798 typename CrsGraphType::node_type>& domainExporter,
2799 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2800 typename CrsGraphType::global_ordinal_type,
2801 typename CrsGraphType::node_type> >& domainMap,
2802 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2803 typename CrsGraphType::global_ordinal_type,
2804 typename CrsGraphType::node_type> >& rangeMap,
2805 const Teuchos::RCP<Teuchos::ParameterList>& params)
2806 {
2807 Teuchos::RCP<CrsGraphType> destGraph;
2808 sourceGraph->exportAndFillComplete (destGraph,rowExporter,domainExporter,domainMap, rangeMap, params);
2809 return destGraph;
2810 }
2811
2812
2813} // namespace Tpetra
2814
2815#endif // TPETRA_CRSGRAPH_DECL_HPP
Forward declaration of Tpetra::BlockCrsMatrix.
Forward declaration of Tpetra::CrsGraph.
Forward declaration of Tpetra::CrsMatrix.
Stand-alone utility functions and macros.
bool isMerged() const
Whether duplicate column indices in each row have been merged.
virtual void unpackAndCombine(const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &importLIDs, Kokkos::DualView< packet_type *, buffer_device_type > imports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, const size_t constantNumPackets, const CombineMode combineMode) override
local_inds_dualv_type::t_dev::const_type getLocalIndsViewDevice(const RowInfo &rowinfo) const
Get a const, locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRo...
void insertGlobalIndices(const global_ordinal_type globalRow, const local_ordinal_type numEnt, const global_ordinal_type inds[])
Epetra compatibility version of insertGlobalIndices (see above) that takes input as a raw pointer,...
void reindexColumns(const Teuchos::RCP< const map_type > &newColMap, const Teuchos::RCP< const import_type > &newImport=Teuchos::null, const bool sortIndicesInEachRow=true)
Reindex the column indices in place, and replace the column Map. Optionally, replace the Import objec...
global_inds_dualv_type::t_host::const_type getGlobalIndsViewHost(const RowInfo &rowinfo) const
Get a const, globally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myR...
size_t getNumEntriesInLocalRow(local_ordinal_type localRow) const override
Get the number of entries in the given row (local index).
Kokkos::StaticCrsGraph< local_ordinal_type, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_device_type
Teuchos::RCP< CrsGraphType > importAndFillCompleteCrsGraph(const Teuchos::RCP< const CrsGraphType > &sourceGraph, const Import< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &rowImporter, const Import< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &domainImporter, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &domainMap, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Nonmember CrsGraph constructor that fuses Import and fillComplete().
Teuchos::RCP< const map_type > getColMap() const override
Returns the Map that describes the column distribution in this graph.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Default parameter list suitable for validation.
::Tpetra::Import< LO, GO, node_type > import_type
void insertGlobalIndicesIntoNonownedRows(const global_ordinal_type gblRow, const global_ordinal_type gblColInds[], const local_ordinal_type numGblColInds)
Implementation of insertGlobalIndices for nonowned rows.
std::pair< size_t, std::string > makeIndicesLocal(const bool verbose=false)
Convert column indices from global to local.
void insertLocalIndices(const local_ordinal_type localRow, const local_ordinal_type numEnt, const local_ordinal_type inds[])
Epetra compatibility version of insertLocalIndices (see above) that takes input as a raw pointer,...
local_inds_device_view_type getLocalIndicesDevice() const
Get a device view of the packed column indicies.
global_size_t getGlobalNumEntries() const override
Returns the global number of entries in the graph.
bool isIdenticalTo(const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > &graph) const
Create a cloned CrsGraph for a different Node type.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const override
Returns the communicator.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void globalAssemble()
Communicate nonlocal contributions to other processes.
RowInfo getRowInfoFromGlobalRowIndex(const global_ordinal_type gblRow) const
Get information about the locally owned row with global index gblRow.
void getLocalDiagOffsets(const Kokkos::View< size_t *, device_type, Kokkos::MemoryUnmanaged > &offsets) const
Get offsets of the diagonal entries in the graph.
size_t findGlobalIndices(const RowInfo &rowInfo, const Teuchos::ArrayView< const global_ordinal_type > &indices, std::function< void(const size_t, const size_t, const size_t)> fun) const
Finds indices in the given row.
CrsGraph(const CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &)=default
Copy constructor (default).
void fillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Tell the graph that you are done changing its structure.
size_t sortAndMergeRowIndices(const RowInfo &rowInfo, const bool sorted, const bool merged)
Sort and merge duplicate column indices in the given row.
Teuchos::RCP< const import_type > importer_
void setAllIndices(const Teuchos::ArrayRCP< size_t > &rowPointers, const Teuchos::ArrayRCP< local_ordinal_type > &columnIndices)
Set the graph's data directly, using 1-D storage.
Teuchos::RCP< CrsGraphType > exportAndFillCompleteCrsGraph(const Teuchos::RCP< const CrsGraphType > &sourceGraph, const Export< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &exporter, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Nonmember CrsGraph constructor that fuses Export and fillComplete().
CrsGraph(CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &&)=default
Move constructor (default).
const row_ptrs_device_view_type & getRowPtrsUnpackedDevice() const
Get the unpacked row pointers on device.
bool hasColMap() const override
Whether the graph has a column Map.
std::string description() const override
Return a one-line human-readable description of this object.
bool isStorageOptimized() const
Returns true if storage has been optimized.
void getGlobalRowCopy(global_ordinal_type gblRow, nonconst_global_inds_host_view_type &gblColInds, size_t &numColInds) const override
Get a copy of the given row, using global indices.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Kokkos::DualView< const size_t *, device_type > &numEntPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying a (possibly different) upper bound for the number of entries in each row.
void removeLocalIndices(local_ordinal_type localRow)
Remove all graph indices from the specified local row.
void importAndFillComplete(Teuchos::RCP< CrsGraph< local_ordinal_type, global_ordinal_type, Node > > &destGraph, const import_type &importer, const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null) const
Import from this to the given destination graph, and make the result fill complete.
global_size_t getGlobalNumRows() const override
Returns the number of global rows in the graph.
Teuchos::RCP< const map_type > getDomainMap() const override
Returns the Map associated with the domain of this graph.
void replaceRangeMapAndExporter(const Teuchos::RCP< const map_type > &newRangeMap, const Teuchos::RCP< const export_type > &newExporter)
Replace the current Range Map and Export with the given parameters.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::ArrayView< const size_t > &numEntPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and number of entries in each row (legacy KokkosClassic version).
void computeLocalConstants()
Compute local constants, if they have not yet been computed.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const override
Print this object to the given output stream with the given verbosity level.
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &params) override
Set the given list of parameters (must be nonnull).
void resumeFill(const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Resume fill operations.
size_t insertIndices(RowInfo &rowInfo, const SLocalGlobalViews &newInds, const ELocalGlobal lg, const ELocalGlobal I)
Insert indices into the given row.
typename node_type::device_type device_type
Teuchos::RCP< CrsGraphType > importAndFillCompleteCrsGraph(const Teuchos::RCP< const CrsGraphType > &sourceGraph, const Import< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &importer, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Nonmember CrsGraph constructor that fuses Import and fillComplete().
void insertGlobalIndicesFiltered(const local_ordinal_type lclRow, const global_ordinal_type gblColInds[], const local_ordinal_type numGblColInds)
Like insertGlobalIndices(), but with column Map filtering.
virtual void copyAndPermute(const SrcDistObject &source, const size_t numSameIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteToLIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteFromLIDs, const CombineMode CM) override
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const typename local_graph_device_type::row_map_type &rowPointers, const typename local_graph_device_type::entries_type::non_const_type &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and arrays containing the graph. In almost all cases the indices mu...
RowInfo getRowInfo(const local_ordinal_type myRow) const
Get information about the locally owned row with local index myRow.
typename row_graph_type::local_inds_device_view_type local_inds_device_view_type
global_inds_dualv_type::t_dev::const_type getGlobalIndsViewDevice(const RowInfo &rowinfo) const
Get a const, globally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myR...
typename local_graph_device_type::HostMirror local_graph_host_type
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying a single upper bound for the number of entries in all rows on the calling proc...
row_ptrs_host_view_type getLocalRowPtrsHost() const
Get a host view of the packed row offsets.
bool isSorted() const
Whether graph indices in all rows are known to be sorted.
typename dist_object_type::buffer_device_type buffer_device_type
Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > createCrsGraph(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t maxNumEntriesPerRow=0, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Nonmember function to create an empty CrsGraph given a row Map and the max number of entries allowed ...
void setAllIndices(const typename local_graph_device_type::row_map_type &rowPointers, const typename local_graph_device_type::entries_type::non_const_type &columnIndices)
Set the graph's data directly, using 1-D storage.
void insertLocalIndices(const local_ordinal_type localRow, const Teuchos::ArrayView< const local_ordinal_type > &indices)
Insert local indices into the graph.
local_inds_host_view_type getLocalIndicesHost() const
Get a host view of the packed column indicies.
bool supportsRowViews() const override
Whether this class implements getLocalRowView() and getGlobalRowView() (it does).
size_t getNumEntriesInGlobalRow(global_ordinal_type globalRow) const override
Returns the current number of entries on this node in the specified global row.
CrsGraph(CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &originalGraph, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and an existing graph to subview. The graph created will point to t...
Kokkos::View< size_t *, Kokkos::LayoutLeft, device_type >::HostMirror num_row_entries_type
size_t insertGlobalIndicesImpl(const RowInfo &rowInfo, const global_ordinal_type inputGblColInds[], const size_t numInputInds, std::function< void(const size_t, const size_t, const size_t)> fun=std::function< void(const size_t, const size_t, const size_t)>())
Insert global indices, using an input RowInfo.
bool isFillComplete() const override
Whether fillComplete() has been called and the graph is in compute mode.
void setDomainRangeMaps(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap)
void fillComplete(const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Tell the graph that you are done changing its structure; set default domain and range Maps.
void swap(CrsGraph< local_ordinal_type, global_ordinal_type, Node > &graph)
Swaps the data from *this with the data and maps from graph.
::Tpetra::Map< LO, GO, node_type > map_type
CrsGraph & operator=(const CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &)=default
Assignment operator (default).
void getGlobalRowView(const global_ordinal_type gblRow, global_inds_host_view_type &gblColInds) const override
Get a const view of the given global row's global column indices.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and a single upper bound for the number of entries in all rows on t...
const row_ptrs_host_view_type & getRowPtrsUnpackedHost() const
Get the unpacked row pointers on host. Lazily make a copy from device.
void exportAndFillComplete(Teuchos::RCP< CrsGraph< local_ordinal_type, global_ordinal_type, Node > > &destGraph, const export_type &rowExporter, const export_type &domainExporter, const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params) const
Export from this to the given destination graph, and make the result fill complete.
void exportAndFillComplete(Teuchos::RCP< CrsGraph< local_ordinal_type, global_ordinal_type, Node > > &destGraph, const export_type &exporter, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null) const
Export from this to the given destination graph, and make the result fill complete.
void makeColMap(Teuchos::Array< int > &remotePIDs)
Make and set the graph's column Map.
CrsGraph(const local_graph_device_type &lclGraph, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column, domain and range maps, and a local graph, which the resulting CrsGraph...
size_t getGlobalMaxNumRowEntries() const override
Maximum number of entries in any row of the graph, over all processes in the graph's communicator.
void checkInternalState() const
Throw an exception if the internal state is not consistent.
Teuchos::RCP< const map_type > getRangeMap() const override
Returns the Map associated with the domain of this graph.
void expertStaticFillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const import_type > &importer=Teuchos::null, const Teuchos::RCP< const export_type > &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Perform a fillComplete on a graph that already has data, via setAllIndices().
size_t getNumAllocatedEntriesInGlobalRow(global_ordinal_type globalRow) const
Current number of allocated entries in the given row on the calling (MPI) process,...
Teuchos::RCP< const export_type > getExporter() const override
Returns the exporter associated with this graph.
typename device_type::execution_space execution_space
void makeImportExport(Teuchos::Array< int > &remotePIDs, const bool useRemotePIDs)
Make the Import and Export objects, if needed.
global_ordinal_type getIndexBase() const override
Returns the index base for global indices for this graph.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Backwards compatibility overload of the above method.
row_ptrs_device_view_type getLocalRowPtrsDevice() const
Get a device view of the packed row offsets.
void getLocalRowCopy(local_ordinal_type gblRow, nonconst_local_inds_host_view_type &gblColInds, size_t &numColInds) const override
Get a copy of the given row, using local indices.
local_inds_dualv_type::t_host::const_type getLocalIndsViewHost(const RowInfo &rowinfo) const
Get a const, locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRo...
bool isFillActive() const
Whether resumeFill() has been called and the graph is in edit mode.
Teuchos::RCP< const map_type > getRowMap() const override
Returns the Map that describes the row distribution in this graph.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const local_graph_device_type &lclGraph, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor specifying column Map and a local graph, which the resulting CrsGraph views....
size_t insertGlobalIndicesImpl(const local_ordinal_type lclRow, const global_ordinal_type inputGblColInds[], const size_t numInputInds)
Insert global indices, using an input local row index.
::Tpetra::Export< LO, GO, node_type > export_type
size_t getLocalNumEntries() const override
The local number of entries in the graph.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::ArrayView< const size_t > &numEntPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying a (possibly different) upper bound for the number of entries in each row (lega...
Teuchos::RCP< const import_type > getImporter() const override
Returns the importer associated with this graph.
Teuchos::RCP< const map_type > domainMap_
const row_ptrs_host_view_type & getRowPtrsPackedHost() const
Get the packed row pointers on host. Lazily make a copy from device.
size_t getLocalNumCols() const override
Returns the number of columns connected to the locally owned rows of this graph.
virtual void pack(const Teuchos::ArrayView< const local_ordinal_type > &exportLIDs, Teuchos::Array< global_ordinal_type > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets) const override
void getLocalOffRankOffsets(offset_device_view_type &offsets) const
Get offsets of the off-rank entries in the graph.
global_size_t getGlobalNumCols() const override
Returns the number of global columns in the graph.
Teuchos::RCP< const export_type > exporter_
void insertGlobalIndices(const global_ordinal_type globalRow, const Teuchos::ArrayView< const global_ordinal_type > &indices)
Insert global indices into the graph.
local_inds_dualv_type::t_host getLocalIndsViewHostNonConst(const RowInfo &rowinfo)
Get a ReadWrite locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(m...
void replaceDomainMap(const Teuchos::RCP< const map_type > &newDomainMap)
Replace the current domain Map with the given objects.
Kokkos::View< constsize_t *, device_type >::HostMirror k_numAllocPerRow_
void computeGlobalConstants()
Compute global constants, if they have not yet been computed.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Kokkos::DualView< const size_t *, device_type > &numEntPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
size_t getNumAllocatedEntriesInLocalRow(local_ordinal_type localRow) const
Current number of allocated entries in the given row on the calling (MPI) process,...
virtual ~CrsGraph()=default
Destructor (virtual for memory safety of derived classes).
void replaceDomainMapAndImporter(const Teuchos::RCP< const map_type > &newDomainMap, const Teuchos::RCP< const import_type > &newImporter)
Replace the current domain Map and Import with the given parameters.
typename row_graph_type::global_inds_device_view_type global_inds_device_view_type
void setLocallyModified()
Report that we made a local modification to its structure.
CrsGraph(const row_ptrs_device_view_type &rowPointers, const local_inds_wdv_type &columnIndices, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const import_type > &importer, const Teuchos::RCP< const export_type > &exporter, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying the local row pointer and column indices arrays of the local graph; the row,...
size_t getLocalAllocationSize() const
The local number of indices allocated for the graph, over all rows on the calling (MPI) process.
void replaceRangeMap(const Teuchos::RCP< const map_type > &newRangeMap)
Replace the current Range Map with the given objects.
Teuchos::RCP< CrsGraphType > exportAndFillCompleteCrsGraph(const Teuchos::RCP< const CrsGraphType > &sourceGraph, const Export< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &rowExporter, const Export< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &domainExporter, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &domainMap, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Nonmember CrsGraph constructor that fuses Export and fillComplete().
CrsGraph(const local_graph_device_type &lclGraph, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const import_type > &importer, const Teuchos::RCP< const export_type > &exporter, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
void importAndFillComplete(Teuchos::RCP< CrsGraph< local_ordinal_type, global_ordinal_type, Node > > &destGraph, const import_type &rowImporter, const import_type &domainImporter, const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params) const
Import from this to the given destination graph, and make the result fill complete.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::ArrayRCP< size_t > &rowPointers, const Teuchos::ArrayRCP< local_ordinal_type > &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and arrays containing the graph. In almost all cases the indices mu...
const row_ptrs_device_view_type & getRowPtrsPackedDevice() const
Get the packed row pointers on device.
virtual void removeEmptyProcessesInPlace(const Teuchos::RCP< const map_type > &newMap) override
Remove processes owning zero rows from the Maps and their communicator.
void getLocalRowView(const LocalOrdinal lclRow, local_inds_host_view_type &lclColInds) const override
Get a const view of the given local row's local column indices.
bool isGloballyIndexed() const override
Whether the graph's column indices are stored as global indices.
bool isLocallyIndexed() const override
Whether the graph's column indices are stored as local indices.
size_t getLocalMaxNumRowEntries() const override
Maximum number of entries in any row of the graph, on this process.
virtual bool checkSizes(const SrcDistObject &source) override
Compare the source and target (this) objects for compatibility.
local_graph_device_type getLocalGraphDevice() const
Get the local graph.
size_t getLocalNumRows() const override
Returns the number of graph rows owned on the calling node.
void replaceColMap(const Teuchos::RCP< const map_type > &newColMap)
Replace the graph's current column Map with the given Map.
Keep track of how much more space a CrsGraph or CrsMatrix needs, when the graph or matrix is the targ...
A wrapper around Kokkos::DualView to safely manage data that might be replicated between host and dev...
Kokkos::Device< typename device_type::execution_space, buffer_memory_space > buffer_device_type
Kokkos::Device specialization for communication buffers.
virtual void packAndPrepare(const SrcDistObject &source, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &exportLIDs, Kokkos::DualView< packet_type *, buffer_device_type > &exports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, size_t &constantNumPackets)
Pack data and metadata for communication (sends).
virtual void unpackAndCombine(const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &importLIDs, Kokkos::DualView< packet_type *, buffer_device_type > imports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, const size_t constantNumPackets, const CombineMode combineMode)
Perform any unpacking and combining after communication.
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...
Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
A parallel distribution of indices over processes.
An abstract interface for graphs accessed by rows.
Abstract base class for objects that can be the source of an Import or Export operation.
Implementation details of Tpetra.
Nonmember function that computes a residual Computes R = B - A * X.
EStorageStatus
Status of the graph's or matrix's storage, when not in a fill-complete state.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
size_t global_size_t
Global size_t object.
CombineMode
Rule for combining data in an Import or Export.
Allocation information for a locally owned row in a CrsGraph or CrsMatrix.