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
25#include "KokkosSparse_findRelOffset.hpp"
26#include "Kokkos_DualView.hpp"
27
28#include "Teuchos_CommHelpers.hpp"
29#include "Teuchos_Describable.hpp"
30#include "Teuchos_OrdinalTraits.hpp"
31#include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
32
33#include "KokkosSparse_StaticCrsGraph.hpp"
34
35#include <functional> // std::function
36#include <memory>
37
38namespace Tpetra {
39
40// Forward declaration for CrsGraph::swap() test
41template <class LocalOrdinal, class GlobalOrdinal, class Node>
42class crsGraph_Swap_Tester;
43
44#ifndef DOXYGEN_SHOULD_SKIP_THIS
45namespace Details {
46template <class LocalOrdinal,
47 class GlobalOrdinal>
48class CrsPadding;
49} // namespace Details
50
51namespace { // (anonymous)
52
53template <class ViewType>
54struct UnmanagedView {
55 static_assert(Kokkos::is_view<ViewType>::value,
56 "ViewType must be a Kokkos::View specialization.");
57 // FIXME (mfh 02 Dec 2015) Right now, this strips away other
58 // memory traits. Christian will add an "AllTraits" enum which is
59 // the enum value of MemoryTraits<T>, that will help us fix this.
60 typedef Kokkos::View<typename ViewType::data_type,
61 typename ViewType::array_layout,
62 typename ViewType::device_type,
63 Kokkos::MemoryUnmanaged>
64 type;
65};
66
67} // namespace
68#endif // DOXYGEN_SHOULD_SKIP_THIS
69
78struct RowInfo {
79 size_t localRow;
80 size_t allocSize;
81 size_t numEntries;
82 size_t offset1D;
83};
84
85enum ELocalGlobal {
86 LocalIndices,
87 GlobalIndices
88};
89
90namespace Details {
122 STORAGE_1D_UNPACKED, //<! 1-D "unpacked" storage
123 STORAGE_1D_PACKED, //<! 1-D "packed" storage
124 STORAGE_UB //<! Invalid value; upper bound on enum values
125};
126
127} // namespace Details
128
187template <class LocalOrdinal,
188 class GlobalOrdinal,
189 class Node>
190class CrsGraph : public RowGraph<LocalOrdinal, GlobalOrdinal, Node>,
191 public DistObject<GlobalOrdinal,
192 LocalOrdinal,
193 GlobalOrdinal,
194 Node>,
195 public Teuchos::ParameterListAcceptorDefaultBase {
196 template <class S, class LO, class GO, class N>
197 friend class CrsMatrix;
198 template <class LO2, class GO2, class N2>
199 friend class CrsGraph;
200 template <class LO, class GO, class N>
201 friend class FECrsGraph;
202
205
206 public:
208 using local_ordinal_type = LocalOrdinal;
210 using global_ordinal_type = GlobalOrdinal;
212 using device_type = typename Node::device_type;
214 using execution_space = typename device_type::execution_space;
215
220 using node_type = Node;
221
224 KokkosSparse::StaticCrsGraph<local_ordinal_type, Kokkos::LayoutLeft,
225 device_type, void, size_t>;
226
228#if KOKKOS_VERSION >= 40799
229 using local_graph_host_type = typename local_graph_device_type::host_mirror_type;
230#else
231 using local_graph_host_type = typename local_graph_device_type::HostMirror;
232#endif
233
240
241 public:
242 // Types used for CrsGraph's storage of local column indices
243 using local_inds_dualv_type =
244 Kokkos::DualView<local_ordinal_type*, device_type>;
245 using local_inds_wdv_type =
247
248 // Types used for CrsGraph's storage of global column indices
249 using global_inds_dualv_type =
250 Kokkos::DualView<global_ordinal_type*, device_type>;
251 using global_inds_wdv_type =
253
254 public:
255 using row_graph_type = RowGraph<LocalOrdinal, GlobalOrdinal, Node>;
256 using row_ptrs_device_view_type =
257 typename row_graph_type::row_ptrs_device_view_type;
258 using row_ptrs_host_view_type =
259 typename row_graph_type::row_ptrs_host_view_type;
260
263 typename row_graph_type::local_inds_device_view_type;
264 using local_inds_host_view_type =
265 typename row_graph_type::local_inds_host_view_type;
266 using nonconst_local_inds_host_view_type =
267 typename row_graph_type::nonconst_local_inds_host_view_type;
268
271 typename row_graph_type::global_inds_device_view_type;
272 using global_inds_host_view_type =
273 typename row_graph_type::global_inds_host_view_type;
274 using nonconst_global_inds_host_view_type =
275 typename row_graph_type::nonconst_global_inds_host_view_type;
276
277 using offset_device_view_type =
278 typename row_ptrs_device_view_type::non_const_type;
279
281
282
295 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
296 const size_t maxNumEntriesPerRow,
297 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
298
311 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
312 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
313 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
314
328 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
329 const Teuchos::ArrayView<const size_t>& numEntPerRow,
330 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
331
344
348 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
349 const Teuchos::RCP<const map_type>& colMap,
350 const size_t maxNumEntriesPerRow,
351 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
352
367 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
368 const Teuchos::RCP<const map_type>& colMap,
369 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
370 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
371
387 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
388 const Teuchos::RCP<const map_type>& colMap,
389 const Teuchos::ArrayView<const size_t>& numEntPerRow,
390 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
391
403 CrsGraph(CrsGraph<local_ordinal_type, global_ordinal_type, node_type>& originalGraph,
404 const Teuchos::RCP<const map_type>& rowMap,
405 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
406
429 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
430 const Teuchos::RCP<const map_type>& colMap,
431 const typename local_graph_device_type::row_map_type& rowPointers,
432 const typename local_graph_device_type::entries_type::non_const_type& columnIndices,
433 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
434
457 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
458 const Teuchos::RCP<const map_type>& colMap,
459 const Teuchos::ArrayRCP<size_t>& rowPointers,
460 const Teuchos::ArrayRCP<local_ordinal_type>& columnIndices,
461 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
462
484 CrsGraph(const Teuchos::RCP<const map_type>& rowMap,
485 const Teuchos::RCP<const map_type>& colMap,
486 const local_graph_device_type& lclGraph,
487 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
488
516 const Teuchos::RCP<const map_type>& rowMap,
517 const Teuchos::RCP<const map_type>& colMap,
518 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
519 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
520 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
521
527 const Teuchos::RCP<const map_type>& rowMap,
528 const Teuchos::RCP<const map_type>& colMap,
529 const Teuchos::RCP<const map_type>& domainMap,
530 const Teuchos::RCP<const map_type>& rangeMap,
531 const Teuchos::RCP<const import_type>& importer,
532 const Teuchos::RCP<const export_type>& exporter,
533 const Teuchos::RCP<Teuchos::ParameterList>& params =
534 Teuchos::null);
535
577 CrsGraph(const row_ptrs_device_view_type& rowPointers,
578 const local_inds_wdv_type& columnIndices,
579 const Teuchos::RCP<const map_type>& rowMap,
580 const Teuchos::RCP<const map_type>& colMap,
581 const Teuchos::RCP<const map_type>& domainMap,
582 const Teuchos::RCP<const map_type>& rangeMap,
583 const Teuchos::RCP<const import_type>& importer,
584 const Teuchos::RCP<const export_type>& exporter,
585 const Teuchos::RCP<Teuchos::ParameterList>& params =
586 Teuchos::null);
587
589 CrsGraph(const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&) = default;
590
592 CrsGraph& operator=(const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&) = default;
593
595 CrsGraph(CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&&) = default;
596
598 CrsGraph& operator=(CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&&) = default;
599
609 virtual ~CrsGraph() = default;
610
638
655 bool isIdenticalTo(const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>& graph) const;
656
658
660
662 void
663 setParameterList(const Teuchos::RCP<Teuchos::ParameterList>& params) override;
664
666 Teuchos::RCP<const Teuchos::ParameterList>
667 getValidParameters() const override;
668
670
672
694 void
696 const Teuchos::ArrayView<const global_ordinal_type>& indices);
697
704 void
706 const local_ordinal_type numEnt,
707 const global_ordinal_type inds[]);
708
710
724 void
726 const Teuchos::ArrayView<const local_ordinal_type>& indices);
727
734 void
736 const local_ordinal_type numEnt,
737 const local_ordinal_type inds[]);
738
740
750
752
754
763
782 void
783 resumeFill(const Teuchos::RCP<Teuchos::ParameterList>& params =
784 Teuchos::null);
785
823 void
824 fillComplete(const Teuchos::RCP<const map_type>& domainMap,
825 const Teuchos::RCP<const map_type>& rangeMap,
826 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
827
855 void
856 fillComplete(const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
857
886 void
887 expertStaticFillComplete(const Teuchos::RCP<const map_type>& domainMap,
888 const Teuchos::RCP<const map_type>& rangeMap,
889 const Teuchos::RCP<const import_type>& importer =
890 Teuchos::null,
891 const Teuchos::RCP<const export_type>& exporter =
892 Teuchos::null,
893 const Teuchos::RCP<Teuchos::ParameterList>& params =
894 Teuchos::null);
896
898
900 Teuchos::RCP<const Teuchos::Comm<int>> getComm() const override;
901
903 Teuchos::RCP<const map_type> getRowMap() const override;
904
906 Teuchos::RCP<const map_type> getColMap() const override;
907
909 Teuchos::RCP<const map_type> getDomainMap() const override;
910
912 Teuchos::RCP<const map_type> getRangeMap() const override;
913
915 Teuchos::RCP<const import_type> getImporter() const override;
916
918 Teuchos::RCP<const export_type> getExporter() const override;
919
921
924
926
930
932 size_t getLocalNumRows() const override;
933
935
937 size_t getLocalNumCols() const override;
938
941
943
946
956 size_t getLocalNumEntries() const override;
957
959
960 size_t
962
969 size_t
971
992
1001
1010
1024 size_t getGlobalMaxNumRowEntries() const override;
1025
1030 size_t getLocalMaxNumRowEntries() const override;
1031
1047 bool hasColMap() const override;
1048
1056 bool isLocallyIndexed() const override;
1057
1065 bool isGloballyIndexed() const override;
1066
1068 bool isFillComplete() const override;
1069
1071 bool isFillActive() const;
1072
1080 bool isSorted() const;
1081
1083
1090
1096 void
1098 nonconst_global_inds_host_view_type& gblColInds,
1099 size_t& numColInds) const override;
1100
1108 void
1110 nonconst_local_inds_host_view_type& gblColInds,
1111 size_t& numColInds) const override;
1112
1123 void
1125 const global_ordinal_type gblRow,
1126 global_inds_host_view_type& gblColInds) const override;
1127
1130 bool supportsRowViews() const override;
1131
1142 void
1144 const LocalOrdinal lclRow,
1145 local_inds_host_view_type& lclColInds) const override;
1146
1148
1150
1152 std::string description() const override;
1153
1156 void
1157 describe(Teuchos::FancyOStream& out,
1158 const Teuchos::EVerbosityLevel verbLevel =
1159 Teuchos::Describable::verbLevel_default) const override;
1160
1162
1164
1172
1173 virtual bool
1174 checkSizes(const SrcDistObject& source) override;
1175
1176 using dist_object_type::
1177 copyAndPermute;
1179
1180 virtual void
1182 const size_t numSameIDs,
1183 const Kokkos::DualView<const local_ordinal_type*,
1184 buffer_device_type>& permuteToLIDs,
1185 const Kokkos::DualView<const local_ordinal_type*,
1186 buffer_device_type>& permuteFromLIDs,
1187 const CombineMode CM) override;
1188
1189 void copyAndPermuteNew(
1190 const row_graph_type& source,
1191 row_graph_type& target,
1192 const size_t numSameIDs,
1193 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteToLIDs,
1194 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteFromLIDs,
1195 const CombineMode CM);
1196
1197 void insertGlobalIndicesDevice(
1198 const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>& srcCrsGraph,
1199 CrsGraph<LocalOrdinal, GlobalOrdinal, Node>& tgtCrsGraph,
1200 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteToLIDs,
1201 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteFromLIDs,
1202 LocalOrdinal loopEnd);
1203
1204 using padding_type = Details::CrsPadding<
1206
1207 void
1208 applyCrsPadding(const padding_type& padding,
1209 const bool verbose);
1210
1211 std::unique_ptr<padding_type>
1212 computeCrsPadding(
1214 node_type>& source,
1215 const size_t numSameIDs,
1216 const Kokkos::DualView<const local_ordinal_type*,
1217 buffer_device_type>& permuteToLIDs,
1218 const Kokkos::DualView<const local_ordinal_type*,
1219 buffer_device_type>& permuteFromLIDs,
1220 const bool verbose) const;
1221
1222 // This actually modifies imports by sorting it.
1223 std::unique_ptr<padding_type>
1224 computeCrsPaddingForImports(
1225 const Kokkos::DualView<const local_ordinal_type*,
1226 buffer_device_type>& importLIDs,
1227 Kokkos::DualView<packet_type*, buffer_device_type> imports,
1228 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1229 const bool verbose) const;
1230
1231 std::unique_ptr<padding_type>
1232 computePaddingForCrsMatrixUnpack(
1233 const Kokkos::DualView<const local_ordinal_type*,
1234 buffer_device_type>& importLIDs,
1235 Kokkos::DualView<char*, buffer_device_type> imports,
1236 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1237 const bool verbose) const;
1238
1239 void
1240 computeCrsPaddingForSameIDs(
1241 padding_type& padding,
1243 node_type>& source,
1244 const local_ordinal_type numSameIDs) const;
1245
1246 void
1247 computeCrsPaddingForPermutedIDs(
1248 padding_type& padding,
1250 node_type>& source,
1251 const Kokkos::DualView<const local_ordinal_type*,
1252 buffer_device_type>& permuteToLIDs,
1253 const Kokkos::DualView<const local_ordinal_type*,
1254 buffer_device_type>& permuteFromLIDs) const;
1255
1256 virtual void
1257 packAndPrepare(
1258 const SrcDistObject& source,
1259 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& exportLIDs,
1260 Kokkos::DualView<packet_type*, buffer_device_type>& exports,
1261 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1262 size_t& constantNumPackets) override;
1263
1268
1269 virtual void
1270 pack(const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1271 Teuchos::Array<global_ordinal_type>& exports,
1272 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1273 size_t& constantNumPackets) const override;
1274
1275 void
1276 packFillActive(const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1277 Teuchos::Array<global_ordinal_type>& exports,
1278 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1279 size_t& constantNumPackets) const;
1280
1281 void
1282 packFillActiveNew(const Kokkos::DualView<const local_ordinal_type*,
1283 buffer_device_type>& exportLIDs,
1284 Kokkos::DualView<packet_type*,
1285 buffer_device_type>& exports,
1286 Kokkos::DualView<size_t*,
1288 numPacketsPerLID,
1289 size_t& constantNumPackets) const;
1290
1295
1296 virtual void
1297 unpackAndCombine(const Kokkos::DualView<const local_ordinal_type*,
1298 buffer_device_type>& importLIDs,
1299 Kokkos::DualView<packet_type*,
1301 imports,
1302 Kokkos::DualView<size_t*,
1304 numPacketsPerLID,
1305 const size_t constantNumPackets,
1306 const CombineMode combineMode) override;
1307
1309
1311
1354 void
1355 getLocalDiagOffsets(const Kokkos::View<size_t*, device_type, Kokkos::MemoryUnmanaged>& offsets) const;
1356
1358 void
1359 getLocalOffRankOffsets(offset_device_view_type& offsets) const;
1360
1370 void
1371 getLocalDiagOffsets(Teuchos::ArrayRCP<size_t>& offsets) const;
1372
1382 void
1383 setAllIndices(const typename local_graph_device_type::row_map_type& rowPointers,
1384 const typename local_graph_device_type::entries_type::non_const_type& columnIndices);
1385
1395 void
1396 setAllIndices(const Teuchos::ArrayRCP<size_t>& rowPointers,
1397 const Teuchos::ArrayRCP<local_ordinal_type>& columnIndices);
1398
1401 row_ptrs_host_view_type getLocalRowPtrsHost() const;
1402
1405 row_ptrs_device_view_type getLocalRowPtrsDevice() const;
1406
1408 local_inds_host_view_type getLocalIndicesHost() const;
1409
1412
1431 void replaceColMap(const Teuchos::RCP<const map_type>& newColMap);
1432
1452 void
1453 reindexColumns(const Teuchos::RCP<const map_type>& newColMap,
1454 const Teuchos::RCP<const import_type>& newImport = Teuchos::null,
1455 const bool sortIndicesInEachRow = true);
1456
1463 void
1464 replaceDomainMap(const Teuchos::RCP<const map_type>& newDomainMap);
1465
1479 void
1480 replaceDomainMapAndImporter(const Teuchos::RCP<const map_type>& newDomainMap,
1481 const Teuchos::RCP<const import_type>& newImporter);
1482
1489 void
1490 replaceRangeMap(const Teuchos::RCP<const map_type>& newRangeMap);
1491
1505 void
1506 replaceRangeMapAndExporter(const Teuchos::RCP<const map_type>& newRangeMap,
1507 const Teuchos::RCP<const export_type>& newExporter);
1508
1537 virtual void
1538 removeEmptyProcessesInPlace(const Teuchos::RCP<const map_type>& newMap) override;
1540
1541 template <class DestViewType, class SrcViewType,
1542 class DestOffsetViewType, class SrcOffsetViewType>
1543 struct pack_functor {
1544 typedef typename DestViewType::execution_space execution_space;
1545 SrcViewType src;
1546 DestViewType dest;
1547 SrcOffsetViewType src_offset;
1548 DestOffsetViewType dest_offset;
1549 typedef typename DestOffsetViewType::non_const_value_type ScalarIndx;
1550
1551 pack_functor(DestViewType dest_,
1552 const SrcViewType src_,
1553 DestOffsetViewType dest_offset_,
1554 const SrcOffsetViewType src_offset_)
1555 : src(src_)
1556 , dest(dest_)
1557 , src_offset(src_offset_)
1558 , dest_offset(dest_offset_){};
1559
1560 KOKKOS_INLINE_FUNCTION
1561 void operator()(size_t row) const {
1562 ScalarIndx i = src_offset(row);
1563 ScalarIndx j = dest_offset(row);
1564 const ScalarIndx k = dest_offset(row + 1);
1565 for (; j < k; j++, i++) {
1566 dest(j) = src(i);
1567 }
1568 }
1569 };
1570
1571 private:
1572 // Friend declaration for nonmember function.
1573 template <class CrsGraphType>
1574 friend Teuchos::RCP<CrsGraphType>
1575 importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1576 const Import<typename CrsGraphType::local_ordinal_type,
1577 typename CrsGraphType::global_ordinal_type,
1578 typename CrsGraphType::node_type>& importer,
1579 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1580 typename CrsGraphType::global_ordinal_type,
1581 typename CrsGraphType::node_type>>& domainMap,
1582 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1583 typename CrsGraphType::global_ordinal_type,
1584 typename CrsGraphType::node_type>>& rangeMap,
1585 const Teuchos::RCP<Teuchos::ParameterList>& params);
1586
1587 // Friend declaration for nonmember function.
1588 template <class CrsGraphType>
1589 friend Teuchos::RCP<CrsGraphType>
1590 importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1591 const Import<typename CrsGraphType::local_ordinal_type,
1592 typename CrsGraphType::global_ordinal_type,
1593 typename CrsGraphType::node_type>& rowImporter,
1594 const Import<typename CrsGraphType::local_ordinal_type,
1595 typename CrsGraphType::global_ordinal_type,
1596 typename CrsGraphType::node_type>& domainImporter,
1597 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1598 typename CrsGraphType::global_ordinal_type,
1599 typename CrsGraphType::node_type>>& domainMap,
1600 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1601 typename CrsGraphType::global_ordinal_type,
1602 typename CrsGraphType::node_type>>& rangeMap,
1603 const Teuchos::RCP<Teuchos::ParameterList>& params);
1604
1605 // Friend declaration for nonmember function.
1606 template <class CrsGraphType>
1607 friend Teuchos::RCP<CrsGraphType>
1608 exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1609 const Export<typename CrsGraphType::local_ordinal_type,
1610 typename CrsGraphType::global_ordinal_type,
1611 typename CrsGraphType::node_type>& exporter,
1612 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1613 typename CrsGraphType::global_ordinal_type,
1614 typename CrsGraphType::node_type>>& domainMap,
1615 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1616 typename CrsGraphType::global_ordinal_type,
1617 typename CrsGraphType::node_type>>& rangeMap,
1618 const Teuchos::RCP<Teuchos::ParameterList>& params);
1619
1620 // Friend declaration for nonmember function.
1621 template <class CrsGraphType>
1622 friend Teuchos::RCP<CrsGraphType>
1623 exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1624 const Export<typename CrsGraphType::local_ordinal_type,
1625 typename CrsGraphType::global_ordinal_type,
1626 typename CrsGraphType::node_type>& rowExporter,
1627 const Export<typename CrsGraphType::local_ordinal_type,
1628 typename CrsGraphType::global_ordinal_type,
1629 typename CrsGraphType::node_type>& domainExporter,
1630 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1631 typename CrsGraphType::global_ordinal_type,
1632 typename CrsGraphType::node_type>>& domainMap,
1633 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1634 typename CrsGraphType::global_ordinal_type,
1635 typename CrsGraphType::node_type>>& rangeMap,
1636 const Teuchos::RCP<Teuchos::ParameterList>& params);
1637
1638 public:
1654 void
1655 importAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1656 const import_type& importer,
1657 const Teuchos::RCP<const map_type>& domainMap,
1658 const Teuchos::RCP<const map_type>& rangeMap,
1659 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1660
1676 void
1677 importAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1678 const import_type& rowImporter,
1679 const import_type& domainImporter,
1680 const Teuchos::RCP<const map_type>& domainMap,
1681 const Teuchos::RCP<const map_type>& rangeMap,
1682 const Teuchos::RCP<Teuchos::ParameterList>& params) const;
1683
1699 void
1700 exportAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1701 const export_type& exporter,
1702 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1703 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1704 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1705
1721 void
1722 exportAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1723 const export_type& rowExporter,
1724 const export_type& domainExporter,
1725 const Teuchos::RCP<const map_type>& domainMap,
1726 const Teuchos::RCP<const map_type>& rangeMap,
1727 const Teuchos::RCP<Teuchos::ParameterList>& params) const;
1728
1729 private:
1750 void
1751 transferAndFillComplete(Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node>>& destGraph,
1752 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, Node>& rowTransfer,
1753 const Teuchos::RCP<const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, Node>>& domainTransfer,
1754 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1755 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1756 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1757
1758 protected:
1759 // these structs are conveniences, to cut down on the number of
1760 // arguments to some of the methods below.
1761 struct SLocalGlobalViews {
1762 Teuchos::ArrayView<const global_ordinal_type> ginds;
1763 Teuchos::ArrayView<const local_ordinal_type> linds;
1764 };
1765 struct SLocalGlobalNCViews {
1766 Teuchos::ArrayView<global_ordinal_type> ginds;
1767 Teuchos::ArrayView<local_ordinal_type> linds;
1768 };
1769
1770 bool indicesAreAllocated() const;
1771
1772 void
1773 allocateIndices(const ELocalGlobal lg, const bool verbose = false);
1774
1776
1777
1787 void makeColMap(Teuchos::Array<int>& remotePIDs);
1788
1809 std::pair<size_t, std::string>
1810 makeIndicesLocal(const bool verbose = false);
1811
1820 void
1821 makeImportExport(Teuchos::Array<int>& remotePIDs,
1822 const bool useRemotePIDs);
1823
1825
1827
1862 size_t
1864 const SLocalGlobalViews& newInds,
1865 const ELocalGlobal lg,
1866 const ELocalGlobal I);
1867
1877 size_t
1879 const global_ordinal_type inputGblColInds[],
1880 const size_t numInputInds);
1881
1891 size_t
1893 const global_ordinal_type inputGblColInds[],
1894 const size_t numInputInds,
1895 std::function<void(const size_t, const size_t, const size_t)> fun =
1896 std::function<void(const size_t, const size_t, const size_t)>());
1897
1898 void
1899 insertLocalIndicesImpl(const local_ordinal_type lclRow,
1900 const Teuchos::ArrayView<const local_ordinal_type>& gblColInds,
1901 std::function<void(const size_t, const size_t, const size_t)> fun =
1902 std::function<void(const size_t, const size_t, const size_t)>());
1903
1919 size_t
1921 const Teuchos::ArrayView<const global_ordinal_type>& indices,
1922 std::function<void(const size_t, const size_t, const size_t)> fun) const;
1923
1935 void
1937 const global_ordinal_type gblColInds[],
1938 const local_ordinal_type numGblColInds);
1939
1951 void
1953 const global_ordinal_type gblColInds[],
1954 const local_ordinal_type numGblColInds);
1955
1960 static const bool useAtomicUpdatesByDefault =
1961#ifdef KOKKOS_ENABLE_SERIAL
1962 !std::is_same<execution_space, Kokkos::Serial>::value;
1963#else
1964 true;
1965#endif // KOKKOS_ENABLE_SERIAL
1966
1968
1970
1972 bool isMerged() const;
1973
1980
1981 private:
1986 void
1987 sortAndMergeAllIndices(const bool sorted, const bool merged);
1988
1989 // mfh 08 May 2017: I only restore "protected" here for backwards
1990 // compatibility.
1991 protected:
1993
2003 void
2004 setDomainRangeMaps(const Teuchos::RCP<const map_type>& domainMap,
2005 const Teuchos::RCP<const map_type>& rangeMap);
2006
2007 void staticAssertions() const;
2008 void clearGlobalConstants();
2009
2010 public:
2013
2032
2033 bool haveLocalOffRankOffsets() const { return haveLocalOffRankOffsets_; }
2034
2035 protected:
2056
2060
2074
2075 public:
2084 local_graph_host_type getLocalGraphHost() const;
2085
2086 protected:
2087 void fillLocalGraph(const Teuchos::RCP<Teuchos::ParameterList>& params);
2088
2091
2095 void swap(CrsGraph<local_ordinal_type, global_ordinal_type, Node>& graph);
2096
2097 // Friend the tester for CrsGraph::swap
2098 friend class Tpetra::crsGraph_Swap_Tester<local_ordinal_type, global_ordinal_type, Node>;
2099
2101 Teuchos::RCP<const map_type> rowMap_;
2103 Teuchos::RCP<const map_type> colMap_;
2105 Teuchos::RCP<const map_type> rangeMap_;
2107 Teuchos::RCP<const map_type> domainMap_;
2108
2115 Teuchos::RCP<const import_type> importer_;
2116
2122 Teuchos::RCP<const export_type> exporter_;
2123
2129 Teuchos::OrdinalTraits<size_t>::invalid();
2130
2135 Teuchos::OrdinalTraits<global_size_t>::invalid();
2136
2142 Teuchos::OrdinalTraits<global_size_t>::invalid();
2143
2144 private:
2145 // Replacement for device view k_rowPtrs_
2146 // Device view rowPtrsUnpacked_dev_ takes place of k_rowPtrs_
2147 // Host view rowPtrsUnpacked_host_ takes place of copies and use of getEntryOnHost
2148 // Wish this could be a WrappedDualView, but deep_copies in DualView
2149 // don't work with const data views (e.g., StaticCrsGraph::row_map)
2150 // k_rowPtrs_ is offsets wrt the ALLOCATED indices array, not necessarily
2151 // the ACTUAL compressed indices array.
2152 // When !OptimizedStorage, k_rowPtrs_ may differ from ACTUAL compressed
2153 // indices array. (Karen is skeptical that !OptimizedStorage works)
2154 // When OptimizedStorage, rowPtrsUnpacked_ = k_rowPtrsPacked_
2155
2156 row_ptrs_device_view_type rowPtrsUnpacked_dev_;
2157 mutable row_ptrs_host_view_type rowPtrsUnpacked_host_;
2158
2159 // Row offsets into the actual graph local indices
2160 // Device view rowPtrsUnpacked_dev_ takes place of lclGraph_.row_map
2161
2162 row_ptrs_device_view_type rowPtrsPacked_dev_;
2163 mutable row_ptrs_host_view_type rowPtrsPacked_host_;
2164
2166 bool packedUnpackedRowPtrsMatch_ = false;
2167
2168 protected:
2169 void setRowPtrsUnpacked(const row_ptrs_device_view_type& dview) {
2170 packedUnpackedRowPtrsMatch_ = false;
2171 rowPtrsUnpacked_dev_ = dview;
2172 // Make sure stale host rowptrs are not kept
2173 rowPtrsUnpacked_host_ = row_ptrs_host_view_type();
2174 }
2175
2177 const row_ptrs_device_view_type& getRowPtrsUnpackedDevice() const {
2178 return rowPtrsUnpacked_dev_;
2179 }
2180
2182 const row_ptrs_host_view_type& getRowPtrsUnpackedHost() const {
2183 if (rowPtrsUnpacked_host_.extent(0) != rowPtrsUnpacked_dev_.extent(0)) {
2184 // NOTE: not just using create_mirror_view here, because
2185 // we do want host/device to be in different memory, even if we're using a SharedSpace.
2186 // This is so that reads will never trigger a host-device transfer.
2187 // The exception is when 'device' views are HostSpace, then don't make another copy.
2188 if constexpr (std::is_same_v<typename Node::memory_space, Kokkos::HostSpace>) {
2189 rowPtrsUnpacked_host_ = rowPtrsUnpacked_dev_;
2190 } else {
2191 // Have to make this temporary because rowptrs are const-valued
2192 typename row_ptrs_host_view_type::non_const_type rowPtrsTemp(
2193 Kokkos::view_alloc(Kokkos::WithoutInitializing, "rowPtrsUnpacked_host_"), rowPtrsUnpacked_dev_.extent(0));
2194 Kokkos::deep_copy(rowPtrsTemp, rowPtrsUnpacked_dev_);
2195 rowPtrsUnpacked_host_ = rowPtrsTemp;
2196 }
2197 // Also keep packed/unpacked views in sync, if they are known to have the same contents
2198 if (packedUnpackedRowPtrsMatch_) {
2199 rowPtrsPacked_host_ = rowPtrsUnpacked_host_;
2200 }
2201 }
2202 return rowPtrsUnpacked_host_;
2203 }
2204
2205 void setRowPtrsPacked(const row_ptrs_device_view_type& dview) {
2206 packedUnpackedRowPtrsMatch_ = false;
2207 rowPtrsPacked_dev_ = dview;
2208 // Make sure stale host rowptrs are not kept
2209 rowPtrsPacked_host_ = row_ptrs_host_view_type();
2210 }
2211
2213 const row_ptrs_device_view_type& getRowPtrsPackedDevice() const {
2214 return rowPtrsPacked_dev_;
2215 }
2216
2218 const row_ptrs_host_view_type& getRowPtrsPackedHost() const {
2219 if (rowPtrsPacked_host_.extent(0) != rowPtrsPacked_dev_.extent(0)) {
2220 // NOTE: not just using create_mirror_view here, because
2221 // we do want host/device to be in different memory, even if we're using a SharedSpace.
2222 // This is so that reads will never trigger a host-device transfer.
2223 // The exception is when 'device' views are HostSpace, then don't make another copy.
2224 if constexpr (std::is_same_v<typename Node::memory_space, Kokkos::HostSpace>) {
2225 rowPtrsPacked_host_ = rowPtrsPacked_dev_;
2226 } else {
2227 // Have to make this temporary because rowptrs are const-valued
2228 typename row_ptrs_host_view_type::non_const_type rowPtrsTemp(
2229 Kokkos::view_alloc(Kokkos::WithoutInitializing, "rowPtrsPacked_host_"), rowPtrsPacked_dev_.extent(0));
2230 Kokkos::deep_copy(rowPtrsTemp, rowPtrsPacked_dev_);
2231 rowPtrsPacked_host_ = rowPtrsTemp;
2232 }
2233 // Also keep packed/unpacked views in sync, if they are known to have the same contents
2234 if (packedUnpackedRowPtrsMatch_) {
2235 rowPtrsUnpacked_host_ = rowPtrsPacked_host_;
2236 }
2237 }
2238 return rowPtrsPacked_host_;
2239 }
2240
2241 // There are common cases where both packed and unpacked views are set to the same array.
2242 // Doing this in a single call can reduce dataspace on host, and reduce runtime by
2243 // removing a deep_copy from device to host.
2244
2245 void setRowPtrs(const row_ptrs_device_view_type& dview) {
2246 packedUnpackedRowPtrsMatch_ = true;
2247 rowPtrsUnpacked_dev_ = dview;
2248 rowPtrsPacked_dev_ = dview;
2249 // Make sure stale host rowptrs are not kept
2250 rowPtrsUnpacked_host_ = row_ptrs_host_view_type();
2251 rowPtrsPacked_host_ = row_ptrs_host_view_type();
2252 }
2253
2254 // TODO: Make private -- matrix shouldn't access directly the guts of graph
2255
2269 local_inds_wdv_type lclIndsUnpacked_wdv;
2270
2284 mutable local_inds_wdv_type lclIndsPacked_wdv;
2285
2286 // TODO: Make private -- matrix shouldn't access directly the guts of graph
2287
2297
2298 // TODO: Make private -- matrix shouldn't access directly
2299 global_inds_wdv_type gblInds_wdv;
2300
2304 typename local_inds_dualv_type::t_host::const_type
2305 getLocalIndsViewHost(const RowInfo& rowinfo) const;
2306
2310 typename local_inds_dualv_type::t_dev::const_type
2311 getLocalIndsViewDevice(const RowInfo& rowinfo) const;
2312
2316 typename global_inds_dualv_type::t_host::const_type
2317 getGlobalIndsViewHost(const RowInfo& rowinfo) const;
2318
2322 typename global_inds_dualv_type::t_dev::const_type
2323 getGlobalIndsViewDevice(const RowInfo& rowinfo) const;
2324
2328 typename local_inds_dualv_type::t_host
2330
2331 // FOR NOW...
2332 // KEEP k_numRowEntries_ (though switch from host_mirror_type to Host)
2333 // KEEP k_numAllocPerRow_ (though perhaps switch from host_mirror_type to Host)
2334
2360 typename Kokkos::View<const size_t*, device_type>::host_mirror_type
2362
2373
2375
2376
2398
2406 typedef typename Kokkos::View<size_t*, Kokkos::LayoutLeft, device_type>::host_mirror_type num_row_entries_type;
2407
2408 // typedef Kokkos::View<
2409 // size_t*,
2410 // Kokkos::LayoutLeft,
2411 // Kokkos::Device<
2412 // typename Kokkos::View<
2413 // size_t*,
2414 // Kokkos::LayoutLeft,
2415 // device_type>::host_mirror_type::execution_space,
2416 // Kokkos::HostSpace> > num_row_entries_type;
2417
2425
2431 mutable offset_device_view_type k_offRankOffsets_;
2432
2434
2445 Details::STORAGE_1D_UNPACKED;
2446
2447 bool indicesAreAllocated_ = false;
2448 bool indicesAreLocal_ = false;
2449 bool indicesAreGlobal_ = false;
2450 bool fillComplete_ = false;
2451
2456 bool noRedundancies_ = true;
2462 mutable bool haveLocalOffRankOffsets_ = false;
2463
2464 typedef typename std::map<global_ordinal_type, std::vector<global_ordinal_type>> nonlocals_type;
2465
2467 nonlocals_type nonlocals_;
2468
2484
2485 private:
2487 static bool getDebug();
2488
2491 bool debug_ = getDebug();
2492
2494 static bool getVerbose();
2495
2499 bool verbose_ = getVerbose();
2500
2501 private:
2503 mutable bool need_sync_host_uvm_access = false;
2504
2506 void set_need_sync_host_uvm_access() {
2507 need_sync_host_uvm_access = true;
2508 }
2509
2511 void execute_sync_host_uvm_access() const {
2512 if (need_sync_host_uvm_access) {
2513 Kokkos::fence("CrsGraph::execute_sync_host_uvm_access");
2514 need_sync_host_uvm_access = false;
2515 }
2516 }
2517}; // class CrsGraph
2518
2526template <class LocalOrdinal, class GlobalOrdinal, class Node>
2527Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
2529 const Teuchos::RCP<
2531 size_t maxNumEntriesPerRow = 0,
2532 const Teuchos::RCP<Teuchos::ParameterList>& params =
2533 Teuchos::null) {
2534 using Teuchos::rcp;
2535 using graph_type = CrsGraph<LocalOrdinal, GlobalOrdinal, Node>;
2536 return rcp(new graph_type(map, maxNumEntriesPerRow,
2537 params));
2538}
2539
2589template <class CrsGraphType>
2590Teuchos::RCP<CrsGraphType>
2591importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2592 const Import<typename CrsGraphType::local_ordinal_type,
2593 typename CrsGraphType::global_ordinal_type,
2594 typename CrsGraphType::node_type>& importer,
2595 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2596 typename CrsGraphType::global_ordinal_type,
2597 typename CrsGraphType::node_type>>& domainMap = Teuchos::null,
2598 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2599 typename CrsGraphType::global_ordinal_type,
2600 typename CrsGraphType::node_type>>& rangeMap = Teuchos::null,
2601 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
2602 Teuchos::RCP<CrsGraphType> destGraph;
2603 sourceGraph->importAndFillComplete(destGraph, importer, domainMap, rangeMap, params);
2604 return destGraph;
2605}
2606
2657template <class CrsGraphType>
2658Teuchos::RCP<CrsGraphType>
2659importAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2660 const Import<typename CrsGraphType::local_ordinal_type,
2661 typename CrsGraphType::global_ordinal_type,
2662 typename CrsGraphType::node_type>& rowImporter,
2663 const Import<typename CrsGraphType::local_ordinal_type,
2664 typename CrsGraphType::global_ordinal_type,
2665 typename CrsGraphType::node_type>& domainImporter,
2666 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2667 typename CrsGraphType::global_ordinal_type,
2668 typename CrsGraphType::node_type>>& domainMap,
2669 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2670 typename CrsGraphType::global_ordinal_type,
2671 typename CrsGraphType::node_type>>& rangeMap,
2672 const Teuchos::RCP<Teuchos::ParameterList>& params) {
2673 Teuchos::RCP<CrsGraphType> destGraph;
2674 sourceGraph->importAndFillComplete(destGraph, rowImporter, domainImporter, domainMap, rangeMap, params);
2675 return destGraph;
2676}
2677
2711template <class CrsGraphType>
2712Teuchos::RCP<CrsGraphType>
2713exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2714 const Export<typename CrsGraphType::local_ordinal_type,
2715 typename CrsGraphType::global_ordinal_type,
2716 typename CrsGraphType::node_type>& exporter,
2717 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2718 typename CrsGraphType::global_ordinal_type,
2719 typename CrsGraphType::node_type>>& domainMap = Teuchos::null,
2720 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2721 typename CrsGraphType::global_ordinal_type,
2722 typename CrsGraphType::node_type>>& rangeMap = Teuchos::null,
2723 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
2724 Teuchos::RCP<CrsGraphType> destGraph;
2725 sourceGraph->exportAndFillComplete(destGraph, exporter, domainMap, rangeMap, params);
2726 return destGraph;
2727}
2728
2762template <class CrsGraphType>
2763Teuchos::RCP<CrsGraphType>
2764exportAndFillCompleteCrsGraph(const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2765 const Export<typename CrsGraphType::local_ordinal_type,
2766 typename CrsGraphType::global_ordinal_type,
2767 typename CrsGraphType::node_type>& rowExporter,
2768 const Export<typename CrsGraphType::local_ordinal_type,
2769 typename CrsGraphType::global_ordinal_type,
2770 typename CrsGraphType::node_type>& domainExporter,
2771 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2772 typename CrsGraphType::global_ordinal_type,
2773 typename CrsGraphType::node_type>>& domainMap,
2774 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2775 typename CrsGraphType::global_ordinal_type,
2776 typename CrsGraphType::node_type>>& rangeMap,
2777 const Teuchos::RCP<Teuchos::ParameterList>& params) {
2778 Teuchos::RCP<CrsGraphType> destGraph;
2779 sourceGraph->exportAndFillComplete(destGraph, rowExporter, domainExporter, domainMap, rangeMap, params);
2780 return destGraph;
2781}
2782
2783} // namespace Tpetra
2784
2785#endif // TPETRA_CRSGRAPH_DECL_HPP
Forward declaration of Tpetra::BlockCrsMatrix.
Forward declaration of Tpetra::CrsGraph.
Forward declaration of Tpetra::CrsMatrix.
Stand-alone utility functions and macros.
bool isMerged() const
Whether duplicate column indices in each row have been merged.
virtual void unpackAndCombine(const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &importLIDs, Kokkos::DualView< packet_type *, buffer_device_type > imports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, const size_t constantNumPackets, const CombineMode combineMode) override
local_inds_dualv_type::t_dev::const_type getLocalIndsViewDevice(const RowInfo &rowinfo) const
Get a const, locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRo...
void insertGlobalIndices(const global_ordinal_type globalRow, const local_ordinal_type numEnt, const global_ordinal_type inds[])
Epetra compatibility version of insertGlobalIndices (see above) that takes input as a raw pointer,...
void reindexColumns(const Teuchos::RCP< const map_type > &newColMap, const Teuchos::RCP< const import_type > &newImport=Teuchos::null, const bool sortIndicesInEachRow=true)
Reindex the column indices in place, and replace the column Map. Optionally, replace the Import objec...
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.
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...
typename local_graph_device_type::HostMirror local_graph_host_type
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying a single upper bound for the number of entries in all rows on the calling proc...
row_ptrs_host_view_type getLocalRowPtrsHost() const
Get a host view of the packed row offsets.
bool isSorted() const
Whether graph indices in all rows are known to be sorted.
typename dist_object_type::buffer_device_type buffer_device_type
Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > createCrsGraph(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t maxNumEntriesPerRow=0, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Nonmember function to create an empty CrsGraph given a row Map and the max number of entries allowed ...
void setAllIndices(const typename local_graph_device_type::row_map_type &rowPointers, const typename local_graph_device_type::entries_type::non_const_type &columnIndices)
Set the graph's data directly, using 1-D storage.
void insertLocalIndices(const local_ordinal_type localRow, const Teuchos::ArrayView< const local_ordinal_type > &indices)
Insert local indices into the graph.
local_inds_host_view_type getLocalIndicesHost() const
Get a host view of the packed column indicies.
bool supportsRowViews() const override
Whether this class implements getLocalRowView() and getGlobalRowView() (it does).
size_t getNumEntriesInGlobalRow(global_ordinal_type globalRow) const override
Returns the current number of entries on this node in the specified global row.
CrsGraph(CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &originalGraph, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and an existing graph to subview. The graph created will point to t...
size_t insertGlobalIndicesImpl(const RowInfo &rowInfo, const global_ordinal_type inputGblColInds[], const size_t numInputInds, std::function< void(const size_t, const size_t, const size_t)> fun=std::function< void(const size_t, const size_t, const size_t)>())
Insert global indices, using an input RowInfo.
bool isFillComplete() const override
Whether fillComplete() has been called and the graph is in compute mode.
void setDomainRangeMaps(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap)
void fillComplete(const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Tell the graph that you are done changing its structure; set default domain and range Maps.
void swap(CrsGraph< local_ordinal_type, global_ordinal_type, Node > &graph)
Swaps the data from *this with the data and maps from graph.
::Tpetra::Map< LO, GO, node_type > map_type
CrsGraph & operator=(const CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &)=default
Assignment operator (default).
void getGlobalRowView(const global_ordinal_type gblRow, global_inds_host_view_type &gblColInds) const override
Get a const view of the given global row's global column indices.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and a single upper bound for the number of entries in all rows on t...
const row_ptrs_host_view_type & getRowPtrsUnpackedHost() const
Get the unpacked row pointers on host. Lazily make a copy from device.
void exportAndFillComplete(Teuchos::RCP< CrsGraph< local_ordinal_type, global_ordinal_type, Node > > &destGraph, const export_type &rowExporter, const export_type &domainExporter, const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params) const
Export from this to the given destination graph, and make the result fill complete.
void exportAndFillComplete(Teuchos::RCP< CrsGraph< local_ordinal_type, global_ordinal_type, Node > > &destGraph, const export_type &exporter, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null) const
Export from this to the given destination graph, and make the result fill complete.
void makeColMap(Teuchos::Array< int > &remotePIDs)
Make and set the graph's column Map.
CrsGraph(const local_graph_device_type &lclGraph, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column, domain and range maps, and a local graph, which the resulting CrsGraph...
size_t getGlobalMaxNumRowEntries() const override
Maximum number of entries in any row of the graph, over all processes in the graph's communicator.
void checkInternalState() const
Throw an exception if the internal state is not consistent.
Teuchos::RCP< const map_type > getRangeMap() const override
Returns the Map associated with the domain of this graph.
void expertStaticFillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const import_type > &importer=Teuchos::null, const Teuchos::RCP< const export_type > &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Perform a fillComplete on a graph that already has data, via setAllIndices().
size_t getNumAllocatedEntriesInGlobalRow(global_ordinal_type globalRow) const
Current number of allocated entries in the given row on the calling (MPI) process,...
Teuchos::RCP< const export_type > getExporter() const override
Returns the exporter associated with this graph.
typename device_type::execution_space execution_space
void makeImportExport(Teuchos::Array< int > &remotePIDs, const bool useRemotePIDs)
Make the Import and Export objects, if needed.
global_ordinal_type getIndexBase() const override
Returns the index base for global indices for this graph.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Backwards compatibility overload of the above method.
row_ptrs_device_view_type getLocalRowPtrsDevice() const
Get a device view of the packed row offsets.
void getLocalRowCopy(local_ordinal_type gblRow, nonconst_local_inds_host_view_type &gblColInds, size_t &numColInds) const override
Get a copy of the given row, using local indices.
local_inds_dualv_type::t_host::const_type getLocalIndsViewHost(const RowInfo &rowinfo) const
Get a const, locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRo...
bool isFillActive() const
Whether resumeFill() has been called and the graph is in edit mode.
Teuchos::RCP< const map_type > getRowMap() const override
Returns the Map that describes the row distribution in this graph.
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.
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.