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//
4// Tpetra: Templated Linear Algebra Services Package
5// Copyright (2008) Sandia Corporation
6//
7// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8// the U.S. Government retains certain rights in this software.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// ************************************************************************
38// @HEADER
39
40// clang-format off
41#ifndef TPETRA_CRSGRAPH_DECL_HPP
42#define TPETRA_CRSGRAPH_DECL_HPP
43
46
50#include "Tpetra_DistObject.hpp"
51#include "Tpetra_Exceptions.hpp"
52#include "Tpetra_RowGraph.hpp"
53#include "Tpetra_Util.hpp" // need this here for sort2
54#include "Tpetra_Details_WrappedDualView.hpp"
55
56#include "KokkosSparse_findRelOffset.hpp"
57#include "Kokkos_DualView.hpp"
58#include "Kokkos_StaticCrsGraph.hpp"
59
60#include "Teuchos_CommHelpers.hpp"
61#include "Teuchos_Describable.hpp"
62#include "Teuchos_OrdinalTraits.hpp"
63#include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
64
65#include <functional> // std::function
66#include <memory>
67
68namespace Tpetra {
69
70
71 // Forward declaration for CrsGraph::swap() test
72 template<class LocalOrdinal, class GlobalOrdinal, class Node> class crsGraph_Swap_Tester;
73
74#ifndef DOXYGEN_SHOULD_SKIP_THIS
75 namespace Details {
76 template<class LocalOrdinal,
77 class GlobalOrdinal>
78 class CrsPadding;
79 } // namespace Details
80
81 namespace { // (anonymous)
82
83 template<class ViewType>
84 struct UnmanagedView {
85 static_assert (Kokkos::is_view<ViewType>::value,
86 "ViewType must be a Kokkos::View specialization.");
87 // FIXME (mfh 02 Dec 2015) Right now, this strips away other
88 // memory traits. Christian will add an "AllTraits" enum which is
89 // the enum value of MemoryTraits<T>, that will help us fix this.
90 typedef Kokkos::View<typename ViewType::data_type,
91 typename ViewType::array_layout,
92 typename ViewType::device_type,
93 Kokkos::MemoryUnmanaged> type;
94 };
95
96 } // namespace (anonymous)
97#endif // DOXYGEN_SHOULD_SKIP_THIS
98
107 struct RowInfo {
108 size_t localRow;
109 size_t allocSize;
110 size_t numEntries;
111 size_t offset1D;
112 };
113
114 enum ELocalGlobal {
115 LocalIndices,
116 GlobalIndices
117 };
118
119 namespace Details {
151 STORAGE_1D_UNPACKED, //<! 1-D "unpacked" storage
152 STORAGE_1D_PACKED, //<! 1-D "packed" storage
153 STORAGE_UB //<! Invalid value; upper bound on enum values
154 };
155
156 } // namespace Details
157
216 template <class LocalOrdinal,
217 class GlobalOrdinal,
218 class Node>
219 class CrsGraph :
220 public RowGraph<LocalOrdinal, GlobalOrdinal, Node>,
221 public DistObject<GlobalOrdinal,
222 LocalOrdinal,
223 GlobalOrdinal,
224 Node>,
225 public Teuchos::ParameterListAcceptorDefaultBase
226 {
227 template <class S, class LO, class GO, class N>
228 friend class CrsMatrix;
229 template <class LO2, class GO2, class N2>
230 friend class CrsGraph;
231 template <class LO, class GO, class N>
232 friend class FECrsGraph;
233
236
237 public:
239 using local_ordinal_type = LocalOrdinal;
241 using global_ordinal_type = GlobalOrdinal;
243 using device_type = typename Node::device_type;
245 using execution_space = typename device_type::execution_space;
246
251 using node_type = Node;
252
255 Kokkos::StaticCrsGraph<local_ordinal_type, Kokkos::LayoutLeft,
256 device_type, void, size_t>;
257
259 using local_graph_host_type = typename local_graph_device_type::HostMirror;
260
267
268protected:
269 // Types used for CrsGraph's storage of local column indices
270 using local_inds_dualv_type =
271 Kokkos::DualView<local_ordinal_type*, device_type>;
272 using local_inds_wdv_type =
274
275 // Types used for CrsGraph's storage of global column indices
276 using global_inds_dualv_type =
277 Kokkos::DualView<global_ordinal_type*, device_type>;
278 using global_inds_wdv_type =
280
281public:
282 using row_graph_type = RowGraph<LocalOrdinal, GlobalOrdinal, Node>;
283 using row_ptrs_device_view_type =
284 typename row_graph_type::row_ptrs_device_view_type;
285 using row_ptrs_host_view_type =
286 typename row_graph_type::row_ptrs_host_view_type;
287
290 typename row_graph_type::local_inds_device_view_type;
291 using local_inds_host_view_type =
292 typename row_graph_type::local_inds_host_view_type;
293 using nonconst_local_inds_host_view_type =
294 typename row_graph_type::nonconst_local_inds_host_view_type;
295
298 typename row_graph_type::global_inds_device_view_type;
299 using global_inds_host_view_type =
300 typename row_graph_type::global_inds_host_view_type;
301 using nonconst_global_inds_host_view_type =
302 typename row_graph_type::nonconst_global_inds_host_view_type;
303
304 using offset_device_view_type =
305 typename row_ptrs_device_view_type::non_const_type;
306
308
309
322 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
323 const size_t maxNumEntriesPerRow,
324 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
325
338 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
339 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
340 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
341
355 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
356 const Teuchos::ArrayView<const size_t>& numEntPerRow,
357 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
358
359
372
376 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
377 const Teuchos::RCP<const map_type>& colMap,
378 const size_t maxNumEntriesPerRow,
379 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
380
395 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
396 const Teuchos::RCP<const map_type>& colMap,
397 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
398 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
399
415 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
416 const Teuchos::RCP<const map_type>& colMap,
417 const Teuchos::ArrayView<const size_t>& numEntPerRow,
418 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
419
420
432 CrsGraph (CrsGraph<local_ordinal_type, global_ordinal_type, node_type>& originalGraph,
433 const Teuchos::RCP<const map_type>& rowMap,
434 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
435
458 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
459 const Teuchos::RCP<const map_type>& colMap,
460 const typename local_graph_device_type::row_map_type& rowPointers,
461 const typename local_graph_device_type::entries_type::non_const_type& columnIndices,
462 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
463
486 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
487 const Teuchos::RCP<const map_type>& colMap,
488 const Teuchos::ArrayRCP<size_t>& rowPointers,
489 const Teuchos::ArrayRCP<local_ordinal_type>& columnIndices,
490 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
491
513 CrsGraph (const Teuchos::RCP<const map_type>& rowMap,
514 const Teuchos::RCP<const map_type>& colMap,
515 const local_graph_device_type& lclGraph,
516 const Teuchos::RCP<Teuchos::ParameterList>& params);
517
545 const Teuchos::RCP<const map_type>& rowMap,
546 const Teuchos::RCP<const map_type>& colMap,
547 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
548 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
549 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
550
556 const Teuchos::RCP<const map_type>& rowMap,
557 const Teuchos::RCP<const map_type>& colMap,
558 const Teuchos::RCP<const map_type>& domainMap,
559 const Teuchos::RCP<const map_type>& rangeMap,
560 const Teuchos::RCP<const import_type>& importer,
561 const Teuchos::RCP<const export_type>& exporter,
562 const Teuchos::RCP<Teuchos::ParameterList>& params =
563 Teuchos::null);
564
566 CrsGraph (const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&) = default;
567
569 CrsGraph& operator= (const CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&) = default;
570
572 CrsGraph (CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&&) = default;
573
575 CrsGraph& operator= (CrsGraph<local_ordinal_type, global_ordinal_type, node_type>&&) = default;
576
586 virtual ~CrsGraph () = default;
587
615
632 bool isIdenticalTo(const CrsGraph<LocalOrdinal, GlobalOrdinal, Node> &graph) const;
633
635
637
639 void
640 setParameterList (const Teuchos::RCP<Teuchos::ParameterList>& params) override;
641
643 Teuchos::RCP<const Teuchos::ParameterList>
644 getValidParameters () const override;
645
647
649
671 void
673 const Teuchos::ArrayView<const global_ordinal_type>& indices);
674
681 void
683 const local_ordinal_type numEnt,
684 const global_ordinal_type inds[]);
685
687
701 void
703 const Teuchos::ArrayView<const local_ordinal_type>& indices);
704
711 void
713 const local_ordinal_type numEnt,
714 const local_ordinal_type inds[]);
715
717
727
729
731
740
759 void
760 resumeFill (const Teuchos::RCP<Teuchos::ParameterList>& params =
761 Teuchos::null);
762
800 void
801 fillComplete (const Teuchos::RCP<const map_type>& domainMap,
802 const Teuchos::RCP<const map_type>& rangeMap,
803 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
804
832 void
833 fillComplete (const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
834
863 void
864 expertStaticFillComplete (const Teuchos::RCP<const map_type>& domainMap,
865 const Teuchos::RCP<const map_type>& rangeMap,
866 const Teuchos::RCP<const import_type>& importer =
867 Teuchos::null,
868 const Teuchos::RCP<const export_type>& exporter =
869 Teuchos::null,
870 const Teuchos::RCP<Teuchos::ParameterList>& params =
871 Teuchos::null);
873
875
877 Teuchos::RCP<const Teuchos::Comm<int> > getComm() const override;
878
879
881 Teuchos::RCP<const map_type> getRowMap () const override;
882
884 Teuchos::RCP<const map_type> getColMap () const override;
885
887 Teuchos::RCP<const map_type> getDomainMap () const override;
888
890 Teuchos::RCP<const map_type> getRangeMap () const override;
891
893 Teuchos::RCP<const import_type> getImporter () const override;
894
896 Teuchos::RCP<const export_type> getExporter () const override;
897
899
902
904
908
910 size_t getLocalNumRows () const override;
911
913
915 size_t getLocalNumCols () const override;
916
919
921
924
934 size_t getLocalNumEntries() const override;
935
937
938 size_t
940
947 size_t
949
969 size_t getLocalAllocationSize () const;
970
979
988
1002 size_t getGlobalMaxNumRowEntries () const override;
1003
1008 size_t getLocalMaxNumRowEntries () const override;
1009
1025 bool hasColMap () const override;
1026
1027
1035 bool isLocallyIndexed () const override;
1036
1044 bool isGloballyIndexed () const override;
1045
1047 bool isFillComplete () const override;
1048
1050 bool isFillActive () const;
1051
1059 bool isSorted () const;
1060
1062
1068 bool isStorageOptimized () const;
1069
1070
1076 void
1078 nonconst_global_inds_host_view_type &gblColInds,
1079 size_t& numColInds) const override;
1080
1088 void
1090 nonconst_local_inds_host_view_type &gblColInds,
1091 size_t& numColInds) const override;
1092
1103 void
1105 const global_ordinal_type gblRow,
1106 global_inds_host_view_type &gblColInds) const override;
1107
1108
1111 bool supportsRowViews () const override;
1112
1113
1124 void
1126 const LocalOrdinal lclRow,
1127 local_inds_host_view_type &lclColInds) const override;
1128
1129
1131
1133
1135 std::string description () const override;
1136
1139 void
1140 describe (Teuchos::FancyOStream& out,
1141 const Teuchos::EVerbosityLevel verbLevel =
1142 Teuchos::Describable::verbLevel_default) const override;
1143
1145
1147
1155
1156 virtual bool
1157 checkSizes (const SrcDistObject& source) override;
1158
1159 // clang-format on
1160 using dist_object_type::
1161 copyAndPermute;
1163 // clang-format off
1164
1165 virtual void
1167 (const SrcDistObject& source,
1168 const size_t numSameIDs,
1169 const Kokkos::DualView<const local_ordinal_type*,
1170 buffer_device_type>& permuteToLIDs,
1171 const Kokkos::DualView<const local_ordinal_type*,
1172 buffer_device_type>& permuteFromLIDs,
1173 const CombineMode CM) override;
1174
1175 using padding_type = Details::CrsPadding<
1177
1178 void
1179 applyCrsPadding(const padding_type& padding,
1180 const bool verbose);
1181
1182 std::unique_ptr<padding_type>
1183 computeCrsPadding(
1185 node_type>& source,
1186 const size_t numSameIDs,
1187 const Kokkos::DualView<const local_ordinal_type*,
1188 buffer_device_type>& permuteToLIDs,
1189 const Kokkos::DualView<const local_ordinal_type*,
1190 buffer_device_type>& permuteFromLIDs,
1191 const bool verbose) const;
1192
1193 // This actually modifies imports by sorting it.
1194 std::unique_ptr<padding_type>
1195 computeCrsPaddingForImports(
1196 const Kokkos::DualView<const local_ordinal_type*,
1197 buffer_device_type>& importLIDs,
1198 Kokkos::DualView<packet_type*, buffer_device_type> imports,
1199 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1200 const bool verbose) const;
1201
1202 std::unique_ptr<padding_type>
1203 computePaddingForCrsMatrixUnpack(
1204 const Kokkos::DualView<const local_ordinal_type*,
1205 buffer_device_type>& importLIDs,
1206 Kokkos::DualView<char*, buffer_device_type> imports,
1207 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1208 const bool verbose) const;
1209
1210 void
1211 computeCrsPaddingForSameIDs(
1212 padding_type& padding,
1214 node_type>& source,
1215 const local_ordinal_type numSameIDs) const;
1216
1217 void
1218 computeCrsPaddingForPermutedIDs(
1219 padding_type& padding,
1221 node_type>& source,
1222 const Kokkos::DualView<const local_ordinal_type*,
1223 buffer_device_type>& permuteToLIDs,
1224 const Kokkos::DualView<const local_ordinal_type*,
1225 buffer_device_type>& permuteFromLIDs) const;
1226
1227 virtual void
1228 packAndPrepare(
1229 const SrcDistObject& source,
1230 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& exportLIDs,
1231 Kokkos::DualView<packet_type*, buffer_device_type>& exports,
1232 Kokkos::DualView<size_t*, buffer_device_type> numPacketsPerLID,
1233 size_t& constantNumPackets) override;
1234
1235 // clang-format on
1240 // clang-format off
1241
1242 virtual void
1243 pack (const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1244 Teuchos::Array<global_ordinal_type>& exports,
1245 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1246 size_t& constantNumPackets) const override;
1247
1248 void
1249 packFillActive (const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1250 Teuchos::Array<global_ordinal_type>& exports,
1251 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1252 size_t& constantNumPackets) const;
1253
1254 void
1255 packFillActiveNew (const Kokkos::DualView<const local_ordinal_type*,
1256 buffer_device_type>& exportLIDs,
1257 Kokkos::DualView<packet_type*,
1258 buffer_device_type>& exports,
1259 Kokkos::DualView<size_t*,
1260 buffer_device_type> numPacketsPerLID,
1261 size_t& constantNumPackets) const;
1262
1263 // clang-format on
1268 // clang-format off
1269
1270 virtual void
1272 (const Kokkos::DualView<const local_ordinal_type*,
1273 buffer_device_type>& importLIDs,
1274 Kokkos::DualView<packet_type*,
1275 buffer_device_type> imports,
1276 Kokkos::DualView<size_t*,
1277 buffer_device_type> numPacketsPerLID,
1278 const size_t constantNumPackets,
1279 const CombineMode combineMode) override;
1280
1282
1284
1327 void
1328 getLocalDiagOffsets (const Kokkos::View<size_t*, device_type, Kokkos::MemoryUnmanaged>& offsets) const;
1329
1331 void
1332 getLocalOffRankOffsets (offset_device_view_type& offsets) const;
1333
1343 void
1344 getLocalDiagOffsets (Teuchos::ArrayRCP<size_t>& offsets) const;
1345
1355 void
1356 setAllIndices (const typename local_graph_device_type::row_map_type& rowPointers,
1357 const typename local_graph_device_type::entries_type::non_const_type& columnIndices);
1358
1368 void
1369 setAllIndices (const Teuchos::ArrayRCP<size_t> & rowPointers,
1370 const Teuchos::ArrayRCP<local_ordinal_type> & columnIndices);
1371
1374 row_ptrs_host_view_type getLocalRowPtrsHost () const;
1375
1378 row_ptrs_device_view_type getLocalRowPtrsDevice () const;
1379
1381 local_inds_host_view_type getLocalIndicesHost () const;
1382
1385
1404 void replaceColMap (const Teuchos::RCP<const map_type>& newColMap);
1405
1425 void
1426 reindexColumns (const Teuchos::RCP<const map_type>& newColMap,
1427 const Teuchos::RCP<const import_type>& newImport = Teuchos::null,
1428 const bool sortIndicesInEachRow = true);
1429
1436 void
1437 replaceDomainMap (const Teuchos::RCP<const map_type>& newDomainMap);
1438
1452 void
1453 replaceDomainMapAndImporter (const Teuchos::RCP<const map_type>& newDomainMap,
1454 const Teuchos::RCP<const import_type>& newImporter);
1455
1462 void
1463 replaceRangeMap (const Teuchos::RCP<const map_type>& newRangeMap);
1464
1478 void
1479 replaceRangeMapAndExporter (const Teuchos::RCP<const map_type>& newRangeMap,
1480 const Teuchos::RCP<const export_type>& newExporter);
1481
1510 virtual void
1511 removeEmptyProcessesInPlace (const Teuchos::RCP<const map_type>& newMap) override;
1513
1514 template<class DestViewType, class SrcViewType,
1515 class DestOffsetViewType, class SrcOffsetViewType >
1516 struct pack_functor {
1517 typedef typename DestViewType::execution_space execution_space;
1518 SrcViewType src;
1519 DestViewType dest;
1520 SrcOffsetViewType src_offset;
1521 DestOffsetViewType dest_offset;
1522 typedef typename DestOffsetViewType::non_const_value_type ScalarIndx;
1523
1524 pack_functor(DestViewType dest_,
1525 const SrcViewType src_,
1526 DestOffsetViewType dest_offset_,
1527 const SrcOffsetViewType src_offset_):
1528 src(src_),dest(dest_),
1529 src_offset(src_offset_),dest_offset(dest_offset_) {};
1530
1531 KOKKOS_INLINE_FUNCTION
1532 void operator() (size_t row) const {
1533 ScalarIndx i = src_offset(row);
1534 ScalarIndx j = dest_offset(row);
1535 const ScalarIndx k = dest_offset(row+1);
1536 for(;j<k;j++,i++) {
1537 dest(j) = src(i);
1538 }
1539 }
1540 };
1541
1542 private:
1543 // Friend declaration for nonmember function.
1544 template<class CrsGraphType>
1545 friend Teuchos::RCP<CrsGraphType>
1546 importAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1547 const Import<typename CrsGraphType::local_ordinal_type,
1548 typename CrsGraphType::global_ordinal_type,
1549 typename CrsGraphType::node_type>& importer,
1550 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1551 typename CrsGraphType::global_ordinal_type,
1552 typename CrsGraphType::node_type> >& domainMap,
1553 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1554 typename CrsGraphType::global_ordinal_type,
1555 typename CrsGraphType::node_type> >& rangeMap,
1556 const Teuchos::RCP<Teuchos::ParameterList>& params);
1557
1558 // Friend declaration for nonmember function.
1559 template<class CrsGraphType>
1560 friend Teuchos::RCP<CrsGraphType>
1561 importAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1562 const Import<typename CrsGraphType::local_ordinal_type,
1563 typename CrsGraphType::global_ordinal_type,
1564 typename CrsGraphType::node_type>& rowImporter,
1565 const Import<typename CrsGraphType::local_ordinal_type,
1566 typename CrsGraphType::global_ordinal_type,
1567 typename CrsGraphType::node_type>& domainImporter,
1568 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1569 typename CrsGraphType::global_ordinal_type,
1570 typename CrsGraphType::node_type> >& domainMap,
1571 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1572 typename CrsGraphType::global_ordinal_type,
1573 typename CrsGraphType::node_type> >& rangeMap,
1574 const Teuchos::RCP<Teuchos::ParameterList>& params);
1575
1576
1577 // Friend declaration for nonmember function.
1578 template<class CrsGraphType>
1579 friend Teuchos::RCP<CrsGraphType>
1580 exportAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1581 const Export<typename CrsGraphType::local_ordinal_type,
1582 typename CrsGraphType::global_ordinal_type,
1583 typename CrsGraphType::node_type>& exporter,
1584 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1585 typename CrsGraphType::global_ordinal_type,
1586 typename CrsGraphType::node_type> >& domainMap,
1587 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1588 typename CrsGraphType::global_ordinal_type,
1589 typename CrsGraphType::node_type> >& rangeMap,
1590 const Teuchos::RCP<Teuchos::ParameterList>& params);
1591
1592 // Friend declaration for nonmember function.
1593 template<class CrsGraphType>
1594 friend Teuchos::RCP<CrsGraphType>
1595 exportAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1596 const Export<typename CrsGraphType::local_ordinal_type,
1597 typename CrsGraphType::global_ordinal_type,
1598 typename CrsGraphType::node_type>& rowExporter,
1599 const Export<typename CrsGraphType::local_ordinal_type,
1600 typename CrsGraphType::global_ordinal_type,
1601 typename CrsGraphType::node_type>& domainExporter,
1602 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1603 typename CrsGraphType::global_ordinal_type,
1604 typename CrsGraphType::node_type> >& domainMap,
1605 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
1606 typename CrsGraphType::global_ordinal_type,
1607 typename CrsGraphType::node_type> >& rangeMap,
1608 const Teuchos::RCP<Teuchos::ParameterList>& params);
1609
1610 public:
1626 void
1627 importAndFillComplete (Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node> >& destGraph,
1628 const import_type& importer,
1629 const Teuchos::RCP<const map_type>& domainMap,
1630 const Teuchos::RCP<const map_type>& rangeMap,
1631 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1632
1648 void
1649 importAndFillComplete (Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node> >& destGraph,
1650 const import_type& rowImporter,
1651 const import_type& domainImporter,
1652 const Teuchos::RCP<const map_type>& domainMap,
1653 const Teuchos::RCP<const map_type>& rangeMap,
1654 const Teuchos::RCP<Teuchos::ParameterList>& params) const;
1655
1656
1672 void
1673 exportAndFillComplete (Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node> >& destGraph,
1674 const export_type& exporter,
1675 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1676 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1677 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1678
1694 void
1695 exportAndFillComplete (Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node> >& destGraph,
1696 const export_type& rowExporter,
1697 const export_type& domainExporter,
1698 const Teuchos::RCP<const map_type>& domainMap,
1699 const Teuchos::RCP<const map_type>& rangeMap,
1700 const Teuchos::RCP<Teuchos::ParameterList>& params) const;
1701
1702
1703 private:
1724 void
1725 transferAndFillComplete (Teuchos::RCP<CrsGraph<local_ordinal_type, global_ordinal_type, Node> >& destGraph,
1726 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, Node>& rowTransfer,
1727 const Teuchos::RCP<const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, Node> > & domainTransfer,
1728 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1729 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1730 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) const;
1731
1732 protected:
1733 // these structs are conveniences, to cut down on the number of
1734 // arguments to some of the methods below.
1735 struct SLocalGlobalViews {
1736 Teuchos::ArrayView<const global_ordinal_type> ginds;
1737 Teuchos::ArrayView<const local_ordinal_type> linds;
1738 };
1739 struct SLocalGlobalNCViews {
1740 Teuchos::ArrayView<global_ordinal_type> ginds;
1741 Teuchos::ArrayView<local_ordinal_type> linds;
1742 };
1743
1744 bool indicesAreAllocated () const;
1745
1746 void
1747 allocateIndices(const ELocalGlobal lg, const bool verbose=false);
1748
1750
1751
1761 void makeColMap (Teuchos::Array<int>& remotePIDs);
1762
1783 std::pair<size_t, std::string>
1784 makeIndicesLocal(const bool verbose=false);
1785
1794 void
1795 makeImportExport (Teuchos::Array<int>& remotePIDs,
1796 const bool useRemotePIDs);
1797
1799
1801
1836 size_t
1838 const SLocalGlobalViews& newInds,
1839 const ELocalGlobal lg,
1840 const ELocalGlobal I);
1841
1851 size_t
1853 const global_ordinal_type inputGblColInds[],
1854 const size_t numInputInds);
1855
1865 size_t
1867 const global_ordinal_type inputGblColInds[],
1868 const size_t numInputInds,
1869 std::function<void(const size_t, const size_t, const size_t)> fun =
1870 std::function<void(const size_t, const size_t, const size_t)>());
1871
1872 void
1873 insertLocalIndicesImpl (const local_ordinal_type lclRow,
1874 const Teuchos::ArrayView<const local_ordinal_type>& gblColInds,
1875 std::function<void(const size_t, const size_t, const size_t)> fun =
1876 std::function<void(const size_t, const size_t, const size_t)>());
1877
1893 size_t
1895 const Teuchos::ArrayView<const global_ordinal_type>& indices,
1896 std::function<void(const size_t, const size_t, const size_t)> fun) const;
1897
1909 void
1911 const global_ordinal_type gblColInds[],
1912 const local_ordinal_type numGblColInds);
1913
1925 void
1927 const global_ordinal_type gblColInds[],
1928 const local_ordinal_type numGblColInds);
1929
1934 static const bool useAtomicUpdatesByDefault =
1935#ifdef KOKKOS_ENABLE_SERIAL
1936 ! std::is_same<execution_space, Kokkos::Serial>::value;
1937#else
1938 true;
1939#endif // KOKKOS_ENABLE_SERIAL
1940
1942
1944
1946 bool isMerged () const;
1947
1954
1955 private:
1960 void
1961 sortAndMergeAllIndices (const bool sorted, const bool merged);
1962
1963 // mfh 08 May 2017: I only restore "protected" here for backwards
1964 // compatibility.
1965 protected:
1974 size_t sortAndMergeRowIndices (const RowInfo& rowInfo,
1975 const bool sorted,
1976 const bool merged);
1978
1988 void
1989 setDomainRangeMaps (const Teuchos::RCP<const map_type>& domainMap,
1990 const Teuchos::RCP<const map_type>& rangeMap);
1991
1992 void staticAssertions() const;
1993 void clearGlobalConstants();
1994
1995 public:
1998
2017
2018 bool haveLocalOffRankOffsets() const { return haveLocalOffRankOffsets_;}
2019
2020 protected:
2041
2045
2059
2060 public:
2061
2070 local_graph_host_type getLocalGraphHost () const;
2071
2072 protected:
2073
2074 void fillLocalGraph (const Teuchos::RCP<Teuchos::ParameterList>& params);
2075
2077 void checkInternalState () const;
2078
2082 void swap(CrsGraph<local_ordinal_type, global_ordinal_type, Node> & graph);
2083
2084 // Friend the tester for CrsGraph::swap
2085 friend class Tpetra::crsGraph_Swap_Tester<local_ordinal_type, global_ordinal_type, Node>;
2086
2087
2089 Teuchos::RCP<const map_type> rowMap_;
2091 Teuchos::RCP<const map_type> colMap_;
2093 Teuchos::RCP<const map_type> rangeMap_;
2095 Teuchos::RCP<const map_type> domainMap_;
2096
2103 Teuchos::RCP<const import_type> importer_;
2104
2110 Teuchos::RCP<const export_type> exporter_;
2111
2117 Teuchos::OrdinalTraits<size_t>::invalid();
2118
2123 Teuchos::OrdinalTraits<global_size_t>::invalid();
2124
2130 Teuchos::OrdinalTraits<global_size_t>::invalid();
2131
2132 private:
2133 // Replacement for device view k_rowPtrs_
2134 // Device view rowPtrsUnpacked_dev_ takes place of k_rowPtrs_
2135 // Host view rowPtrsUnpacked_host_ takes place of copies and use of getEntryOnHost
2136 // Wish this could be a WrappedDualView, but deep_copies in DualView
2137 // don't work with const data views (e.g., StaticCrsGraph::row_map)
2138 // k_rowPtrs_ is offsets wrt the ALLOCATED indices array, not necessarily
2139 // the ACTUAL compressed indices array.
2140 // When !OptimizedStorage, k_rowPtrs_ may differ from ACTUAL compressed
2141 // indices array. (Karen is skeptical that !OptimizedStorage works)
2142 // When OptimizedStorage, rowPtrsUnpacked_ = k_rowPtrsPacked_
2143
2144 row_ptrs_device_view_type rowPtrsUnpacked_dev_;
2145 mutable row_ptrs_host_view_type rowPtrsUnpacked_host_;
2146
2147 // Row offsets into the actual graph local indices
2148 // Device view rowPtrsUnpacked_dev_ takes place of lclGraph_.row_map
2149
2150 row_ptrs_device_view_type rowPtrsPacked_dev_;
2151 mutable row_ptrs_host_view_type rowPtrsPacked_host_;
2152
2154 bool packedUnpackedRowPtrsMatch_ = false;
2155
2156 protected:
2157 void setRowPtrsUnpacked(const row_ptrs_device_view_type &dview) {
2158 packedUnpackedRowPtrsMatch_ = false;
2159 rowPtrsUnpacked_dev_ = dview;
2160 //Make sure stale host rowptrs are not kept
2161 rowPtrsUnpacked_host_ = row_ptrs_host_view_type();
2162 }
2163
2165 const row_ptrs_device_view_type& getRowPtrsUnpackedDevice() const
2166 {
2167 return rowPtrsUnpacked_dev_;
2168 }
2169
2171 const row_ptrs_host_view_type& getRowPtrsUnpackedHost() const
2172 {
2173 if(rowPtrsUnpacked_host_.extent(0) != rowPtrsUnpacked_dev_.extent(0))
2174 {
2175 //NOTE: not just using create_mirror_view here, because
2176 //we do want host/device to be in different memory, even if we're using a SharedSpace.
2177 //This is so that reads will never trigger a host-device transfer.
2178 //The exception is when 'device' views are HostSpace, then don't make another copy.
2179 if constexpr(std::is_same_v<typename Node::memory_space, Kokkos::HostSpace>)
2180 {
2181 rowPtrsUnpacked_host_ = rowPtrsUnpacked_dev_;
2182 }
2183 else
2184 {
2185 //Have to make this temporary because rowptrs are const-valued
2186 typename row_ptrs_host_view_type::non_const_type rowPtrsTemp(
2187 Kokkos::view_alloc(Kokkos::WithoutInitializing, "rowPtrsUnpacked_host_"), rowPtrsUnpacked_dev_.extent(0));
2188 Kokkos::deep_copy(rowPtrsTemp, rowPtrsUnpacked_dev_);
2189 rowPtrsUnpacked_host_= rowPtrsTemp;
2190 }
2191 //Also keep packed/unpacked views in sync, if they are known to have the same contents
2192 if(packedUnpackedRowPtrsMatch_)
2193 {
2194 rowPtrsPacked_host_ = rowPtrsUnpacked_host_;
2195 }
2196 }
2197 return rowPtrsUnpacked_host_;
2198 }
2199
2200 void setRowPtrsPacked(const row_ptrs_device_view_type &dview) {
2201 packedUnpackedRowPtrsMatch_ = false;
2202 rowPtrsPacked_dev_ = dview;
2203 //Make sure stale host rowptrs are not kept
2204 rowPtrsPacked_host_ = row_ptrs_host_view_type();
2205 }
2206
2208 const row_ptrs_device_view_type& getRowPtrsPackedDevice() const
2209 {
2210 return rowPtrsPacked_dev_;
2211 }
2212
2214 const row_ptrs_host_view_type& getRowPtrsPackedHost() const
2215 {
2216 if(rowPtrsPacked_host_.extent(0) != rowPtrsPacked_dev_.extent(0))
2217 {
2218 //NOTE: not just using create_mirror_view here, because
2219 //we do want host/device to be in different memory, even if we're using a SharedSpace.
2220 //This is so that reads will never trigger a host-device transfer.
2221 //The exception is when 'device' views are HostSpace, then don't make another copy.
2222 if constexpr(std::is_same_v<typename Node::memory_space, Kokkos::HostSpace>)
2223 {
2224 rowPtrsPacked_host_ = rowPtrsPacked_dev_;
2225 }
2226 else
2227 {
2228 //Have to make this temporary because rowptrs are const-valued
2229 typename row_ptrs_host_view_type::non_const_type rowPtrsTemp(
2230 Kokkos::view_alloc(Kokkos::WithoutInitializing, "rowPtrsPacked_host_"), rowPtrsPacked_dev_.extent(0));
2231 Kokkos::deep_copy(rowPtrsTemp, rowPtrsPacked_dev_);
2232 rowPtrsPacked_host_= rowPtrsTemp;
2233 }
2234 //Also keep packed/unpacked views in sync, if they are known to have the same contents
2235 if(packedUnpackedRowPtrsMatch_)
2236 {
2237 rowPtrsUnpacked_host_ = rowPtrsPacked_host_;
2238 }
2239 }
2240 return rowPtrsPacked_host_;
2241 }
2242
2243 // There are common cases where both packed and unpacked views are set to the same array.
2244 // Doing this in a single call can reduce dataspace on host, and reduce runtime by
2245 // removing a deep_copy from device to host.
2246
2247 void setRowPtrs(const row_ptrs_device_view_type &dview) {
2248 packedUnpackedRowPtrsMatch_ = true;
2249 rowPtrsUnpacked_dev_ = dview;
2250 rowPtrsPacked_dev_ = dview;
2251 //Make sure stale host rowptrs are not kept
2252 rowPtrsUnpacked_host_ = row_ptrs_host_view_type();
2253 rowPtrsPacked_host_ = row_ptrs_host_view_type();
2254 }
2255
2256 //TODO: Make private -- matrix shouldn't access directly the guts of graph
2257
2271 local_inds_wdv_type lclIndsUnpacked_wdv;
2272
2286 mutable local_inds_wdv_type lclIndsPacked_wdv;
2287
2288 //TODO: Make private -- matrix shouldn't access directly the guts of graph
2289
2299
2300 // TODO: Make private -- matrix shouldn't access directly
2301 global_inds_wdv_type gblInds_wdv;
2302
2306 typename local_inds_dualv_type::t_host::const_type
2307 getLocalIndsViewHost (const RowInfo& rowinfo) const;
2308
2312 typename local_inds_dualv_type::t_dev::const_type
2313 getLocalIndsViewDevice (const RowInfo& rowinfo) const;
2314
2318 typename global_inds_dualv_type::t_host::const_type
2319 getGlobalIndsViewHost (const RowInfo& rowinfo) const;
2320
2324 typename global_inds_dualv_type::t_dev::const_type
2325 getGlobalIndsViewDevice (const RowInfo& rowinfo) const;
2326
2330 typename local_inds_dualv_type::t_host
2332
2333 // FOR NOW...
2334 // KEEP k_numRowEntries_ (though switch from HostMirror to Host)
2335 // KEEP k_numAllocPerRow_ (though perhaps switch from HostMirror to Host)
2336
2362 typename Kokkos::View<const size_t*, device_type>::HostMirror
2364
2375
2377
2378
2400
2408 typedef typename Kokkos::View<size_t*, Kokkos::LayoutLeft, device_type>::HostMirror num_row_entries_type;
2409
2410 // typedef Kokkos::View<
2411 // size_t*,
2412 // Kokkos::LayoutLeft,
2413 // Kokkos::Device<
2414 // typename Kokkos::View<
2415 // size_t*,
2416 // Kokkos::LayoutLeft,
2417 // device_type>::HostMirror::execution_space,
2418 // Kokkos::HostSpace> > num_row_entries_type;
2419
2427
2433 mutable offset_device_view_type k_offRankOffsets_;
2434
2436
2447 Details::STORAGE_1D_UNPACKED;
2448
2449 bool indicesAreAllocated_ = false;
2450 bool indicesAreLocal_ = false;
2451 bool indicesAreGlobal_ = false;
2452 bool fillComplete_ = false;
2453
2458 bool noRedundancies_ = true;
2464 mutable bool haveLocalOffRankOffsets_ = false;
2465
2466 typedef typename std::map<global_ordinal_type, std::vector<global_ordinal_type> > nonlocals_type;
2467
2469 nonlocals_type nonlocals_;
2470
2486
2487 private:
2489 static bool getDebug();
2490
2493 bool debug_ = getDebug();
2494
2496 static bool getVerbose();
2497
2501 bool verbose_ = getVerbose();
2502
2503 private:
2505 mutable bool need_sync_host_uvm_access = false;
2506
2508 void set_need_sync_host_uvm_access() {
2509 need_sync_host_uvm_access = true;
2510 }
2511
2513 void execute_sync_host_uvm_access() const {
2514 if(need_sync_host_uvm_access) {
2515 Kokkos::fence();
2516 need_sync_host_uvm_access = false;
2517 }
2518 }
2519 }; // class CrsGraph
2520
2528 template <class LocalOrdinal, class GlobalOrdinal, class Node>
2529 Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
2531 const Teuchos::RCP<
2533 size_t maxNumEntriesPerRow = 0,
2534 const Teuchos::RCP<Teuchos::ParameterList>& params =
2535 Teuchos::null)
2536 {
2537 using Teuchos::rcp;
2538 using graph_type = CrsGraph<LocalOrdinal, GlobalOrdinal, Node>;
2539 return rcp(new graph_type(map, maxNumEntriesPerRow,
2540 params));
2541 }
2542
2592 template<class CrsGraphType>
2593 Teuchos::RCP<CrsGraphType>
2594 importAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2595 const Import<typename CrsGraphType::local_ordinal_type,
2596 typename CrsGraphType::global_ordinal_type,
2597 typename CrsGraphType::node_type>& importer,
2598 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2599 typename CrsGraphType::global_ordinal_type,
2600 typename CrsGraphType::node_type> >& domainMap = Teuchos::null,
2601 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2602 typename CrsGraphType::global_ordinal_type,
2603 typename CrsGraphType::node_type> >& rangeMap = Teuchos::null,
2604 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
2605 {
2606 Teuchos::RCP<CrsGraphType> destGraph;
2607 sourceGraph->importAndFillComplete (destGraph,importer,domainMap, rangeMap, params);
2608 return destGraph;
2609 }
2610
2661 template<class CrsGraphType>
2662 Teuchos::RCP<CrsGraphType>
2663 importAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2664 const Import<typename CrsGraphType::local_ordinal_type,
2665 typename CrsGraphType::global_ordinal_type,
2666 typename CrsGraphType::node_type>& rowImporter,
2667 const Import<typename CrsGraphType::local_ordinal_type,
2668 typename CrsGraphType::global_ordinal_type,
2669 typename CrsGraphType::node_type>& domainImporter,
2670 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2671 typename CrsGraphType::global_ordinal_type,
2672 typename CrsGraphType::node_type> >& domainMap,
2673 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2674 typename CrsGraphType::global_ordinal_type,
2675 typename CrsGraphType::node_type> >& rangeMap,
2676 const Teuchos::RCP<Teuchos::ParameterList>& params)
2677 {
2678 Teuchos::RCP<CrsGraphType> destGraph;
2679 sourceGraph->importAndFillComplete (destGraph,rowImporter,domainImporter, domainMap, rangeMap, params);
2680 return destGraph;
2681 }
2682
2716 template<class CrsGraphType>
2717 Teuchos::RCP<CrsGraphType>
2718 exportAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2719 const Export<typename CrsGraphType::local_ordinal_type,
2720 typename CrsGraphType::global_ordinal_type,
2721 typename CrsGraphType::node_type>& exporter,
2722 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2723 typename CrsGraphType::global_ordinal_type,
2724 typename CrsGraphType::node_type> >& domainMap = Teuchos::null,
2725 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2726 typename CrsGraphType::global_ordinal_type,
2727 typename CrsGraphType::node_type> >& rangeMap = Teuchos::null,
2728 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
2729 {
2730 Teuchos::RCP<CrsGraphType> destGraph;
2731 sourceGraph->exportAndFillComplete (destGraph,exporter,domainMap, rangeMap, params);
2732 return destGraph;
2733 }
2734
2768 template<class CrsGraphType>
2769 Teuchos::RCP<CrsGraphType>
2770 exportAndFillCompleteCrsGraph (const Teuchos::RCP<const CrsGraphType>& sourceGraph,
2771 const Export<typename CrsGraphType::local_ordinal_type,
2772 typename CrsGraphType::global_ordinal_type,
2773 typename CrsGraphType::node_type>& rowExporter,
2774 const Export<typename CrsGraphType::local_ordinal_type,
2775 typename CrsGraphType::global_ordinal_type,
2776 typename CrsGraphType::node_type>& domainExporter,
2777 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2778 typename CrsGraphType::global_ordinal_type,
2779 typename CrsGraphType::node_type> >& domainMap,
2780 const Teuchos::RCP<const Map<typename CrsGraphType::local_ordinal_type,
2781 typename CrsGraphType::global_ordinal_type,
2782 typename CrsGraphType::node_type> >& rangeMap,
2783 const Teuchos::RCP<Teuchos::ParameterList>& params)
2784 {
2785 Teuchos::RCP<CrsGraphType> destGraph;
2786 sourceGraph->exportAndFillComplete (destGraph,rowExporter,domainExporter,domainMap, rangeMap, params);
2787 return destGraph;
2788 }
2789
2790
2791} // namespace Tpetra
2792
2793#endif // TPETRA_CRSGRAPH_DECL_HPP
Forward declaration of Tpetra::BlockCrsMatrix.
Forward declaration of Tpetra::CrsGraph.
Forward declaration of Tpetra::CrsMatrix.
Stand-alone utility functions and macros.
bool isMerged() const
Whether duplicate column indices in each row have been merged.
virtual void unpackAndCombine(const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &importLIDs, Kokkos::DualView< packet_type *, buffer_device_type > imports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, const size_t constantNumPackets, const CombineMode combineMode) override
local_inds_dualv_type::t_dev::const_type getLocalIndsViewDevice(const RowInfo &rowinfo) const
Get a const, locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRo...
void insertGlobalIndices(const global_ordinal_type globalRow, const local_ordinal_type numEnt, const global_ordinal_type inds[])
Epetra compatibility version of insertGlobalIndices (see above) that takes input as a raw pointer,...
void reindexColumns(const Teuchos::RCP< const map_type > &newColMap, const Teuchos::RCP< const import_type > &newImport=Teuchos::null, const bool sortIndicesInEachRow=true)
Reindex the column indices in place, and replace the column Map. Optionally, replace the Import objec...
global_inds_dualv_type::t_host::const_type getGlobalIndsViewHost(const RowInfo &rowinfo) const
Get a const, globally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myR...
size_t getNumEntriesInLocalRow(local_ordinal_type localRow) const override
Get the number of entries in the given row (local index).
Teuchos::RCP< CrsGraphType > importAndFillCompleteCrsGraph(const Teuchos::RCP< const CrsGraphType > &sourceGraph, const Import< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &rowImporter, const Import< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &domainImporter, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &domainMap, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Nonmember CrsGraph constructor that fuses Import and fillComplete().
Teuchos::RCP< const map_type > getColMap() const override
Returns the Map that describes the column distribution in this graph.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Default parameter list suitable for validation.
::Tpetra::Import< LO, GO, node_type > import_type
void insertGlobalIndicesIntoNonownedRows(const global_ordinal_type gblRow, const global_ordinal_type gblColInds[], const local_ordinal_type numGblColInds)
Implementation of insertGlobalIndices for nonowned rows.
std::pair< size_t, std::string > makeIndicesLocal(const bool verbose=false)
Convert column indices from global to local.
void insertLocalIndices(const local_ordinal_type localRow, const local_ordinal_type numEnt, const local_ordinal_type inds[])
Epetra compatibility version of insertLocalIndices (see above) that takes input as a raw pointer,...
local_inds_device_view_type getLocalIndicesDevice() const
Get a device view of the packed column indicies.
global_size_t getGlobalNumEntries() const override
Returns the global number of entries in the graph.
bool isIdenticalTo(const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > &graph) const
Create a cloned CrsGraph for a different Node type.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const override
Returns the communicator.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void globalAssemble()
Communicate nonlocal contributions to other processes.
RowInfo getRowInfoFromGlobalRowIndex(const global_ordinal_type gblRow) const
Get information about the locally owned row with global index gblRow.
void getLocalDiagOffsets(const Kokkos::View< size_t *, device_type, Kokkos::MemoryUnmanaged > &offsets) const
Get offsets of the diagonal entries in the graph.
size_t findGlobalIndices(const RowInfo &rowInfo, const Teuchos::ArrayView< const global_ordinal_type > &indices, std::function< void(const size_t, const size_t, const size_t)> fun) const
Finds indices in the given row.
CrsGraph(const CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &)=default
Copy constructor (default).
void fillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Tell the graph that you are done changing its structure.
size_t sortAndMergeRowIndices(const RowInfo &rowInfo, const bool sorted, const bool merged)
Sort and merge duplicate column indices in the given row.
Teuchos::RCP< const import_type > importer_
void setAllIndices(const Teuchos::ArrayRCP< size_t > &rowPointers, const Teuchos::ArrayRCP< local_ordinal_type > &columnIndices)
Set the graph's data directly, using 1-D storage.
Teuchos::RCP< CrsGraphType > exportAndFillCompleteCrsGraph(const Teuchos::RCP< const CrsGraphType > &sourceGraph, const Export< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &exporter, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Nonmember CrsGraph constructor that fuses Export and fillComplete().
CrsGraph(CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &&)=default
Move constructor (default).
const row_ptrs_device_view_type & getRowPtrsUnpackedDevice() const
Get the unpacked row pointers on device.
bool hasColMap() const override
Whether the graph has a column Map.
std::string description() const override
Return a one-line human-readable description of this object.
bool isStorageOptimized() const
Returns true if storage has been optimized.
void getGlobalRowCopy(global_ordinal_type gblRow, nonconst_global_inds_host_view_type &gblColInds, size_t &numColInds) const override
Get a copy of the given row, using global indices.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Kokkos::DualView< const size_t *, device_type > &numEntPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying a (possibly different) upper bound for the number of entries in each row.
void removeLocalIndices(local_ordinal_type localRow)
Remove all graph indices from the specified local row.
void importAndFillComplete(Teuchos::RCP< CrsGraph< local_ordinal_type, global_ordinal_type, Node > > &destGraph, const import_type &importer, const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null) const
Import from this to the given destination graph, and make the result fill complete.
global_size_t getGlobalNumRows() const override
Returns the number of global rows in the graph.
Teuchos::RCP< const map_type > getDomainMap() const override
Returns the Map associated with the domain of this graph.
void replaceRangeMapAndExporter(const Teuchos::RCP< const map_type > &newRangeMap, const Teuchos::RCP< const export_type > &newExporter)
Replace the current Range Map and Export with the given parameters.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::ArrayView< const size_t > &numEntPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and number of entries in each row (legacy KokkosClassic version).
void computeLocalConstants()
Compute local constants, if they have not yet been computed.
typename row_graph_type::local_inds_device_view_type local_inds_device_view_type
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...
Kokkos::View< size_t *, Kokkos::LayoutLeft, device_type >::HostMirror num_row_entries_type
size_t insertGlobalIndicesImpl(const RowInfo &rowInfo, const global_ordinal_type inputGblColInds[], const size_t numInputInds, std::function< void(const size_t, const size_t, const size_t)> fun=std::function< void(const size_t, const size_t, const size_t)>())
Insert global indices, using an input RowInfo.
bool isFillComplete() const override
Whether fillComplete() has been called and the graph is in compute mode.
void setDomainRangeMaps(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap)
void fillComplete(const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Tell the graph that you are done changing its structure; set default domain and range Maps.
void swap(CrsGraph< local_ordinal_type, global_ordinal_type, Node > &graph)
Swaps the data from *this with the data and maps from graph.
::Tpetra::Map< LO, GO, node_type > map_type
CrsGraph & operator=(const CrsGraph< local_ordinal_type, global_ordinal_type, node_type > &)=default
Assignment operator (default).
void getGlobalRowView(const global_ordinal_type gblRow, global_inds_host_view_type &gblColInds) const override
Get a const view of the given global row's global column indices.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and a single upper bound for the number of entries in all rows on t...
const row_ptrs_host_view_type & getRowPtrsUnpackedHost() const
Get the unpacked row pointers on host. Lazily make a copy from device.
void exportAndFillComplete(Teuchos::RCP< CrsGraph< local_ordinal_type, global_ordinal_type, Node > > &destGraph, const export_type &rowExporter, const export_type &domainExporter, const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params) const
Export from this to the given destination graph, and make the result fill complete.
void exportAndFillComplete(Teuchos::RCP< CrsGraph< local_ordinal_type, global_ordinal_type, Node > > &destGraph, const export_type &exporter, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null) const
Export from this to the given destination graph, and make the result fill complete.
void makeColMap(Teuchos::Array< int > &remotePIDs)
Make and set the graph's column Map.
CrsGraph(const local_graph_device_type &lclGraph, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column, domain and range maps, and a local graph, which the resulting CrsGraph...
size_t getGlobalMaxNumRowEntries() const override
Maximum number of entries in any row of the graph, over all processes in the graph's communicator.
void checkInternalState() const
Throw an exception if the internal state is not consistent.
Teuchos::RCP< const map_type > getRangeMap() const override
Returns the Map associated with the domain of this graph.
void expertStaticFillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const import_type > &importer=Teuchos::null, const Teuchos::RCP< const export_type > &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Perform a fillComplete on a graph that already has data, via setAllIndices().
size_t getNumAllocatedEntriesInGlobalRow(global_ordinal_type globalRow) const
Current number of allocated entries in the given row on the calling (MPI) process,...
Teuchos::RCP< const export_type > getExporter() const override
Returns the exporter associated with this graph.
typename device_type::execution_space execution_space
void makeImportExport(Teuchos::Array< int > &remotePIDs, const bool useRemotePIDs)
Make the Import and Export objects, if needed.
global_ordinal_type getIndexBase() const override
Returns the index base for global indices for this graph.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Backwards compatibility overload of the above method.
row_ptrs_device_view_type getLocalRowPtrsDevice() const
Get a device view of the packed row offsets.
void getLocalRowCopy(local_ordinal_type gblRow, nonconst_local_inds_host_view_type &gblColInds, size_t &numColInds) const override
Get a copy of the given row, using local indices.
local_inds_dualv_type::t_host::const_type getLocalIndsViewHost(const RowInfo &rowinfo) const
Get a const, locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRo...
bool isFillActive() const
Whether resumeFill() has been called and the graph is in edit mode.
Teuchos::RCP< const map_type > getRowMap() const override
Returns the Map that describes the row distribution in this graph.
Kokkos::StaticCrsGraph< local_ordinal_type, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_device_type
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const local_graph_device_type &lclGraph, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor specifying column Map and a local graph, which the resulting CrsGraph views....
size_t insertGlobalIndicesImpl(const local_ordinal_type lclRow, const global_ordinal_type inputGblColInds[], const size_t numInputInds)
Insert global indices, using an input local row index.
::Tpetra::Export< LO, GO, node_type > export_type
size_t getLocalNumEntries() const override
The local number of entries in the graph.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::ArrayView< const size_t > &numEntPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying a (possibly different) upper bound for the number of entries in each row (lega...
Teuchos::RCP< const import_type > getImporter() const override
Returns the importer associated with this graph.
Teuchos::RCP< const map_type > domainMap_
const row_ptrs_host_view_type & getRowPtrsPackedHost() const
Get the packed row pointers on host. Lazily make a copy from device.
size_t getLocalNumCols() const override
Returns the number of columns connected to the locally owned rows of this graph.
virtual void pack(const Teuchos::ArrayView< const local_ordinal_type > &exportLIDs, Teuchos::Array< global_ordinal_type > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets) const override
void getLocalOffRankOffsets(offset_device_view_type &offsets) const
Get offsets of the off-rank entries in the graph.
global_size_t getGlobalNumCols() const override
Returns the number of global columns in the graph.
Teuchos::RCP< const export_type > exporter_
void insertGlobalIndices(const global_ordinal_type globalRow, const Teuchos::ArrayView< const global_ordinal_type > &indices)
Insert global indices into the graph.
local_inds_dualv_type::t_host getLocalIndsViewHostNonConst(const RowInfo &rowinfo)
Get a ReadWrite locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(m...
void replaceDomainMap(const Teuchos::RCP< const map_type > &newDomainMap)
Replace the current domain Map with the given objects.
Kokkos::View< constsize_t *, device_type >::HostMirror k_numAllocPerRow_
void computeGlobalConstants()
Compute global constants, if they have not yet been computed.
CrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Kokkos::DualView< const size_t *, device_type > &numEntPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
size_t getNumAllocatedEntriesInLocalRow(local_ordinal_type localRow) const
Current number of allocated entries in the given row on the calling (MPI) process,...
virtual ~CrsGraph()=default
Destructor (virtual for memory safety of derived classes).
typename row_graph_type::global_inds_device_view_type global_inds_device_view_type
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.
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...
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.
Kokkos::Device< typename device_type::execution_space, buffer_memory_space > buffer_device_type
Kokkos::Device specialization for communication buffers.
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.