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#ifndef TPETRA_CRSGRAPH_DECL_HPP
11#define TPETRA_CRSGRAPH_DECL_HPP
12
15
19#include "Tpetra_DistObject.hpp"
20#include "Tpetra_Exceptions.hpp"
21#include "Tpetra_RowGraph.hpp"
22#include "Tpetra_Util.hpp" // need this here for sort2
23#include "Tpetra_Details_WrappedDualView.hpp"
24#include "Tpetra_Details_makeColMap.hpp"
25
26#include "KokkosSparse_findRelOffset.hpp"
27#include "Kokkos_DualView.hpp"
28
29#include "Teuchos_CommHelpers.hpp"
30#include "Teuchos_Describable.hpp"
31#include "Teuchos_OrdinalTraits.hpp"
32#include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
33
34#include "KokkosSparse_StaticCrsGraph.hpp"
35
36#include <functional> // std::function
37#include <memory>
38
39namespace Tpetra {
40
41// Forward declaration for CrsGraph::swap() test
42template <class LocalOrdinal, class GlobalOrdinal, class Node>
43class crsGraph_Swap_Tester;
44
45#ifndef DOXYGEN_SHOULD_SKIP_THIS
46namespace Details {
47template <class LocalOrdinal,
48 class GlobalOrdinal>
49class CrsPadding;
50} // namespace Details
51
52namespace { // (anonymous)
53
54template <class ViewType>
55struct UnmanagedView {
56 static_assert(Kokkos::is_view<ViewType>::value,
57 "ViewType must be a Kokkos::View specialization.");
58 // FIXME (mfh 02 Dec 2015) Right now, this strips away other
59 // memory traits. Christian will add an "AllTraits" enum which is
60 // the enum value of MemoryTraits<T>, that will help us fix this.
61 typedef Kokkos::View<typename ViewType::data_type,
62 typename ViewType::array_layout,
63 typename ViewType::device_type,
64 Kokkos::MemoryUnmanaged>
65 type;
66};
67
68} // namespace
69#endif // DOXYGEN_SHOULD_SKIP_THIS
70
79struct RowInfo {
80 size_t localRow;
81 size_t allocSize;
82 size_t numEntries;
83 size_t offset1D;
84};
85
86enum ELocalGlobal {
87 LocalIndices,
88 GlobalIndices
89};
90
91namespace Details {
123 STORAGE_1D_UNPACKED, //<! 1-D "unpacked" storage
124 STORAGE_1D_PACKED, //<! 1-D "packed" storage
125 STORAGE_UB //<! Invalid value; upper bound on enum values
126};
127
128} // namespace Details
129
188template <class LocalOrdinal,
189 class GlobalOrdinal,
190 class Node>
191class CrsGraph : public RowGraph<LocalOrdinal, GlobalOrdinal, Node>,
192 public DistObject<GlobalOrdinal,
193 LocalOrdinal,
194 GlobalOrdinal,
195 Node>,
196 public Teuchos::ParameterListAcceptorDefaultBase {
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 KokkosSparse::StaticCrsGraph<local_ordinal_type, Kokkos::LayoutLeft,
226 device_type, void, size_t>;
227
229 using local_graph_host_type = typename local_graph_device_type::host_mirror_type;
230
237
238 public:
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
251 public:
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
341
345 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
346 const Teuchos::RCP<const map_type>& colMap,
347 const size_t maxNumEntriesPerRow,
348 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
349
364 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
365 const Teuchos::RCP<const map_type>& colMap,
366 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
367 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
368
384 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
385 const Teuchos::RCP<const map_type>& colMap,
386 const Teuchos::ArrayView<const size_t>& numEntPerRow,
387 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
388
401 CrsGraph(CrsGraph<local_ordinal_type, global_ordinal_type, node_type>& originalGraph,
402 const Teuchos::RCP<const map_type>& rowMap,
403 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
404
416 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
417 const Teuchos::RCP<const map_type>& colMap,
418 const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>& originalGraph,
419 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
420
438 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
439 const Teuchos::RCP<const map_type>& colMap,
440 const Teuchos::RCP<const map_type>& domainMap,
441 const Teuchos::RCP<const map_type>& rangeMap,
442 const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>& originalGraph,
443 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
444
467 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
468 const Teuchos::RCP<const map_type>& colMap,
469 const typename local_graph_device_type::row_map_type& rowPointers,
470 const typename local_graph_device_type::entries_type::non_const_type& columnIndices,
471 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
472
495 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
496 const Teuchos::RCP<const map_type>& colMap,
497 const Teuchos::ArrayRCP<size_t>& rowPointers,
498 const Teuchos::ArrayRCP<local_ordinal_type>& columnIndices,
499 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
500
522 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
523 const Teuchos::RCP<const map_type>& colMap,
524 const local_graph_device_type& lclGraph,
525 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
526
554 const Teuchos::RCP<const map_type>& rowMap,
555 const Teuchos::RCP<const map_type>& colMap,
556 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
557 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
558 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
559
572 const Teuchos::RCP<const map_type>& rowMap,
573 const Teuchos::RCP<const map_type>& colMap,
574 const Teuchos::RCP<const map_type>& domainMap,
575 const Teuchos::RCP<const map_type>& rangeMap,
576 const Teuchos::RCP<const import_type>& importer,
577 const Teuchos::RCP<const export_type>& exporter,
578 const Teuchos::RCP<Teuchos::ParameterList>& params =
579 Teuchos::null);
580
622 CrsGraph(const row_ptrs_device_view_type& rowPointers,
623 const local_inds_wdv_type& columnIndices,
624 const Teuchos::RCP<const map_type>& rowMap,
625 const Teuchos::RCP<const map_type>& colMap,
626 const Teuchos::RCP<const map_type>& domainMap,
627 const Teuchos::RCP<const map_type>& rangeMap,
628 const Teuchos::RCP<const import_type>& importer,
629 const Teuchos::RCP<const export_type>& exporter,
630 const Teuchos::RCP<Teuchos::ParameterList>& params =
631 Teuchos::null);
632
634 CrsGraph(const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&) = default;
635
637 CrsGraph& operator=(const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&) = default;
638
640 CrsGraph(CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&&) = default;
641
643 CrsGraph& operator=(CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&&) = default;
644
654 virtual ~CrsGraph() = default;
655
683
700 bool isIdenticalTo(const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>& graph) const;
701
703
705
707 void
708 setParameterList(const Teuchos::RCP<Teuchos::ParameterList>& params) override;
709
711 Teuchos::RCP<const Teuchos::ParameterList>
712 getValidParameters() const override;
713
715
717
739 void
741 const Teuchos::ArrayView<const global_ordinal_type>& indices);
742
749 void
751 const local_ordinal_type numEnt,
752 const global_ordinal_type inds[]);
753
755
769 void
771 const Teuchos::ArrayView<const local_ordinal_type>& indices);
772
779 void
781 const local_ordinal_type numEnt,
782 const local_ordinal_type inds[]);
783
785
795
797
799
808
827 void
828 resumeFill(const Teuchos::RCP<Teuchos::ParameterList>& params =
829 Teuchos::null);
830
868 void
869 fillComplete(const Teuchos::RCP<const map_type>& domainMap,
870 const Teuchos::RCP<const map_type>& rangeMap,
871 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
872
900 void
901 fillComplete(const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
902
931 void
932 expertStaticFillComplete(const Teuchos::RCP<const map_type>& domainMap,
933 const Teuchos::RCP<const map_type>& rangeMap,
934 const Teuchos::RCP<const import_type>& importer =
935 Teuchos::null,
936 const Teuchos::RCP<const export_type>& exporter =
937 Teuchos::null,
938 const Teuchos::RCP<Teuchos::ParameterList>& params =
939 Teuchos::null);
941
943
945 Teuchos::RCP<const Teuchos::Comm<int>> getComm() const override;
946
948 Teuchos::RCP<const map_type> getRowMap() const override;
949
951 Teuchos::RCP<const map_type> getColMap() const override;
952
954 Teuchos::RCP<const map_type> getDomainMap() const override;
955
957 Teuchos::RCP<const map_type> getRangeMap() const override;
958
960 Teuchos::RCP<const import_type> getImporter() const override;
961
963 Teuchos::RCP<const export_type> getExporter() const override;
964
966
969
971
975
977 size_t getLocalNumRows() const override;
978
980
982 size_t getLocalNumCols() const override;
983
986
988
991
1001 size_t getLocalNumEntries() const override;
1002
1004
1005 size_t
1007
1014 size_t
1016
1037
1046
1055
1069 size_t getGlobalMaxNumRowEntries() const override;
1070
1075 size_t getLocalMaxNumRowEntries() const override;
1076
1092 bool hasColMap() const override;
1093
1101 bool isLocallyIndexed() const override;
1102
1110 bool isGloballyIndexed() const override;
1111
1113 bool isFillComplete() const override;
1114
1116 bool isFillActive() const;
1117
1125 bool isSorted() const;
1126
1128
1135
1141 void
1143 nonconst_global_inds_host_view_type& gblColInds,
1144 size_t& numColInds) const override;
1145
1153 void
1155 nonconst_local_inds_host_view_type& lclColInds,
1156 size_t& numColInds) const override;
1157
1168 void
1170 const global_ordinal_type gblRow,
1171 global_inds_host_view_type& gblColInds) const override;
1172
1175 bool supportsRowViews() const override;
1176
1187 void
1189 const LocalOrdinal lclRow,
1190 local_inds_host_view_type& lclColInds) const override;
1191
1193
1195
1197 std::string description() const override;
1198
1201 void
1202 describe(Teuchos::FancyOStream& out,
1203 const Teuchos::EVerbosityLevel verbLevel =
1204 Teuchos::Describable::verbLevel_default) const override;
1205
1207
1209
1217
1218 virtual bool
1219 checkSizes(const SrcDistObject& source) override;
1220
1221 using dist_object_type::
1222 copyAndPermute;
1224
1225 virtual void
1227 const size_t numSameIDs,
1228 const Kokkos::DualView<const local_ordinal_type*,
1229 buffer_device_type>& permuteToLIDs,
1230 const Kokkos::DualView<const local_ordinal_type*,
1231 buffer_device_type>& permuteFromLIDs,
1232 const CombineMode CM) override;
1233
1234 void copyAndPermuteNew(
1235 const row_graph_type& source,
1236 row_graph_type& target,
1237 const size_t numSameIDs,
1238 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteToLIDs,
1239 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteFromLIDs,
1240 const CombineMode CM);
1241
1242 void insertGlobalIndicesDevice(
1243 const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>& srcCrsGraph,
1244 CrsGraph<LocalOrdinal, GlobalOrdinal, Node>& tgtCrsGraph,
1245 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteToLIDs,
1246 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteFromLIDs,
1247 LocalOrdinal loopEnd);
1248
1249 using padding_type = Details::CrsPadding<
1251
1252 void
1253 applyCrsPadding(const padding_type& padding,
1254 const bool verbose);
1255
1256 std::unique_ptr<padding_type>
1257 computeCrsPadding(
1259 node_type>& source,
1260 const size_t numSameIDs,
1261 const Kokkos::DualView<const local_ordinal_type*,
1262 buffer_device_type>& permuteToLIDs,
1263 const Kokkos::DualView<const local_ordinal_type*,
1264 buffer_device_type>& permuteFromLIDs,
1265 const bool verbose) const;
1266
1267 // This actually modifies imports by sorting it.
1268 std::unique_ptr<padding_type>
1269 computeCrsPaddingForImports(
1270 const Kokkos::DualView<const local_ordinal_type*,
1271 buffer_device_type>& importLIDs,
1272 Kokkos::DualView<packet_type*, buffer_device_type> imports,
1273 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1274 const bool verbose) const;
1275
1276 std::unique_ptr<padding_type>
1277 computePaddingForCrsMatrixUnpack(
1278 const Kokkos::DualView<const local_ordinal_type*,
1279 buffer_device_type>& importLIDs,
1280 Kokkos::DualView<char*, buffer_device_type> imports,
1281 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1282 const bool verbose) const;
1283
1284 void
1285 computeCrsPaddingForSameIDs(
1286 padding_type& padding,
1288 node_type>& source,
1289 const local_ordinal_type numSameIDs) const;
1290
1291 void
1292 computeCrsPaddingForPermutedIDs(
1293 padding_type& padding,
1295 node_type>& source,
1296 const Kokkos::DualView<const local_ordinal_type*,
1297 buffer_device_type>& permuteToLIDs,
1298 const Kokkos::DualView<const local_ordinal_type*,
1299 buffer_device_type>& permuteFromLIDs) const;
1300
1301 virtual void
1302 packAndPrepare(
1303 const SrcDistObject& source,
1304 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& exportLIDs,
1305 Kokkos::DualView<packet_type*, buffer_device_type>& exports,
1306 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1307 size_t& constantNumPackets) override;
1308
1313
1314 virtual void
1315 pack(const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1316 Teuchos::Array<global_ordinal_type>& exports,
1317 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1318 size_t& constantNumPackets) const override;
1319
1320 void
1321 packFillActive(const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1322 Teuchos::Array<global_ordinal_type>& exports,
1323 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1324 size_t& constantNumPackets) const;
1325
1326 void
1327 packFillActiveNew(const Kokkos::DualView<const local_ordinal_type*,
1328 buffer_device_type>& exportLIDs,
1329 Kokkos::DualView<packet_type*,
1330 buffer_device_type>& exports,
1331 Kokkos::DualView<size_t*,
1333 numPacketsPerLID,
1334 size_t& constantNumPackets) const;
1335
1340
1341 virtual void
1342 unpackAndCombine(const Kokkos::DualView<const local_ordinal_type*,
1343 buffer_device_type>& importLIDs,
1344 Kokkos::DualView<packet_type*,
1346 imports,
1347 Kokkos::DualView<size_t*,
1349 numPacketsPerLID,
1350 const size_t constantNumPackets,
1351 const CombineMode combineMode) override;
1352
1354
1356
1399 void
1400 getLocalDiagOffsets(const Kokkos::View<size_t*, device_type, Kokkos::MemoryUnmanaged>& offsets) const;
1401
1403 void
1404 getLocalOffRankOffsets(offset_device_view_type& offsets) const;
1405
1415 void
1416 getLocalDiagOffsets(Teuchos::ArrayRCP<size_t>& offsets) const;
1417
1427 void
1428 setAllIndices(const typename local_graph_device_type::row_map_type& rowPointers,
1429 const typename local_graph_device_type::entries_type::non_const_type& columnIndices);
1430
1440 void
1441 setAllIndices(const Teuchos::ArrayRCP<size_t>& rowPointers,
1442 const Teuchos::ArrayRCP<local_ordinal_type>& columnIndices);
1443
1446 row_ptrs_host_view_type getLocalRowPtrsHost() const;
1447
1450 row_ptrs_device_view_type getLocalRowPtrsDevice() const;
1451
1453 local_inds_host_view_type getLocalIndicesHost() const;
1454
1457
1476 void replaceColMap(const Teuchos::RCP<const map_type>& newColMap);
1477
1497 void
1498 reindexColumns(const Teuchos::RCP<const map_type>& newColMap,
1499 const Teuchos::RCP<const import_type>& newImport = Teuchos::null,
1500 const bool sortIndicesInEachRow = true);
1501
1508 void
1509 replaceDomainMap(const Teuchos::RCP<const map_type>& newDomainMap);
1510
1524 void
1525 replaceDomainMapAndImporter(const Teuchos::RCP<const map_type>& newDomainMap,
1526 const Teuchos::RCP<const import_type>& newImporter);
1527
1534 void
1535 replaceRangeMap(const Teuchos::RCP<const map_type>& newRangeMap);
1536
1550 void
1551 replaceRangeMapAndExporter(const Teuchos::RCP<const map_type>& newRangeMap,
1552 const Teuchos::RCP<const export_type>& newExporter);
1553
1582 virtual void
1583 removeEmptyProcessesInPlace(const Teuchos::RCP<const map_type>& newMap) override;
1585
1586 template <class DestViewType, class SrcViewType,
1587 class DestOffsetViewType, class SrcOffsetViewType>
1588 struct pack_functor {
1589 typedef typename DestViewType::execution_space execution_space;
1590 SrcViewType src;
1591 DestViewType dest;
1592 SrcOffsetViewType src_offset;
1593 DestOffsetViewType dest_offset;
1594 typedef typename DestOffsetViewType::non_const_value_type ScalarIndx;
1595
1596 pack_functor(DestViewType dest_,
1597 const SrcViewType src_,
1598 DestOffsetViewType dest_offset_,
1599 const SrcOffsetViewType src_offset_)
1600 : src(src_)
1601 , dest(dest_)
1602 , src_offset(src_offset_)
1603 , dest_offset(dest_offset_){};
1604
1605 KOKKOS_INLINE_FUNCTION
1606 void operator()(size_t row) const {
1607 ScalarIndx i = src_offset(row);
1608 ScalarIndx j = dest_offset(row);
1609 const ScalarIndx k = dest_offset(row + 1);
1610 for (; j < k; j++, i++) {
1611 dest(j) = src(i);
1612 }
1613 }
1614 };
1615
1616 private:
1617 // Friend declaration for nonmember function.
1618 template <class CrsGraphType>
1619 friend Teuchos::RCP<CrsGraphType>
1620 importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1621 const Import<typename CrsGraphType::local_ordinal_type,
1622 typename CrsGraphType::global_ordinal_type,
1623 typename CrsGraphType::node_type>& importer,
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 // Friend declaration for nonmember function.
1633 template <class CrsGraphType>
1634 friend Teuchos::RCP<CrsGraphType>
1635 importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1636 const Import<typename CrsGraphType::local_ordinal_type,
1637 typename CrsGraphType::global_ordinal_type,
1638 typename CrsGraphType::node_type>& rowImporter,
1639 const Import<typename CrsGraphType::local_ordinal_type,
1640 typename CrsGraphType::global_ordinal_type,
1641 typename CrsGraphType::node_type>& domainImporter,
1642 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1643 typename CrsGraphType::global_ordinal_type,
1644 typename CrsGraphType::node_type>>& domainMap,
1645 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1646 typename CrsGraphType::global_ordinal_type,
1647 typename CrsGraphType::node_type>>& rangeMap,
1648 const Teuchos::RCP<Teuchos::ParameterList>& params);
1649
1650 // Friend declaration for nonmember function.
1651 template <class CrsGraphType>
1652 friend Teuchos::RCP<CrsGraphType>
1653 exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1654 const Export<typename CrsGraphType::local_ordinal_type,
1655 typename CrsGraphType::global_ordinal_type,
1656 typename CrsGraphType::node_type>& exporter,
1657 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1658 typename CrsGraphType::global_ordinal_type,
1659 typename CrsGraphType::node_type>>& domainMap,
1660 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1661 typename CrsGraphType::global_ordinal_type,
1662 typename CrsGraphType::node_type>>& rangeMap,
1663 const Teuchos::RCP<Teuchos::ParameterList>& params);
1664
1665 // Friend declaration for nonmember function.
1666 template <class CrsGraphType>
1667 friend Teuchos::RCP<CrsGraphType>
1668 exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1669 const Export<typename CrsGraphType::local_ordinal_type,
1670 typename CrsGraphType::global_ordinal_type,
1671 typename CrsGraphType::node_type>& rowExporter,
1672 const Export<typename CrsGraphType::local_ordinal_type,
1673 typename CrsGraphType::global_ordinal_type,
1674 typename CrsGraphType::node_type>& domainExporter,
1675 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1676 typename CrsGraphType::global_ordinal_type,
1677 typename CrsGraphType::node_type>>& domainMap,
1678 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1679 typename CrsGraphType::global_ordinal_type,
1680 typename CrsGraphType::node_type>>& rangeMap,
1681 const Teuchos::RCP<Teuchos::ParameterList>& params);
1682
1683 // Friend declaration for nonmember function.
1684 template <class LO, class GO, class NT>
1685 friend int
1686 Details::makeColMap(Teuchos::RCP<const Tpetra::Map<LO, GO, NT>>& colMap,
1687 Teuchos::Array<int>& remotePIDs,
1688 const Teuchos::RCP<const Tpetra::Map<LO, GO, NT>>& domMap,
1689 const CrsGraph<LO, GO, NT>& graph,
1690 const bool sortEachProcsGids,
1691 std::ostream* errStrm);
1692
1693 public:
1709 void
1710 importAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1711 const import_type& importer,
1712 const Teuchos::RCP<const map_type>& domainMap,
1713 const Teuchos::RCP<const map_type>& rangeMap,
1714 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1715
1731 void
1732 importAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1733 const import_type& rowImporter,
1734 const import_type& domainImporter,
1735 const Teuchos::RCP<const map_type>& domainMap,
1736 const Teuchos::RCP<const map_type>& rangeMap,
1737 const Teuchos::RCP<Teuchos::ParameterList>& params) const;
1738
1754 void
1755 exportAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1756 const export_type& exporter,
1757 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1758 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1759 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1760
1776 void
1777 exportAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1778 const export_type& rowExporter,
1779 const export_type& domainExporter,
1780 const Teuchos::RCP<const map_type>& domainMap,
1781 const Teuchos::RCP<const map_type>& rangeMap,
1782 const Teuchos::RCP<Teuchos::ParameterList>& params) const;
1783
1784 private:
1805 void
1806 transferAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1807 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, Node>& rowTransfer,
1808 const Teuchos::RCP<const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, Node>>& domainTransfer,
1809 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1810 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1811 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1812
1813 protected:
1814 // these structs are conveniences, to cut down on the number of
1815 // arguments to some of the methods below.
1816 struct SLocalGlobalViews {
1817 Teuchos::ArrayView<const global_ordinal_type> ginds;
1818 Teuchos::ArrayView<const local_ordinal_type> linds;
1819 };
1820 struct SLocalGlobalNCViews {
1821 Teuchos::ArrayView<global_ordinal_type> ginds;
1822 Teuchos::ArrayView<local_ordinal_type> linds;
1823 };
1824
1825 bool indicesAreAllocated() const;
1826
1827 void
1828 allocateIndices(const ELocalGlobal lg, const bool verbose = false);
1829
1831
1832
1842 void makeColMap(Teuchos::Array<int>& remotePIDs);
1843
1864 std::pair<size_t, std::string>
1865 makeIndicesLocal(const bool verbose = false);
1866
1875 void
1876 makeImportExport(Teuchos::Array<int>& remotePIDs,
1877 const bool useRemotePIDs);
1878
1880
1882
1917 size_t
1919 const SLocalGlobalViews& newInds,
1920 const ELocalGlobal lg,
1921 const ELocalGlobal I);
1922
1931 size_t
1933 const global_ordinal_type inputGblColInds[],
1934 const size_t numInputInds);
1935
1946 size_t
1948 const global_ordinal_type inputGblColInds[],
1949 const size_t numInputInds,
1950 std::function<void(const size_t, const size_t, const size_t)> fun =
1951 std::function<void(const size_t, const size_t, const size_t)>());
1952
1953 void
1954 insertLocalIndicesImpl(const local_ordinal_type lclRow,
1955 const Teuchos::ArrayView<const local_ordinal_type>& gblColInds,
1956 std::function<void(const size_t, const size_t, const size_t)> fun =
1957 std::function<void(const size_t, const size_t, const size_t)>());
1958
1974 size_t
1976 const Teuchos::ArrayView<const global_ordinal_type>& indices,
1977 std::function<void(const size_t, const size_t, const size_t)> fun) const;
1978
1990 void
1992 const global_ordinal_type gblColInds[],
1993 const local_ordinal_type numGblColInds);
1994
2006 void
2008 const global_ordinal_type gblColInds[],
2009 const local_ordinal_type numGblColInds);
2010
2015 static const bool useAtomicUpdatesByDefault =
2016#ifdef KOKKOS_ENABLE_SERIAL
2017 !std::is_same<execution_space, Kokkos::Serial>::value;
2018#else
2019 true;
2020#endif // KOKKOS_ENABLE_SERIAL
2021
2023
2025
2027 bool isMerged() const;
2028
2035
2036 private:
2041 void
2042 sortAndMergeAllIndices(const bool sorted, const bool merged);
2043
2044 // mfh 08 May 2017: I only restore "protected" here for backwards
2045 // compatibility.
2046 protected:
2048
2058 void
2059 setDomainRangeMaps(const Teuchos::RCP<const map_type>& domainMap,
2060 const Teuchos::RCP<const map_type>& rangeMap);
2061
2062 void staticAssertions() const;
2063 void clearGlobalConstants();
2064
2065 public:
2068
2087
2088 bool haveLocalOffRankOffsets() const { return haveLocalOffRankOffsets_; }
2089
2090 protected:
2111
2115
2129
2130 public:
2139 local_graph_host_type getLocalGraphHost() const;
2140
2141 protected:
2142 void fillLocalGraph(const Teuchos::RCP<Teuchos::ParameterList>& params);
2143
2146
2150 void swap(CrsGraph<local_ordinal_type, global_ordinal_type, Node>& graph);
2151
2152 // Friend the tester for CrsGraph::swap
2153 friend class Tpetra::crsGraph_Swap_Tester<local_ordinal_type, global_ordinal_type, Node>;
2154
2156 Teuchos::RCP<const map_type> rowMap_;
2158 Teuchos::RCP<const map_type> colMap_;
2160 Teuchos::RCP<const map_type> rangeMap_;
2162 Teuchos::RCP<const map_type> domainMap_;
2163
2170 Teuchos::RCP<const import_type> importer_;
2171
2177 Teuchos::RCP<const export_type> exporter_;
2178
2184 Teuchos::OrdinalTraits<size_t>::invalid();
2185
2190 Teuchos::OrdinalTraits<global_size_t>::invalid();
2191
2197 Teuchos::OrdinalTraits<global_size_t>::invalid();
2198
2199 private:
2200 // Replacement for device view k_rowPtrs_
2201 // Device view rowPtrsUnpacked_dev_ takes place of k_rowPtrs_
2202 // Host view rowPtrsUnpacked_host_ takes place of copies and use of getEntryOnHost
2203 // Wish this could be a WrappedDualView, but deep_copies in DualView
2204 // don't work with const data views (e.g., StaticCrsGraph::row_map)
2205 // k_rowPtrs_ is offsets wrt the ALLOCATED indices array, not necessarily
2206 // the ACTUAL compressed indices array.
2207 // When !OptimizedStorage, k_rowPtrs_ may differ from ACTUAL compressed
2208 // indices array. (Karen is skeptical that !OptimizedStorage works)
2209 // When OptimizedStorage, rowPtrsUnpacked_ = k_rowPtrsPacked_
2210
2211 row_ptrs_device_view_type rowPtrsUnpacked_dev_;
2212 mutable row_ptrs_host_view_type rowPtrsUnpacked_host_;
2213
2214 // Row offsets into the actual graph local indices
2215 // Device view rowPtrsUnpacked_dev_ takes place of lclGraph_.row_map
2216
2217 row_ptrs_device_view_type rowPtrsPacked_dev_;
2218 mutable row_ptrs_host_view_type rowPtrsPacked_host_;
2219
2221 bool packedUnpackedRowPtrsMatch_ = false;
2222
2223 protected:
2224 void setRowPtrsUnpacked(const row_ptrs_device_view_type& dview) {
2225 packedUnpackedRowPtrsMatch_ = false;
2226 rowPtrsUnpacked_dev_ = dview;
2227 // Make sure stale host rowptrs are not kept
2228 rowPtrsUnpacked_host_ = row_ptrs_host_view_type();
2229 }
2230
2232 const row_ptrs_device_view_type& getRowPtrsUnpackedDevice() const {
2233 return rowPtrsUnpacked_dev_;
2234 }
2235
2237 const row_ptrs_host_view_type& getRowPtrsUnpackedHost() const {
2238 if (rowPtrsUnpacked_host_.extent(0) != rowPtrsUnpacked_dev_.extent(0)) {
2239 // NOTE: not just using create_mirror_view here, because
2240 // we do want host/device to be in different memory, even if we're using a SharedSpace.
2241 // This is so that reads will never trigger a host-device transfer.
2242 // The exception is when 'device' views are HostSpace, then don't make another copy.
2243 if constexpr (std::is_same_v<typename Node::memory_space, Kokkos::HostSpace>) {
2244 rowPtrsUnpacked_host_ = rowPtrsUnpacked_dev_;
2245 } else {
2246 // Have to make this temporary because rowptrs are const-valued
2247 typename row_ptrs_host_view_type::non_const_type rowPtrsTemp(
2248 Kokkos::view_alloc(Kokkos::WithoutInitializing, "rowPtrsUnpacked_host_"), rowPtrsUnpacked_dev_.extent(0));
2249 Kokkos::deep_copy(rowPtrsTemp, rowPtrsUnpacked_dev_);
2250 rowPtrsUnpacked_host_ = rowPtrsTemp;
2251 }
2252 // Also keep packed/unpacked views in sync, if they are known to have the same contents
2253 if (packedUnpackedRowPtrsMatch_) {
2254 rowPtrsPacked_host_ = rowPtrsUnpacked_host_;
2255 }
2256 }
2257 return rowPtrsUnpacked_host_;
2258 }
2259
2260 void setRowPtrsPacked(const row_ptrs_device_view_type& dview) {
2261 packedUnpackedRowPtrsMatch_ = false;
2262 rowPtrsPacked_dev_ = dview;
2263 // Make sure stale host rowptrs are not kept
2264 rowPtrsPacked_host_ = row_ptrs_host_view_type();
2265 }
2266
2268 const row_ptrs_device_view_type& getRowPtrsPackedDevice() const {
2269 return rowPtrsPacked_dev_;
2270 }
2271
2273 const row_ptrs_host_view_type& getRowPtrsPackedHost() const {
2274 if (rowPtrsPacked_host_.extent(0) != rowPtrsPacked_dev_.extent(0)) {
2275 // NOTE: not just using create_mirror_view here, because
2276 // we do want host/device to be in different memory, even if we're using a SharedSpace.
2277 // This is so that reads will never trigger a host-device transfer.
2278 // The exception is when 'device' views are HostSpace, then don't make another copy.
2279 if constexpr (std::is_same_v<typename Node::memory_space, Kokkos::HostSpace>) {
2280 rowPtrsPacked_host_ = rowPtrsPacked_dev_;
2281 } else {
2282 // Have to make this temporary because rowptrs are const-valued
2283 typename row_ptrs_host_view_type::non_const_type rowPtrsTemp(
2284 Kokkos::view_alloc(Kokkos::WithoutInitializing, "rowPtrsPacked_host_"), rowPtrsPacked_dev_.extent(0));
2285 Kokkos::deep_copy(rowPtrsTemp, rowPtrsPacked_dev_);
2286 rowPtrsPacked_host_ = rowPtrsTemp;
2287 }
2288 // Also keep packed/unpacked views in sync, if they are known to have the same contents
2289 if (packedUnpackedRowPtrsMatch_) {
2290 rowPtrsUnpacked_host_ = rowPtrsPacked_host_;
2291 }
2292 }
2293 return rowPtrsPacked_host_;
2294 }
2295
2296 // There are common cases where both packed and unpacked views are set to the same array.
2297 // Doing this in a single call can reduce dataspace on host, and reduce runtime by
2298 // removing a deep_copy from device to host.
2299
2300 void setRowPtrs(const row_ptrs_device_view_type& dview) {
2301 packedUnpackedRowPtrsMatch_ = true;
2302 rowPtrsUnpacked_dev_ = dview;
2303 rowPtrsPacked_dev_ = dview;
2304 // Make sure stale host rowptrs are not kept
2305 rowPtrsUnpacked_host_ = row_ptrs_host_view_type();
2306 rowPtrsPacked_host_ = row_ptrs_host_view_type();
2307 }
2308
2309 // TODO: Make private -- matrix shouldn't access directly the guts of graph
2310
2324 local_inds_wdv_type lclIndsUnpacked_wdv;
2325
2339 mutable local_inds_wdv_type lclIndsPacked_wdv;
2340
2341 // TODO: Make private -- matrix shouldn't access directly the guts of graph
2342
2352
2353 // TODO: Make private -- matrix shouldn't access directly
2354 global_inds_wdv_type gblInds_wdv;
2355
2359 typename local_inds_dualv_type::t_host::const_type
2360 getLocalIndsViewHost(const RowInfo& rowinfo) const;
2361
2365 typename local_inds_dualv_type::t_dev::const_type
2366 getLocalIndsViewDevice(const RowInfo& rowinfo) const;
2367
2371 typename global_inds_dualv_type::t_host::const_type
2372 getGlobalIndsViewHost(const RowInfo& rowinfo) const;
2373
2377 typename global_inds_dualv_type::t_dev::const_type
2378 getGlobalIndsViewDevice(const RowInfo& rowinfo) const;
2379
2383 typename local_inds_dualv_type::t_host
2385
2386 // FOR NOW...
2387 // KEEP k_numRowEntries_ (though switch from host_mirror_type to Host)
2388 // KEEP k_numAllocPerRow_ (though perhaps switch from host_mirror_type to Host)
2389
2415 typename Kokkos::View<const size_t*, device_type>::host_mirror_type
2417
2428
2430
2431
2453
2461 typedef typename Kokkos::View<size_t*, Kokkos::LayoutLeft, device_type>::host_mirror_type num_row_entries_type;
2462
2463 // typedef Kokkos::View<
2464 // size_t*,
2465 // Kokkos::LayoutLeft,
2466 // Kokkos::Device<
2467 // typename Kokkos::View<
2468 // size_t*,
2469 // Kokkos::LayoutLeft,
2470 // device_type>::host_mirror_type::execution_space,
2471 // Kokkos::HostSpace> > num_row_entries_type;
2472
2480
2486 mutable offset_device_view_type k_offRankOffsets_;
2487
2489
2500 Details::STORAGE_1D_UNPACKED;
2501
2502 bool indicesAreAllocated_ = false;
2503 bool indicesAreLocal_ = false;
2504 bool indicesAreGlobal_ = false;
2505 bool fillComplete_ = false;
2506
2511 bool noRedundancies_ = true;
2517 mutable bool haveLocalOffRankOffsets_ = false;
2518
2519 typedef typename std::map<global_ordinal_type, std::vector<global_ordinal_type>> nonlocals_type;
2520
2522 nonlocals_type nonlocals_;
2523
2539
2540 private:
2542 static bool getDebug();
2543
2546 bool debug_ = getDebug();
2547
2549 static bool getVerbose();
2550
2554 bool verbose_ = getVerbose();
2555
2556 private:
2558 mutable bool need_sync_host_uvm_access = false;
2559
2561 void set_need_sync_host_uvm_access() {
2562 need_sync_host_uvm_access = true;
2563 }
2564
2566 void execute_sync_host_uvm_access() const {
2567 if (need_sync_host_uvm_access) {
2568 Kokkos::fence("CrsGraph::execute_sync_host_uvm_access");
2569 need_sync_host_uvm_access = false;
2570 }
2571 }
2572}; // class CrsGraph
2573
2581template <class LocalOrdinal, class GlobalOrdinal, class Node>
2582Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
2584 const Teuchos::RCP<
2586 size_t maxNumEntriesPerRow = 0,
2587 const Teuchos::RCP<Teuchos::ParameterList>& params =
2588 Teuchos::null) {
2589 using Teuchos::rcp;
2590 using graph_type = CrsGraph<LocalOrdinal, GlobalOrdinal, Node>;
2591 return rcp(new graph_type(map, maxNumEntriesPerRow,
2592 params));
2593}
2594
2644template <class CrsGraphType>
2645Teuchos::RCP<CrsGraphType>
2646importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2647 const Import<typename CrsGraphType::local_ordinal_type,
2648 typename CrsGraphType::global_ordinal_type,
2649 typename CrsGraphType::node_type>& importer,
2650 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2651 typename CrsGraphType::global_ordinal_type,
2652 typename CrsGraphType::node_type>>& domainMap = Teuchos::null,
2653 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2654 typename CrsGraphType::global_ordinal_type,
2655 typename CrsGraphType::node_type>>& rangeMap = Teuchos::null,
2656 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
2657 Teuchos::RCP<CrsGraphType> destGraph;
2658 sourceGraph->importAndFillComplete(destGraph, importer, domainMap, rangeMap, params);
2659 return destGraph;
2660}
2661
2712template <class CrsGraphType>
2713Teuchos::RCP<CrsGraphType>
2714importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2715 const Import<typename CrsGraphType::local_ordinal_type,
2716 typename CrsGraphType::global_ordinal_type,
2717 typename CrsGraphType::node_type>& rowImporter,
2718 const Import<typename CrsGraphType::local_ordinal_type,
2719 typename CrsGraphType::global_ordinal_type,
2720 typename CrsGraphType::node_type>& domainImporter,
2721 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2722 typename CrsGraphType::global_ordinal_type,
2723 typename CrsGraphType::node_type>>& domainMap,
2724 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2725 typename CrsGraphType::global_ordinal_type,
2726 typename CrsGraphType::node_type>>& rangeMap,
2727 const Teuchos::RCP<Teuchos::ParameterList>& params) {
2728 Teuchos::RCP<CrsGraphType> destGraph;
2729 sourceGraph->importAndFillComplete(destGraph, rowImporter, domainImporter, domainMap, rangeMap, params);
2730 return destGraph;
2731}
2732
2766template <class CrsGraphType>
2767Teuchos::RCP<CrsGraphType>
2768exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2769 const Export<typename CrsGraphType::local_ordinal_type,
2770 typename CrsGraphType::global_ordinal_type,
2771 typename CrsGraphType::node_type>& exporter,
2772 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2773 typename CrsGraphType::global_ordinal_type,
2774 typename CrsGraphType::node_type>>& domainMap = Teuchos::null,
2775 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2776 typename CrsGraphType::global_ordinal_type,
2777 typename CrsGraphType::node_type>>& rangeMap = Teuchos::null,
2778 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
2779 Teuchos::RCP<CrsGraphType> destGraph;
2780 sourceGraph->exportAndFillComplete(destGraph, exporter, domainMap, rangeMap, params);
2781 return destGraph;
2782}
2783
2817template <class CrsGraphType>
2818Teuchos::RCP<CrsGraphType>
2819exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2820 const Export<typename CrsGraphType::local_ordinal_type,
2821 typename CrsGraphType::global_ordinal_type,
2822 typename CrsGraphType::node_type>& rowExporter,
2823 const Export<typename CrsGraphType::local_ordinal_type,
2824 typename CrsGraphType::global_ordinal_type,
2825 typename CrsGraphType::node_type>& domainExporter,
2826 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2827 typename CrsGraphType::global_ordinal_type,
2828 typename CrsGraphType::node_type>>& domainMap,
2829 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2830 typename CrsGraphType::global_ordinal_type,
2831 typename CrsGraphType::node_type>>& rangeMap,
2832 const Teuchos::RCP<Teuchos::ParameterList>& params) {
2833 Teuchos::RCP<CrsGraphType> destGraph;
2834 sourceGraph->exportAndFillComplete(destGraph, rowExporter, domainExporter, domainMap, rangeMap, params);
2835 return destGraph;
2836}
2837
2838} // namespace Tpetra
2839
2840#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.
CrsGraph(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 CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &originalGraph, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying maps and an existing graph to view.
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
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &originalGraph, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying row and column Map and an existing graph to view.
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...
Kokkos::View< size_t *, Kokkos::LayoutLeft, device_type >::host_mirror_type num_row_entries_type
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).
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.
KokkosSparse::StaticCrsGraph< local_ordinal_type, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_device_type
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.
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=Teuchos::null)
Constructor specifying column Map and a local graph, which the resulting CrsGraph views....
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).
typename row_graph_type::global_inds_device_view_type global_inds_device_view_type
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.
typename local_graph_device_type::host_mirror_type local_graph_host_type
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.
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...
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 row Map and an existing graph to subview. The graph created will point to the ...
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 getLocalRowCopy(local_ordinal_type lclRow, nonconst_local_inds_host_view_type &lclColInds, size_t &numColInds) const override
Get a copy of the given row, using local indices.
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.
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.
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.
Kokkos::View< constsize_t *, device_type >::host_mirror_type k_numAllocPerRow_
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.
CrsGraph & operator=(CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &&)=default
Move assignment (default).
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,...
typename row_graph_type::local_inds_device_view_type local_inds_device_view_type
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.
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.
int makeColMap(Teuchos::RCP< const Tpetra::Map< LO, GO, NT > > &colMap, Teuchos::Array< int > &remotePIDs, const Teuchos::RCP< const Tpetra::Map< LO, GO, NT > > &domMap, const CrsGraph< LO, GO, NT > &graph, const bool sortEachProcsGids=true, std::ostream *errStrm=NULL)
Make the graph's column Map.
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.