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
436 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
437 const Teuchos::RCP<const map_type>& colMap,
438 const Teuchos::RCP<const map_type>& domainMap,
439 const Teuchos::RCP<const map_type>& rangeMap,
440 const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>& originalGraph,
441 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
442
465 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
466 const Teuchos::RCP<const map_type>& colMap,
467 const typename local_graph_device_type::row_map_type& rowPointers,
468 const typename local_graph_device_type::entries_type::non_const_type& columnIndices,
469 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
470
493 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
494 const Teuchos::RCP<const map_type>& colMap,
495 const Teuchos::ArrayRCP<size_t>& rowPointers,
496 const Teuchos::ArrayRCP<local_ordinal_type>& columnIndices,
497 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
498
520 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
521 const Teuchos::RCP<const map_type>& colMap,
522 const local_graph_device_type& lclGraph,
523 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
524
552 const Teuchos::RCP<const map_type>& rowMap,
553 const Teuchos::RCP<const map_type>& colMap,
554 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
555 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
556 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
557
570 const Teuchos::RCP<const map_type>& rowMap,
571 const Teuchos::RCP<const map_type>& colMap,
572 const Teuchos::RCP<const map_type>& domainMap,
573 const Teuchos::RCP<const map_type>& rangeMap,
574 const Teuchos::RCP<const import_type>& importer,
575 const Teuchos::RCP<const export_type>& exporter,
576 const Teuchos::RCP<Teuchos::ParameterList>& params =
577 Teuchos::null);
578
620 CrsGraph(const row_ptrs_device_view_type& rowPointers,
621 const local_inds_wdv_type& columnIndices,
622 const Teuchos::RCP<const map_type>& rowMap,
623 const Teuchos::RCP<const map_type>& colMap,
624 const Teuchos::RCP<const map_type>& domainMap,
625 const Teuchos::RCP<const map_type>& rangeMap,
626 const Teuchos::RCP<const import_type>& importer,
627 const Teuchos::RCP<const export_type>& exporter,
628 const Teuchos::RCP<Teuchos::ParameterList>& params =
629 Teuchos::null);
630
632 CrsGraph(const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&) = default;
633
635 CrsGraph& operator=(const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&) = default;
636
638 CrsGraph(CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&&) = default;
639
641 CrsGraph& operator=(CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&&) = default;
642
652 virtual ~CrsGraph() = default;
653
681
698 bool isIdenticalTo(const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>& graph) const;
699
701
703
705 void
706 setParameterList(const Teuchos::RCP<Teuchos::ParameterList>& params) override;
707
709 Teuchos::RCP<const Teuchos::ParameterList>
710 getValidParameters() const override;
711
713
715
737 void
739 const Teuchos::ArrayView<const global_ordinal_type>& indices);
740
747 void
749 const local_ordinal_type numEnt,
750 const global_ordinal_type inds[]);
751
753
767 void
769 const Teuchos::ArrayView<const local_ordinal_type>& indices);
770
777 void
779 const local_ordinal_type numEnt,
780 const local_ordinal_type inds[]);
781
783
793
795
797
806
825 void
826 resumeFill(const Teuchos::RCP<Teuchos::ParameterList>& params =
827 Teuchos::null);
828
866 void
867 fillComplete(const Teuchos::RCP<const map_type>& domainMap,
868 const Teuchos::RCP<const map_type>& rangeMap,
869 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
870
898 void
899 fillComplete(const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
900
929 void
930 expertStaticFillComplete(const Teuchos::RCP<const map_type>& domainMap,
931 const Teuchos::RCP<const map_type>& rangeMap,
932 const Teuchos::RCP<const import_type>& importer =
933 Teuchos::null,
934 const Teuchos::RCP<const export_type>& exporter =
935 Teuchos::null,
936 const Teuchos::RCP<Teuchos::ParameterList>& params =
937 Teuchos::null);
939
941
943 Teuchos::RCP<const Teuchos::Comm<int>> getComm() const override;
944
946 Teuchos::RCP<const map_type> getRowMap() const override;
947
949 Teuchos::RCP<const map_type> getColMap() const override;
950
952 Teuchos::RCP<const map_type> getDomainMap() const override;
953
955 Teuchos::RCP<const map_type> getRangeMap() const override;
956
958 Teuchos::RCP<const import_type> getImporter() const override;
959
961 Teuchos::RCP<const export_type> getExporter() const override;
962
964
967
969
973
975 size_t getLocalNumRows() const override;
976
978
980 size_t getLocalNumCols() const override;
981
984
986
989
999 size_t getLocalNumEntries() const override;
1000
1002
1003 size_t
1005
1012 size_t
1014
1035
1044
1053
1067 size_t getGlobalMaxNumRowEntries() const override;
1068
1073 size_t getLocalMaxNumRowEntries() const override;
1074
1090 bool hasColMap() const override;
1091
1099 bool isLocallyIndexed() const override;
1100
1108 bool isGloballyIndexed() const override;
1109
1111 bool isFillComplete() const override;
1112
1114 bool isFillActive() const;
1115
1123 bool isSorted() const;
1124
1126
1133
1139 void
1141 nonconst_global_inds_host_view_type& gblColInds,
1142 size_t& numColInds) const override;
1143
1151 void
1153 nonconst_local_inds_host_view_type& lclColInds,
1154 size_t& numColInds) const override;
1155
1166 void
1168 const global_ordinal_type gblRow,
1169 global_inds_host_view_type& gblColInds) const override;
1170
1173 bool supportsRowViews() const override;
1174
1185 void
1187 const LocalOrdinal lclRow,
1188 local_inds_host_view_type& lclColInds) const override;
1189
1191
1193
1195 std::string description() const override;
1196
1199 void
1200 describe(Teuchos::FancyOStream& out,
1201 const Teuchos::EVerbosityLevel verbLevel =
1202 Teuchos::Describable::verbLevel_default) const override;
1203
1205
1207
1215
1216 virtual bool
1217 checkSizes(const SrcDistObject& source) override;
1218
1219 using dist_object_type::
1220 copyAndPermute;
1222
1223 virtual void
1225 const size_t numSameIDs,
1226 const Kokkos::DualView<const local_ordinal_type*,
1227 buffer_device_type>& permuteToLIDs,
1228 const Kokkos::DualView<const local_ordinal_type*,
1229 buffer_device_type>& permuteFromLIDs,
1230 const CombineMode CM) override;
1231
1232 void copyAndPermuteNew(
1233 const row_graph_type& source,
1234 row_graph_type& target,
1235 const size_t numSameIDs,
1236 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteToLIDs,
1237 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteFromLIDs,
1238 const CombineMode CM);
1239
1240 void insertGlobalIndicesDevice(
1241 const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>& srcCrsGraph,
1242 CrsGraph<LocalOrdinal, GlobalOrdinal, Node>& tgtCrsGraph,
1243 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteToLIDs,
1244 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteFromLIDs,
1245 LocalOrdinal loopEnd);
1246
1247 using padding_type = Details::CrsPadding<
1249
1250 void
1251 applyCrsPadding(const padding_type& padding,
1252 const bool verbose);
1253
1254 std::unique_ptr<padding_type>
1255 computeCrsPadding(
1257 node_type>& source,
1258 const size_t numSameIDs,
1259 const Kokkos::DualView<const local_ordinal_type*,
1260 buffer_device_type>& permuteToLIDs,
1261 const Kokkos::DualView<const local_ordinal_type*,
1262 buffer_device_type>& permuteFromLIDs,
1263 const bool verbose) const;
1264
1265 // This actually modifies imports by sorting it.
1266 std::unique_ptr<padding_type>
1267 computeCrsPaddingForImports(
1268 const Kokkos::DualView<const local_ordinal_type*,
1269 buffer_device_type>& importLIDs,
1270 Kokkos::DualView<packet_type*, buffer_device_type> imports,
1271 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1272 const bool verbose) const;
1273
1274 std::unique_ptr<padding_type>
1275 computePaddingForCrsMatrixUnpack(
1276 const Kokkos::DualView<const local_ordinal_type*,
1277 buffer_device_type>& importLIDs,
1278 Kokkos::DualView<char*, buffer_device_type> imports,
1279 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1280 const bool verbose) const;
1281
1282 void
1283 computeCrsPaddingForSameIDs(
1284 padding_type& padding,
1286 node_type>& source,
1287 const local_ordinal_type numSameIDs) const;
1288
1289 void
1290 computeCrsPaddingForPermutedIDs(
1291 padding_type& padding,
1293 node_type>& source,
1294 const Kokkos::DualView<const local_ordinal_type*,
1295 buffer_device_type>& permuteToLIDs,
1296 const Kokkos::DualView<const local_ordinal_type*,
1297 buffer_device_type>& permuteFromLIDs) const;
1298
1299 virtual void
1300 packAndPrepare(
1301 const SrcDistObject& source,
1302 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& exportLIDs,
1303 Kokkos::DualView<packet_type*, buffer_device_type>& exports,
1304 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1305 size_t& constantNumPackets) override;
1306
1311
1312 virtual void
1313 pack(const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1314 Teuchos::Array<global_ordinal_type>& exports,
1315 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1316 size_t& constantNumPackets) const override;
1317
1318 void
1319 packFillActive(const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1320 Teuchos::Array<global_ordinal_type>& exports,
1321 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1322 size_t& constantNumPackets) const;
1323
1324 void
1325 packFillActiveNew(const Kokkos::DualView<const local_ordinal_type*,
1326 buffer_device_type>& exportLIDs,
1327 Kokkos::DualView<packet_type*,
1328 buffer_device_type>& exports,
1329 Kokkos::DualView<size_t*,
1331 numPacketsPerLID,
1332 size_t& constantNumPackets) const;
1333
1338
1339 virtual void
1340 unpackAndCombine(const Kokkos::DualView<const local_ordinal_type*,
1341 buffer_device_type>& importLIDs,
1342 Kokkos::DualView<packet_type*,
1344 imports,
1345 Kokkos::DualView<size_t*,
1347 numPacketsPerLID,
1348 const size_t constantNumPackets,
1349 const CombineMode combineMode) override;
1350
1352
1354
1397 void
1398 getLocalDiagOffsets(const Kokkos::View<size_t*, device_type, Kokkos::MemoryUnmanaged>& offsets) const;
1399
1401 void
1402 getLocalOffRankOffsets(offset_device_view_type& offsets) const;
1403
1413 void
1414 getLocalDiagOffsets(Teuchos::ArrayRCP<size_t>& offsets) const;
1415
1425 void
1426 setAllIndices(const typename local_graph_device_type::row_map_type& rowPointers,
1427 const typename local_graph_device_type::entries_type::non_const_type& columnIndices);
1428
1438 void
1439 setAllIndices(const Teuchos::ArrayRCP<size_t>& rowPointers,
1440 const Teuchos::ArrayRCP<local_ordinal_type>& columnIndices);
1441
1444 row_ptrs_host_view_type getLocalRowPtrsHost() const;
1445
1448 row_ptrs_device_view_type getLocalRowPtrsDevice() const;
1449
1451 local_inds_host_view_type getLocalIndicesHost() const;
1452
1455
1474 void replaceColMap(const Teuchos::RCP<const map_type>& newColMap);
1475
1495 void
1496 reindexColumns(const Teuchos::RCP<const map_type>& newColMap,
1497 const Teuchos::RCP<const import_type>& newImport = Teuchos::null,
1498 const bool sortIndicesInEachRow = true);
1499
1506 void
1507 replaceDomainMap(const Teuchos::RCP<const map_type>& newDomainMap);
1508
1522 void
1523 replaceDomainMapAndImporter(const Teuchos::RCP<const map_type>& newDomainMap,
1524 const Teuchos::RCP<const import_type>& newImporter);
1525
1532 void
1533 replaceRangeMap(const Teuchos::RCP<const map_type>& newRangeMap);
1534
1548 void
1549 replaceRangeMapAndExporter(const Teuchos::RCP<const map_type>& newRangeMap,
1550 const Teuchos::RCP<const export_type>& newExporter);
1551
1580 virtual void
1581 removeEmptyProcessesInPlace(const Teuchos::RCP<const map_type>& newMap) override;
1583
1584 template <class DestViewType, class SrcViewType,
1585 class DestOffsetViewType, class SrcOffsetViewType>
1586 struct pack_functor {
1587 typedef typename DestViewType::execution_space execution_space;
1588 SrcViewType src;
1589 DestViewType dest;
1590 SrcOffsetViewType src_offset;
1591 DestOffsetViewType dest_offset;
1592 typedef typename DestOffsetViewType::non_const_value_type ScalarIndx;
1593
1594 pack_functor(DestViewType dest_,
1595 const SrcViewType src_,
1596 DestOffsetViewType dest_offset_,
1597 const SrcOffsetViewType src_offset_)
1598 : src(src_)
1599 , dest(dest_)
1600 , src_offset(src_offset_)
1601 , dest_offset(dest_offset_){};
1602
1603 KOKKOS_INLINE_FUNCTION
1604 void operator()(size_t row) const {
1605 ScalarIndx i = src_offset(row);
1606 ScalarIndx j = dest_offset(row);
1607 const ScalarIndx k = dest_offset(row + 1);
1608 for (; j < k; j++, i++) {
1609 dest(j) = src(i);
1610 }
1611 }
1612 };
1613
1614 private:
1615 // Friend declaration for nonmember function.
1616 template <class CrsGraphType>
1617 friend Teuchos::RCP<CrsGraphType>
1618 importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1619 const Import<typename CrsGraphType::local_ordinal_type,
1620 typename CrsGraphType::global_ordinal_type,
1621 typename CrsGraphType::node_type>& importer,
1622 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1623 typename CrsGraphType::global_ordinal_type,
1624 typename CrsGraphType::node_type>>& domainMap,
1625 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1626 typename CrsGraphType::global_ordinal_type,
1627 typename CrsGraphType::node_type>>& rangeMap,
1628 const Teuchos::RCP<Teuchos::ParameterList>& params);
1629
1630 // Friend declaration for nonmember function.
1631 template <class CrsGraphType>
1632 friend Teuchos::RCP<CrsGraphType>
1633 importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1634 const Import<typename CrsGraphType::local_ordinal_type,
1635 typename CrsGraphType::global_ordinal_type,
1636 typename CrsGraphType::node_type>& rowImporter,
1637 const Import<typename CrsGraphType::local_ordinal_type,
1638 typename CrsGraphType::global_ordinal_type,
1639 typename CrsGraphType::node_type>& domainImporter,
1640 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1641 typename CrsGraphType::global_ordinal_type,
1642 typename CrsGraphType::node_type>>& domainMap,
1643 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1644 typename CrsGraphType::global_ordinal_type,
1645 typename CrsGraphType::node_type>>& rangeMap,
1646 const Teuchos::RCP<Teuchos::ParameterList>& params);
1647
1648 // Friend declaration for nonmember function.
1649 template <class CrsGraphType>
1650 friend Teuchos::RCP<CrsGraphType>
1651 exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1652 const Export<typename CrsGraphType::local_ordinal_type,
1653 typename CrsGraphType::global_ordinal_type,
1654 typename CrsGraphType::node_type>& exporter,
1655 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1656 typename CrsGraphType::global_ordinal_type,
1657 typename CrsGraphType::node_type>>& domainMap,
1658 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1659 typename CrsGraphType::global_ordinal_type,
1660 typename CrsGraphType::node_type>>& rangeMap,
1661 const Teuchos::RCP<Teuchos::ParameterList>& params);
1662
1663 // Friend declaration for nonmember function.
1664 template <class CrsGraphType>
1665 friend Teuchos::RCP<CrsGraphType>
1666 exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1667 const Export<typename CrsGraphType::local_ordinal_type,
1668 typename CrsGraphType::global_ordinal_type,
1669 typename CrsGraphType::node_type>& rowExporter,
1670 const Export<typename CrsGraphType::local_ordinal_type,
1671 typename CrsGraphType::global_ordinal_type,
1672 typename CrsGraphType::node_type>& domainExporter,
1673 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1674 typename CrsGraphType::global_ordinal_type,
1675 typename CrsGraphType::node_type>>& domainMap,
1676 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1677 typename CrsGraphType::global_ordinal_type,
1678 typename CrsGraphType::node_type>>& rangeMap,
1679 const Teuchos::RCP<Teuchos::ParameterList>& params);
1680
1681 // Friend declaration for nonmember function.
1682 template <class LO, class GO, class NT>
1683 friend int
1684 Details::makeColMap(Teuchos::RCP<const Tpetra::Map<LO, GO, NT>>& colMap,
1685 Teuchos::Array<int>& remotePIDs,
1686 const Teuchos::RCP<const Tpetra::Map<LO, GO, NT>>& domMap,
1687 const CrsGraph<LO, GO, NT>& graph,
1688 const bool sortEachProcsGids,
1689 std::ostream* errStrm);
1690
1691 public:
1707 void
1708 importAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1709 const import_type& importer,
1710 const Teuchos::RCP<const map_type>& domainMap,
1711 const Teuchos::RCP<const map_type>& rangeMap,
1712 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1713
1729 void
1730 importAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1731 const import_type& rowImporter,
1732 const import_type& domainImporter,
1733 const Teuchos::RCP<const map_type>& domainMap,
1734 const Teuchos::RCP<const map_type>& rangeMap,
1735 const Teuchos::RCP<Teuchos::ParameterList>& params) const;
1736
1752 void
1753 exportAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1754 const export_type& exporter,
1755 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1756 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1757 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1758
1774 void
1775 exportAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1776 const export_type& rowExporter,
1777 const export_type& domainExporter,
1778 const Teuchos::RCP<const map_type>& domainMap,
1779 const Teuchos::RCP<const map_type>& rangeMap,
1780 const Teuchos::RCP<Teuchos::ParameterList>& params) const;
1781
1782 private:
1803 void
1804 transferAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1805 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, Node>& rowTransfer,
1806 const Teuchos::RCP<const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, Node>>& domainTransfer,
1807 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1808 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1809 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1810
1811 protected:
1812 // these structs are conveniences, to cut down on the number of
1813 // arguments to some of the methods below.
1814 struct SLocalGlobalViews {
1815 Teuchos::ArrayView<const global_ordinal_type> ginds;
1816 Teuchos::ArrayView<const local_ordinal_type> linds;
1817 };
1818 struct SLocalGlobalNCViews {
1819 Teuchos::ArrayView<global_ordinal_type> ginds;
1820 Teuchos::ArrayView<local_ordinal_type> linds;
1821 };
1822
1823 bool indicesAreAllocated() const;
1824
1825 void
1826 allocateIndices(const ELocalGlobal lg, const bool verbose = false);
1827
1829
1830
1840 void makeColMap(Teuchos::Array<int>& remotePIDs);
1841
1862 std::pair<size_t, std::string>
1863 makeIndicesLocal(const bool verbose = false);
1864
1873 void
1874 makeImportExport(Teuchos::Array<int>& remotePIDs,
1875 const bool useRemotePIDs);
1876
1878
1880
1915 size_t
1917 const SLocalGlobalViews& newInds,
1918 const ELocalGlobal lg,
1919 const ELocalGlobal I);
1920
1929 size_t
1931 const global_ordinal_type inputGblColInds[],
1932 const size_t numInputInds);
1933
1944 size_t
1946 const global_ordinal_type inputGblColInds[],
1947 const size_t numInputInds,
1948 std::function<void(const size_t, const size_t, const size_t)> fun =
1949 std::function<void(const size_t, const size_t, const size_t)>());
1950
1951 void
1952 insertLocalIndicesImpl(const local_ordinal_type lclRow,
1953 const Teuchos::ArrayView<const local_ordinal_type>& gblColInds,
1954 std::function<void(const size_t, const size_t, const size_t)> fun =
1955 std::function<void(const size_t, const size_t, const size_t)>());
1956
1972 size_t
1974 const Teuchos::ArrayView<const global_ordinal_type>& indices,
1975 std::function<void(const size_t, const size_t, const size_t)> fun) const;
1976
1988 void
1990 const global_ordinal_type gblColInds[],
1991 const local_ordinal_type numGblColInds);
1992
2004 void
2006 const global_ordinal_type gblColInds[],
2007 const local_ordinal_type numGblColInds);
2008
2013 static const bool useAtomicUpdatesByDefault =
2014#ifdef KOKKOS_ENABLE_SERIAL
2015 !std::is_same<execution_space, Kokkos::Serial>::value;
2016#else
2017 true;
2018#endif // KOKKOS_ENABLE_SERIAL
2019
2021
2023
2025 bool isMerged() const;
2026
2033
2034 private:
2039 void
2040 sortAndMergeAllIndices(const bool sorted, const bool merged);
2041
2042 // mfh 08 May 2017: I only restore "protected" here for backwards
2043 // compatibility.
2044 protected:
2046
2056 void
2057 setDomainRangeMaps(const Teuchos::RCP<const map_type>& domainMap,
2058 const Teuchos::RCP<const map_type>& rangeMap);
2059
2060 void staticAssertions() const;
2061 void clearGlobalConstants();
2062
2063 public:
2066
2085
2086 bool haveLocalOffRankOffsets() const { return haveLocalOffRankOffsets_; }
2087
2088 protected:
2109
2113
2127
2128 public:
2137 local_graph_host_type getLocalGraphHost() const;
2138
2139 protected:
2140 void fillLocalGraph(const Teuchos::RCP<Teuchos::ParameterList>& params);
2141
2144
2148 void swap(CrsGraph<local_ordinal_type, global_ordinal_type, Node>& graph);
2149
2150 // Friend the tester for CrsGraph::swap
2151 friend class Tpetra::crsGraph_Swap_Tester<local_ordinal_type, global_ordinal_type, Node>;
2152
2154 Teuchos::RCP<const map_type> rowMap_;
2156 Teuchos::RCP<const map_type> colMap_;
2158 Teuchos::RCP<const map_type> rangeMap_;
2160 Teuchos::RCP<const map_type> domainMap_;
2161
2168 Teuchos::RCP<const import_type> importer_;
2169
2175 Teuchos::RCP<const export_type> exporter_;
2176
2182 Teuchos::OrdinalTraits<size_t>::invalid();
2183
2188 Teuchos::OrdinalTraits<global_size_t>::invalid();
2189
2195 Teuchos::OrdinalTraits<global_size_t>::invalid();
2196
2197 private:
2198 // Replacement for device view k_rowPtrs_
2199 // Device view rowPtrsUnpacked_dev_ takes place of k_rowPtrs_
2200 // Host view rowPtrsUnpacked_host_ takes place of copies and use of getEntryOnHost
2201 // Wish this could be a WrappedDualView, but deep_copies in DualView
2202 // don't work with const data views (e.g., StaticCrsGraph::row_map)
2203 // k_rowPtrs_ is offsets wrt the ALLOCATED indices array, not necessarily
2204 // the ACTUAL compressed indices array.
2205 // When !OptimizedStorage, k_rowPtrs_ may differ from ACTUAL compressed
2206 // indices array. (Karen is skeptical that !OptimizedStorage works)
2207 // When OptimizedStorage, rowPtrsUnpacked_ = k_rowPtrsPacked_
2208
2209 row_ptrs_device_view_type rowPtrsUnpacked_dev_;
2210 mutable row_ptrs_host_view_type rowPtrsUnpacked_host_;
2211
2212 // Row offsets into the actual graph local indices
2213 // Device view rowPtrsUnpacked_dev_ takes place of lclGraph_.row_map
2214
2215 row_ptrs_device_view_type rowPtrsPacked_dev_;
2216 mutable row_ptrs_host_view_type rowPtrsPacked_host_;
2217
2219 bool packedUnpackedRowPtrsMatch_ = false;
2220
2221 protected:
2222 void setRowPtrsUnpacked(const row_ptrs_device_view_type& dview) {
2223 packedUnpackedRowPtrsMatch_ = false;
2224 rowPtrsUnpacked_dev_ = dview;
2225 // Make sure stale host rowptrs are not kept
2226 rowPtrsUnpacked_host_ = row_ptrs_host_view_type();
2227 }
2228
2230 const row_ptrs_device_view_type& getRowPtrsUnpackedDevice() const {
2231 return rowPtrsUnpacked_dev_;
2232 }
2233
2235 const row_ptrs_host_view_type& getRowPtrsUnpackedHost() const {
2236 if (rowPtrsUnpacked_host_.extent(0) != rowPtrsUnpacked_dev_.extent(0)) {
2237 // NOTE: not just using create_mirror_view here, because
2238 // we do want host/device to be in different memory, even if we're using a SharedSpace.
2239 // This is so that reads will never trigger a host-device transfer.
2240 // The exception is when 'device' views are HostSpace, then don't make another copy.
2241 if constexpr (std::is_same_v<typename Node::memory_space, Kokkos::HostSpace>) {
2242 rowPtrsUnpacked_host_ = rowPtrsUnpacked_dev_;
2243 } else {
2244 // Have to make this temporary because rowptrs are const-valued
2245 typename row_ptrs_host_view_type::non_const_type rowPtrsTemp(
2246 Kokkos::view_alloc(Kokkos::WithoutInitializing, "rowPtrsUnpacked_host_"), rowPtrsUnpacked_dev_.extent(0));
2247 Kokkos::deep_copy(rowPtrsTemp, rowPtrsUnpacked_dev_);
2248 rowPtrsUnpacked_host_ = rowPtrsTemp;
2249 }
2250 // Also keep packed/unpacked views in sync, if they are known to have the same contents
2251 if (packedUnpackedRowPtrsMatch_) {
2252 rowPtrsPacked_host_ = rowPtrsUnpacked_host_;
2253 }
2254 }
2255 return rowPtrsUnpacked_host_;
2256 }
2257
2258 void setRowPtrsPacked(const row_ptrs_device_view_type& dview) {
2259 packedUnpackedRowPtrsMatch_ = false;
2260 rowPtrsPacked_dev_ = dview;
2261 // Make sure stale host rowptrs are not kept
2262 rowPtrsPacked_host_ = row_ptrs_host_view_type();
2263 }
2264
2266 const row_ptrs_device_view_type& getRowPtrsPackedDevice() const {
2267 return rowPtrsPacked_dev_;
2268 }
2269
2271 const row_ptrs_host_view_type& getRowPtrsPackedHost() const {
2272 if (rowPtrsPacked_host_.extent(0) != rowPtrsPacked_dev_.extent(0)) {
2273 // NOTE: not just using create_mirror_view here, because
2274 // we do want host/device to be in different memory, even if we're using a SharedSpace.
2275 // This is so that reads will never trigger a host-device transfer.
2276 // The exception is when 'device' views are HostSpace, then don't make another copy.
2277 if constexpr (std::is_same_v<typename Node::memory_space, Kokkos::HostSpace>) {
2278 rowPtrsPacked_host_ = rowPtrsPacked_dev_;
2279 } else {
2280 // Have to make this temporary because rowptrs are const-valued
2281 typename row_ptrs_host_view_type::non_const_type rowPtrsTemp(
2282 Kokkos::view_alloc(Kokkos::WithoutInitializing, "rowPtrsPacked_host_"), rowPtrsPacked_dev_.extent(0));
2283 Kokkos::deep_copy(rowPtrsTemp, rowPtrsPacked_dev_);
2284 rowPtrsPacked_host_ = rowPtrsTemp;
2285 }
2286 // Also keep packed/unpacked views in sync, if they are known to have the same contents
2287 if (packedUnpackedRowPtrsMatch_) {
2288 rowPtrsUnpacked_host_ = rowPtrsPacked_host_;
2289 }
2290 }
2291 return rowPtrsPacked_host_;
2292 }
2293
2294 // There are common cases where both packed and unpacked views are set to the same array.
2295 // Doing this in a single call can reduce dataspace on host, and reduce runtime by
2296 // removing a deep_copy from device to host.
2297
2298 void setRowPtrs(const row_ptrs_device_view_type& dview) {
2299 packedUnpackedRowPtrsMatch_ = true;
2300 rowPtrsUnpacked_dev_ = dview;
2301 rowPtrsPacked_dev_ = dview;
2302 // Make sure stale host rowptrs are not kept
2303 rowPtrsUnpacked_host_ = row_ptrs_host_view_type();
2304 rowPtrsPacked_host_ = row_ptrs_host_view_type();
2305 }
2306
2307 // TODO: Make private -- matrix shouldn't access directly the guts of graph
2308
2322 local_inds_wdv_type lclIndsUnpacked_wdv;
2323
2337 mutable local_inds_wdv_type lclIndsPacked_wdv;
2338
2339 // TODO: Make private -- matrix shouldn't access directly the guts of graph
2340
2350
2351 // TODO: Make private -- matrix shouldn't access directly
2352 global_inds_wdv_type gblInds_wdv;
2353
2357 typename local_inds_dualv_type::t_host::const_type
2358 getLocalIndsViewHost(const RowInfo& rowinfo) const;
2359
2363 typename local_inds_dualv_type::t_dev::const_type
2364 getLocalIndsViewDevice(const RowInfo& rowinfo) const;
2365
2369 typename global_inds_dualv_type::t_host::const_type
2370 getGlobalIndsViewHost(const RowInfo& rowinfo) const;
2371
2375 typename global_inds_dualv_type::t_dev::const_type
2376 getGlobalIndsViewDevice(const RowInfo& rowinfo) const;
2377
2381 typename local_inds_dualv_type::t_host
2383
2384 // FOR NOW...
2385 // KEEP k_numRowEntries_ (though switch from host_mirror_type to Host)
2386 // KEEP k_numAllocPerRow_ (though perhaps switch from host_mirror_type to Host)
2387
2413 typename Kokkos::View<const size_t*, device_type>::host_mirror_type
2415
2426
2428
2429
2451
2459 typedef typename Kokkos::View<size_t*, Kokkos::LayoutLeft, device_type>::host_mirror_type num_row_entries_type;
2460
2461 // typedef Kokkos::View<
2462 // size_t*,
2463 // Kokkos::LayoutLeft,
2464 // Kokkos::Device<
2465 // typename Kokkos::View<
2466 // size_t*,
2467 // Kokkos::LayoutLeft,
2468 // device_type>::host_mirror_type::execution_space,
2469 // Kokkos::HostSpace> > num_row_entries_type;
2470
2478
2484 mutable offset_device_view_type k_offRankOffsets_;
2485
2487
2498 Details::STORAGE_1D_UNPACKED;
2499
2500 bool indicesAreAllocated_ = false;
2501 bool indicesAreLocal_ = false;
2502 bool indicesAreGlobal_ = false;
2503 bool fillComplete_ = false;
2504
2509 bool noRedundancies_ = true;
2515 mutable bool haveLocalOffRankOffsets_ = false;
2516
2517 typedef typename std::map<global_ordinal_type, std::vector<global_ordinal_type>> nonlocals_type;
2518
2520 nonlocals_type nonlocals_;
2521
2537
2538 private:
2540 static bool getDebug();
2541
2544 bool debug_ = getDebug();
2545
2547 static bool getVerbose();
2548
2552 bool verbose_ = getVerbose();
2553
2554 private:
2556 mutable bool need_sync_host_uvm_access = false;
2557
2559 void set_need_sync_host_uvm_access() {
2560 need_sync_host_uvm_access = true;
2561 }
2562
2564 void execute_sync_host_uvm_access() const {
2565 if (need_sync_host_uvm_access) {
2566 Kokkos::fence("CrsGraph::execute_sync_host_uvm_access");
2567 need_sync_host_uvm_access = false;
2568 }
2569 }
2570}; // class CrsGraph
2571
2579template <class LocalOrdinal, class GlobalOrdinal, class Node>
2580Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
2582 const Teuchos::RCP<
2584 size_t maxNumEntriesPerRow = 0,
2585 const Teuchos::RCP<Teuchos::ParameterList>& params =
2586 Teuchos::null) {
2587 using Teuchos::rcp;
2588 using graph_type = CrsGraph<LocalOrdinal, GlobalOrdinal, Node>;
2589 return rcp(new graph_type(map, maxNumEntriesPerRow,
2590 params));
2591}
2592
2642template <class CrsGraphType>
2643Teuchos::RCP<CrsGraphType>
2644importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2645 const Import<typename CrsGraphType::local_ordinal_type,
2646 typename CrsGraphType::global_ordinal_type,
2647 typename CrsGraphType::node_type>& importer,
2648 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2649 typename CrsGraphType::global_ordinal_type,
2650 typename CrsGraphType::node_type>>& domainMap = Teuchos::null,
2651 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2652 typename CrsGraphType::global_ordinal_type,
2653 typename CrsGraphType::node_type>>& rangeMap = Teuchos::null,
2654 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
2655 Teuchos::RCP<CrsGraphType> destGraph;
2656 sourceGraph->importAndFillComplete(destGraph, importer, domainMap, rangeMap, params);
2657 return destGraph;
2658}
2659
2710template <class CrsGraphType>
2711Teuchos::RCP<CrsGraphType>
2712importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2713 const Import<typename CrsGraphType::local_ordinal_type,
2714 typename CrsGraphType::global_ordinal_type,
2715 typename CrsGraphType::node_type>& rowImporter,
2716 const Import<typename CrsGraphType::local_ordinal_type,
2717 typename CrsGraphType::global_ordinal_type,
2718 typename CrsGraphType::node_type>& domainImporter,
2719 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2720 typename CrsGraphType::global_ordinal_type,
2721 typename CrsGraphType::node_type>>& domainMap,
2722 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2723 typename CrsGraphType::global_ordinal_type,
2724 typename CrsGraphType::node_type>>& rangeMap,
2725 const Teuchos::RCP<Teuchos::ParameterList>& params) {
2726 Teuchos::RCP<CrsGraphType> destGraph;
2727 sourceGraph->importAndFillComplete(destGraph, rowImporter, domainImporter, domainMap, rangeMap, params);
2728 return destGraph;
2729}
2730
2764template <class CrsGraphType>
2765Teuchos::RCP<CrsGraphType>
2766exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2767 const Export<typename CrsGraphType::local_ordinal_type,
2768 typename CrsGraphType::global_ordinal_type,
2769 typename CrsGraphType::node_type>& exporter,
2770 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2771 typename CrsGraphType::global_ordinal_type,
2772 typename CrsGraphType::node_type>>& domainMap = Teuchos::null,
2773 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2774 typename CrsGraphType::global_ordinal_type,
2775 typename CrsGraphType::node_type>>& rangeMap = Teuchos::null,
2776 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
2777 Teuchos::RCP<CrsGraphType> destGraph;
2778 sourceGraph->exportAndFillComplete(destGraph, exporter, domainMap, rangeMap, params);
2779 return destGraph;
2780}
2781
2815template <class CrsGraphType>
2816Teuchos::RCP<CrsGraphType>
2817exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2818 const Export<typename CrsGraphType::local_ordinal_type,
2819 typename CrsGraphType::global_ordinal_type,
2820 typename CrsGraphType::node_type>& rowExporter,
2821 const Export<typename CrsGraphType::local_ordinal_type,
2822 typename CrsGraphType::global_ordinal_type,
2823 typename CrsGraphType::node_type>& domainExporter,
2824 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2825 typename CrsGraphType::global_ordinal_type,
2826 typename CrsGraphType::node_type>>& domainMap,
2827 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2828 typename CrsGraphType::global_ordinal_type,
2829 typename CrsGraphType::node_type>>& rangeMap,
2830 const Teuchos::RCP<Teuchos::ParameterList>& params) {
2831 Teuchos::RCP<CrsGraphType> destGraph;
2832 sourceGraph->exportAndFillComplete(destGraph, rowExporter, domainExporter, domainMap, rangeMap, params);
2833 return destGraph;
2834}
2835
2836} // namespace Tpetra
2837
2838#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.