Tpetra parallel linear algebra
Version of the Day
|
A distributed graph accessed by rows (adjacency lists) and stored sparsely. More...
#include <Tpetra_CrsGraph_decl.hpp>
Public Types | |
typedef LocalOrdinal | local_ordinal_type |
This class' first template parameter; the type of local indices. More... | |
typedef GlobalOrdinal | global_ordinal_type |
This class' second template parameter; the type of global indices. More... | |
typedef Node | node_type |
This class' Kokkos Node type. More... | |
typedef Node::device_type | device_type |
This class' Kokkos device type. More... | |
typedef device_type::execution_space | execution_space |
This class' Kokkos execution space. More... | |
typedef Kokkos::StaticCrsGraph< LocalOrdinal, Kokkos::LayoutLeft, execution_space > | local_graph_type |
The type of the part of the sparse graph on each MPI process. More... | |
typedef local_graph_type LocalStaticCrsGraphType | TPETRA_DEPRECATED |
DEPRECATED; use local_graph_type (above) instead. More... | |
typedef local_graph_type::row_map_type t_RowPtrs | TPETRA_DEPRECATED |
DEPRECATED; use local_graph_type::row_map_type instead. More... | |
typedef local_graph_type::row_map_type::non_const_type t_RowPtrsNC | TPETRA_DEPRECATED |
DEPRECATED; use local_graph_type::row_map_type::non_const_type instead. More... | |
typedef local_graph_type::entries_type::non_const_type t_LocalOrdinal_1D | TPETRA_DEPRECATED |
DEPRECATED; use local_graph_type::entries_type::non_const_type instead. More... | |
typedef Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > | map_type |
The Map specialization used by this class. More... | |
typedef Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > | import_type |
The Import specialization used by this class. More... | |
typedef Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > | export_type |
The Export specialization used by this class. More... | |
Typedefs | |
typedef Kokkos::Details::ArithTraits< GlobalOrdinal >::val_type | packet_type |
The type of each datum being sent or received in an Import or Export. More... | |
Public Member Functions | |
local_graph_type | getLocalGraph () const |
Get the local graph. More... | |
Constructor/Destructor Methods | |
CrsGraph (const Teuchos::RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Constructor specifying a single upper bound for the number of entries in all rows on the calling process. More... | |
CrsGraph (const Teuchos::RCP< const map_type > &rowMap, const Kokkos::DualView< const size_t *, execution_space > &numEntPerRow, const ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Constructor specifying a (possibly different) upper bound for the number of entries in each row. More... | |
CrsGraph (const Teuchos::RCP< const map_type > &rowMap, const Teuchos::ArrayRCP< const size_t > &numEntPerRow, const ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Constructor specifying a (possibly different) upper bound for the number of entries in each row (legacy KokkosClassic version). More... | |
CrsGraph (const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const size_t maxNumEntriesPerRow, const ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Constructor specifying column Map and a single upper bound for the number of entries in all rows on the calling process. More... | |
CrsGraph (const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Kokkos::DualView< const size_t *, execution_space > &numEntPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Constructor specifying column Map and number of entries in each row. More... | |
CrsGraph (const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::ArrayRCP< const size_t > &numEntPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Constructor specifying column Map and number of entries in each row (legacy KokkosClassic version). More... | |
CrsGraph (const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const typename local_graph_type::row_map_type &rowPointers, const typename local_graph_type::entries_type::non_const_type &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Constructor specifying column Map and arrays containing the graph in sorted, local ids. More... | |
CrsGraph (const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::ArrayRCP< size_t > &rowPointers, const Teuchos::ArrayRCP< LocalOrdinal > &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Constructor specifying column Map and arrays containing the graph in sorted, local ids. More... | |
CrsGraph (const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const local_graph_type &lclGraph, const Teuchos::RCP< Teuchos::ParameterList > ¶ms) | |
Constructor specifying column Map and a local (sorted) graph, which the resulting CrsGraph views. More... | |
template<class Node2 > | |
Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node2, Node2::classic > > | clone (const Teuchos::RCP< Node2 > &node2, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) const |
Create a cloned CrsGraph for a different Node type. More... | |
virtual | ~CrsGraph () |
Destructor. More... | |
Implementation of Teuchos::ParameterListAcceptor | |
void | setParameterList (const Teuchos::RCP< Teuchos::ParameterList > ¶ms) |
Set the given list of parameters (must be nonnull). More... | |
Teuchos::RCP< const Teuchos::ParameterList > | getValidParameters () const |
Default parameter list suitable for validation. More... | |
Insertion/Removal Methods | |
void | insertGlobalIndices (const GlobalOrdinal globalRow, const Teuchos::ArrayView< const GlobalOrdinal > &indices) |
Insert global indices into the graph. More... | |
void | insertGlobalIndices (const GlobalOrdinal globalRow, const LocalOrdinal numEnt, const GlobalOrdinal inds[]) |
Epetra compatibility version of insertGlobalIndices (see above) that takes input as a raw pointer, rather than Teuchos::ArrayView. More... | |
void | insertLocalIndices (const LocalOrdinal localRow, const Teuchos::ArrayView< const LocalOrdinal > &indices) |
Insert local indices into the graph. More... | |
void | insertLocalIndices (const LocalOrdinal localRow, const LocalOrdinal numEnt, const LocalOrdinal inds[]) |
Epetra compatibility version of insertLocalIndices (see above) that takes input as a raw pointer, rather than Teuchos::ArrayView. More... | |
void | removeLocalIndices (LocalOrdinal localRow) |
Remove all graph indices from the specified local row. More... | |
Transformational Methods | |
void | globalAssemble () |
Communicate non-local contributions to other processes. More... | |
void | resumeFill (const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) |
void | fillComplete (const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) |
Tell the graph that you are done changing its structure. More... | |
void | fillComplete (const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) |
Tell the graph that you are done changing its structure; set default domain and range Maps. More... | |
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 > ¶ms=Teuchos::null) |
Perform a fillComplete on a graph that already has data, via setAllIndices(). More... | |
Methods implementing RowGraph. | |
Teuchos::RCP< const Teuchos::Comm< int > > | getComm () const |
Returns the communicator. More... | |
Teuchos::RCP< node_type > | getNode () const |
Returns the underlying node. More... | |
Teuchos::RCP< const map_type > | getRowMap () const |
Returns the Map that describes the row distribution in this graph. More... | |
Teuchos::RCP< const map_type > | getColMap () const |
Returns the Map that describes the column distribution in this graph. More... | |
Teuchos::RCP< const map_type > | getDomainMap () const |
Returns the Map associated with the domain of this graph. More... | |
Teuchos::RCP< const map_type > | getRangeMap () const |
Returns the Map associated with the domain of this graph. More... | |
Teuchos::RCP< const import_type > | getImporter () const |
Returns the importer associated with this graph. More... | |
Teuchos::RCP< const export_type > | getExporter () const |
Returns the exporter associated with this graph. More... | |
global_size_t | getGlobalNumRows () const |
Returns the number of global rows in the graph. More... | |
global_size_t | getGlobalNumCols () const |
Returns the number of global columns in the graph. More... | |
size_t | getNodeNumRows () const |
Returns the number of graph rows owned on the calling node. More... | |
size_t | getNodeNumCols () const |
Returns the number of columns connected to the locally owned rows of this graph. More... | |
GlobalOrdinal | getIndexBase () const |
Returns the index base for global indices for this graph. More... | |
global_size_t | getGlobalNumEntries () const |
Returns the global number of entries in the graph. More... | |
size_t | getNodeNumEntries () const |
Returns the local number of entries in the graph. More... | |
size_t | getNumEntriesInGlobalRow (GlobalOrdinal globalRow) const |
Returns the current number of entries on this node in the specified global row. More... | |
size_t | getNumEntriesInLocalRow (LocalOrdinal localRow) const |
Get the number of entries in the given row (local index). More... | |
size_t | getNodeAllocationSize () const |
Returns the total number of indices allocated for the graph, across all rows on this node. More... | |
size_t | getNumAllocatedEntriesInGlobalRow (GlobalOrdinal globalRow) const |
Returns the current number of allocated entries for this node in the specified global row . More... | |
size_t | getNumAllocatedEntriesInLocalRow (LocalOrdinal localRow) const |
Returns the current number of allocated entries on this node in the specified local row. More... | |
global_size_t | getGlobalNumDiags () const |
Returns the number of global diagonal entries, based on global row/column index comparisons. More... | |
size_t | getNodeNumDiags () const |
Returns the number of local diagonal entries, based on global row/column index comparisons. More... | |
size_t | getGlobalMaxNumRowEntries () const |
Maximum number of entries in all rows over all processes. More... | |
size_t | getNodeMaxNumRowEntries () const |
Maximum number of entries in all rows owned by the calling process. More... | |
bool | hasColMap () const |
Whether the graph has a column Map. More... | |
bool | isLowerTriangular () const |
Whether the graph is locally lower triangular. More... | |
bool | isUpperTriangular () const |
Whether the graph is locally upper triangular. More... | |
bool | isLocallyIndexed () const |
If graph indices are in the local range, this function returns true. Otherwise, this function returns false. */. More... | |
bool | isGloballyIndexed () const |
If graph indices are in the global range, this function returns true. Otherwise, this function returns false. */. More... | |
bool | isFillComplete () const |
Returns true if fillComplete() has been called and the graph is in compute mode. More... | |
bool | isFillActive () const |
Returns true if resumeFill() has been called and the graph is in edit mode. More... | |
bool | isSorted () const |
Whether graph indices in all rows are known to be sorted. More... | |
bool | isStorageOptimized () const |
Returns true if storage has been optimized. More... | |
ProfileType | getProfileType () const |
Returns true if the graph was allocated with static data structures. More... | |
void | getGlobalRowCopy (GlobalOrdinal GlobalRow, const Teuchos::ArrayView< GlobalOrdinal > &Indices, size_t &NumIndices) const |
Get a copy of the given row, using global indices. More... | |
void | getLocalRowCopy (LocalOrdinal LocalRow, const Teuchos::ArrayView< LocalOrdinal > &indices, size_t &NumIndices) const |
Get a copy of the given row, using local indices. More... | |
void | getGlobalRowView (GlobalOrdinal GlobalRow, Teuchos::ArrayView< const GlobalOrdinal > &Indices) const |
Get a const, non-persisting view of the given global row's global column indices, as a Teuchos::ArrayView. More... | |
void | getLocalRowView (LocalOrdinal LocalRow, Teuchos::ArrayView< const LocalOrdinal > &indices) const |
Get a const, non-persisting view of the given local row's local column indices, as a Teuchos::ArrayView. More... | |
Overridden from Teuchos::Describable | |
std::string | description () const |
Return a simple one-line description of this object. More... | |
void | describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const |
Print the object to the given output stream with given verbosity level. More... | |
Implementation of DistObject | |
virtual bool | checkSizes (const SrcDistObject &source) |
Compare the source and target (this) objects for compatibility. More... | |
virtual void | copyAndPermute (const SrcDistObject &source, size_t numSameIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteToLIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteFromLIDs) |
Perform copies and permutations that are local to this process. More... | |
virtual void | packAndPrepare (const SrcDistObject &source, const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Teuchos::Array< GlobalOrdinal > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor) |
virtual void | pack (const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Teuchos::Array< GlobalOrdinal > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor) const |
Pack this object's data for Import or Export. More... | |
virtual void | unpackAndCombine (const Teuchos::ArrayView< const LocalOrdinal > &importLIDs, const Teuchos::ArrayView< const GlobalOrdinal > &imports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t constantNumPackets, Distributor &distor, CombineMode CM) |
Advanced methods, at increased risk of deprecation. | |
void | getLocalDiagOffsets (const Kokkos::View< size_t *, device_type, Kokkos::MemoryUnmanaged > &offsets) const |
Get offsets of the diagonal entries in the graph. More... | |
void | getLocalDiagOffsets (Teuchos::ArrayRCP< size_t > &offsets) const |
Backwards compatibility overload of the above method. More... | |
void | getNumEntriesPerLocalRowUpperBound (Teuchos::ArrayRCP< const size_t > &boundPerLocalRow, size_t &boundForAllLocalRows, bool &boundSameForAllLocalRows) const |
Get an upper bound on the number of entries that can be stored in each row. More... | |
void | setAllIndices (const typename local_graph_type::row_map_type &rowPointers, const typename local_graph_type::entries_type::non_const_type &columnIndices) |
Set the graph's data directly, using 1-D storage. More... | |
void | setAllIndices (const Teuchos::ArrayRCP< size_t > &rowPointers, const Teuchos::ArrayRCP< LocalOrdinal > &columnIndices) |
Set the graph's data directly, using 1-D storage. More... | |
Teuchos::ArrayRCP< const size_t > | getNodeRowPtrs () const |
Get a host view of the row offsets. More... | |
Teuchos::ArrayRCP< const LocalOrdinal > | getNodePackedIndices () const |
Get an Teuchos::ArrayRCP of the packed column-indices. More... | |
void | replaceColMap (const Teuchos::RCP< const map_type > &newColMap) |
Replace the graph's current column Map with the given Map. More... | |
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 object as well. More... | |
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. More... | |
virtual void | removeEmptyProcessesInPlace (const Teuchos::RCP< const map_type > &newMap) |
Remove processes owning zero rows from the Maps and their communicator. More... | |
Public methods for redistributing data | |
void | doImport (const SrcDistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM) |
Import data into this object using an Import object ("forward mode"). More... | |
void | doImport (const SrcDistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM) |
Import data into this object using an Export object ("reverse mode"). More... | |
void | doExport (const SrcDistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM) |
Export data into this object using an Export object ("forward mode"). More... | |
void | doExport (const SrcDistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM) |
Export data into this object using an Import object ("reverse mode"). More... | |
Attribute accessor methods | |
bool | isDistributed () const |
Whether this is a globally distributed object. More... | |
virtual Teuchos::RCP< const map_type > | getMap () const |
The Map describing the parallel distribution of this object. More... | |
I/O methods | |
void | print (std::ostream &os) const |
Print this object to the given output stream. More... | |
Methods for use only by experts | |
virtual void | removeEmptyProcessesInPlace (const Teuchos::RCP< const map_type > &newMap) |
Remove processes which contain no entries in this object's Map. More... | |
Protected Types | |
enum | ReverseOption |
Whether the data transfer should be performed in forward or reverse mode. More... | |
Protected Member Functions | |
void | setDomainRangeMaps (const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap) |
RowInfo | getRowInfo (const LocalOrdinal myRow) const |
Get information about the locally owned row with local index myRow. More... | |
RowInfo | getRowInfoFromGlobalRowIndex (const GlobalOrdinal gblRow) const |
Get information about the locally owned row with global index gblRow. More... | |
Teuchos::ArrayView< const LocalOrdinal > | getLocalView (const RowInfo rowinfo) const |
Get a const, nonowned, locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRow). More... | |
Teuchos::ArrayView< LocalOrdinal > | getLocalViewNonConst (const RowInfo rowinfo) |
Get a nonconst, nonowned, locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRow). More... | |
LocalOrdinal | getLocalViewRawConst (const LocalOrdinal *&lclInds, LocalOrdinal &numEnt, const RowInfo &rowinfo) const |
Get a pointer to the local column indices of a locally owned row, using the result of getRowInfo. More... | |
Teuchos::ArrayView< const GlobalOrdinal > | getGlobalView (const RowInfo rowinfo) const |
Get a const, nonowned, globally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRow). More... | |
Teuchos::ArrayView< GlobalOrdinal > | getGlobalViewNonConst (const RowInfo rowinfo) |
Get a nonconst, nonowned, globally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRow). More... | |
LocalOrdinal | getGlobalViewRawConst (const GlobalOrdinal *&gblInds, LocalOrdinal &numEnt, const RowInfo &rowinfo) const |
Get a pointer to the global column indices of a locally owned row, using the result of getRowInfoFromGlobalRowIndex. More... | |
bool | hasRowInfo () const |
Whether it is correct to call getRowInfo(). More... | |
void | checkInternalState () const |
Throw an exception if the internal state is not consistent. More... | |
virtual size_t | constantNumberOfPackets () const |
Whether the implementation's instance promises always to have a constant number of packets per LID (local index), and if so, how many packets per LID there are. More... | |
virtual void | doTransfer (const SrcDistObject &src, CombineMode CM, size_t numSameIDs, const Teuchos::ArrayView< const local_ordinal_type > &permuteToLIDs, const Teuchos::ArrayView< const local_ordinal_type > &permuteFromLIDs, const Teuchos::ArrayView< const local_ordinal_type > &remoteLIDs, const Teuchos::ArrayView< const local_ordinal_type > &exportLIDs, Distributor &distor, ReverseOption revOp) |
Redistribute data across memory images. More... | |
virtual void | createViews () const |
Hook for creating a const view. More... | |
virtual void | createViewsNonConst (KokkosClassic::ReadWriteOption rwo) |
Hook for creating a nonconst view. More... | |
virtual void | releaseViews () const |
Hook for releasing views. More... | |
void | reallocImportsIfNeeded (const size_t newSize, const bool debug=false) |
Reallocate imports_ if needed. More... | |
Methods governing changes between global and local indices | |
void | makeColMap () |
Make the graph's column Map, if it does not already have one. More... | |
void | makeIndicesLocal () |
void | makeImportExport () |
Methods for sorting and merging column indices. | |
bool | isMerged () const |
Whether duplicate column indices in each row have been merged. More... | |
void | setLocallyModified () |
Report that we made a local modification to its structure. More... | |
void | sortAllIndices () |
Sort the column indices in all the rows. More... | |
void | sortRowIndices (const RowInfo rowinfo) |
Sort the column indices in the given row. More... | |
template<class Scalar > | |
void | sortRowIndicesAndValues (const RowInfo rowinfo, const Teuchos::ArrayView< Scalar > &values) |
Sort the column indices and their values in the given row. More... | |
void | mergeAllIndices () |
Merge duplicate row indices in all of the rows. More... | |
void | mergeRowIndices (RowInfo rowinfo) |
Merge duplicate row indices in the given row. More... | |
template<class Scalar > | |
void | mergeRowIndicesAndValues (RowInfo rowinfo, const Teuchos::ArrayView< Scalar > &rowValues) |
Merge duplicate row indices in the given row, along with their corresponding values. More... | |
Methods implemented by subclasses and used by doTransfer(). | |
The doTransfer() method uses the subclass' implementations of these methods to implement data transfer. Subclasses of DistObject must implement these methods. This is an instance of the Template Method Pattern. ("Template" here doesn't mean "C++ template"; it means "pattern with holes that are filled in by the subclass' method implementations.") | |
virtual bool | useNewInterface () |
Whether the subclass implements the "old" or "new" (Kokkos-friendly) interface. More... | |
virtual void | copyAndPermuteNew (const SrcDistObject &source, const size_t numSameIDs, const Kokkos::DualView< const local_ordinal_type *, device_type > &permuteToLIDs, const Kokkos::DualView< const local_ordinal_type *, device_type > &permuteFromLIDs) |
virtual void | packAndPrepare (const SrcDistObject &source, const Teuchos::ArrayView< const local_ordinal_type > &exportLIDs, Teuchos::Array< packet_type > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor) |
Perform any packing or preparation required for communication. More... | |
virtual void | packAndPrepareNew (const SrcDistObject &source, const Kokkos::DualView< const local_ordinal_type *, device_type > &exportLIDs, Kokkos::DualView< packet_type *, device_type > &exports, const Kokkos::DualView< size_t *, device_type > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor) |
virtual void | unpackAndCombine (const Teuchos::ArrayView< const local_ordinal_type > &importLIDs, const Teuchos::ArrayView< const packet_type > &imports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t constantNumPackets, Distributor &distor, CombineMode CM) |
Perform any unpacking and combining after communication (old version that uses Teuchos memory management classes to hold data). More... | |
virtual void | unpackAndCombineNew (const Kokkos::DualView< const local_ordinal_type *, device_type > &importLIDs, const Kokkos::DualView< const packet_type *, device_type > &imports, const Kokkos::DualView< const size_t *, device_type > &numPacketsPerLID, const size_t constantNumPackets, Distributor &distor, const CombineMode CM) |
Perform any unpacking and combining after communication (new version that uses Kokkos data structures to hold data). More... | |
Protected Attributes | |
Teuchos::RCP< const map_type > | rowMap_ |
The Map describing the distribution of rows of the graph. More... | |
Teuchos::RCP< const map_type > | colMap_ |
The Map describing the distribution of columns of the graph. More... | |
Teuchos::RCP< const map_type > | rangeMap_ |
The Map describing the range of the (matrix corresponding to the) graph. More... | |
Teuchos::RCP< const map_type > | domainMap_ |
The Map describing the domain of the (matrix corresponding to the) graph. More... | |
Teuchos::RCP< const import_type > | importer_ |
The Import from the domain Map to the column Map. More... | |
Teuchos::RCP< const export_type > | exporter_ |
The Export from the row Map to the range Map. More... | |
local_graph_type | lclGraph_ |
Local graph; only initialized after first fillComplete() call. More... | |
ProfileType | pftype_ |
Whether the graph was allocated with static or dynamic profile. More... | |
Kokkos::View< const size_t *, execution_space >::HostMirror | k_numAllocPerRow_ |
The maximum number of entries to allow in each locally owned row, per row. More... | |
size_t | numAllocForAllRows_ |
The maximum number of entries to allow in each locally owned row. More... | |
Details::EStorageStatus | storageStatus_ |
Status of the graph's storage, when not in a fill-complete state. More... | |
bool | lowerTriangular_ |
Whether the graph is locally lower triangular. More... | |
bool | upperTriangular_ |
Whether the graph is locally upper triangular. More... | |
bool | indicesAreSorted_ |
Whether the graph's indices are sorted in each row, on this process. More... | |
bool | noRedundancies_ |
Whether the graph's indices are non-redundant (merged) in each row, on this process. More... | |
bool | haveLocalConstants_ |
Whether this process has computed local constants. More... | |
bool | haveGlobalConstants_ |
Whether all processes have computed global constants. More... | |
std::map< GlobalOrdinal, std::vector< GlobalOrdinal > > | nonlocals_ |
Nonlocal data given to insertGlobalValues or sumIntoGlobalValues. More... | |
bool | sortGhostsAssociatedWithEachProcessor_ |
Whether to require makeColMap() (and therefore fillComplete()) to order column Map GIDs associated with each remote process in ascending order. More... | |
Teuchos::RCP< const map_type > | map_ |
The Map over which this object is distributed. More... | |
Kokkos::DualView< packet_type *, execution_space > | imports_ |
Buffer into which packed data are imported (received from other processes). More... | |
Kokkos::DualView< size_t *, execution_space > | numImportPacketsPerLID_ |
Number of packets to receive for each receive operation. More... | |
Kokkos::DualView< packet_type *, device_type > | exports_ |
Buffer from which packed data are exported (sent to other processes). More... | |
Kokkos::DualView< size_t *, execution_space > | numExportPacketsPerLID_ |
Number of packets to send for each send operation. More... | |
2-D storage (DynamicProfile) data structures | |
2-D storage exists only if the graph was allocated with DynamicProfile. All of these data structures exist in host memory. Currently, NONE of them are thread safe, let alone thread scalable. These data structures only exist to support legacy use cases. At some point, we may add a thread-scalable intermediate level of "dynamicity" between 2-D storage and 1-D storage (StaticProfile), which bounds the total number of entries allowed per process, but does not otherwise bound the number of entries per row. | |
Teuchos::ArrayRCP< Teuchos::Array< LocalOrdinal > > | lclInds2D_ |
Local column indices for all rows. More... | |
Teuchos::ArrayRCP< Teuchos::Array< GlobalOrdinal > > | gblInds2D_ |
Global column indices for all rows. More... | |
Kokkos::View< size_t *, Kokkos::LayoutLeft, device_type >::HostMirror | k_numRowEntries_ |
The number of local entries in each locally owned row. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<class LocalOrdinal , class GlobalOrdinal , class Node , const bool classic = Node::classic> | |
Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic > > | createCrsGraph (const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t maxNumEntriesPerRow=0, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) |
Nonmember function to create an empty CrsGraph given a row Map and the max number of entries allowed locally per row. More... | |
Methods for inserting indices or transforming values | |
static const bool | useAtomicUpdatesByDefault |
Whether sumIntoLocalValues and transformLocalValues should use atomic updates by default. More... | |
template<ELocalGlobal lg> | |
size_t | filterIndices (const SLocalGlobalNCViews &inds) const |
template<class T > | |
size_t | filterGlobalIndicesAndValues (const Teuchos::ArrayView< GlobalOrdinal > &ginds, const Teuchos::ArrayView< T > &vals) const |
template<class T > | |
size_t | filterLocalIndicesAndValues (const Teuchos::ArrayView< LocalOrdinal > &linds, const Teuchos::ArrayView< T > &vals) const |
size_t | insertIndices (const RowInfo &rowInfo, const SLocalGlobalViews &newInds, const ELocalGlobal lg, const ELocalGlobal I) |
Insert indices into the given row. More... | |
template<class Scalar > | |
void | insertIndicesAndValues (const RowInfo &rowInfo, const SLocalGlobalViews &newInds, const Teuchos::ArrayView< Scalar > &oldRowVals, const Teuchos::ArrayView< const Scalar > &newRowVals, const ELocalGlobal lg, const ELocalGlobal I) |
Insert indices and their values into the given row. More... | |
void | insertGlobalIndicesImpl (const LocalOrdinal myRow, const Teuchos::ArrayView< const GlobalOrdinal > &indices) |
void | insertLocalIndicesImpl (const LocalOrdinal myRow, const Teuchos::ArrayView< const LocalOrdinal > &indices) |
void | insertLocalIndicesFiltered (const LocalOrdinal localRow, const Teuchos::ArrayView< const LocalOrdinal > &indices) |
Like insertLocalIndices(), but with column Map filtering. More... | |
void | insertGlobalIndicesFiltered (const GlobalOrdinal localRow, const Teuchos::ArrayView< const GlobalOrdinal > &indices) |
Like insertGlobalIndices(), but with column Map filtering. More... | |
template<class OutputScalarViewType , class LocalIndicesViewType , class InputScalarViewType , class BinaryFunction > | |
LocalOrdinal | transformLocalValues (const RowInfo &rowInfo, const typename UnmanagedView< OutputScalarViewType >::type &rowVals, const typename UnmanagedView< LocalIndicesViewType >::type &inds, const typename UnmanagedView< InputScalarViewType >::type &newVals, BinaryFunction f, const bool atomic=useAtomicUpdatesByDefault) const |
Transform the given values using local indices. More... | |
template<class OutputScalarViewType , class LocalIndicesViewType , class InputScalarViewType > | |
LocalOrdinal | sumIntoLocalValues (const RowInfo &rowInfo, const typename UnmanagedView< OutputScalarViewType >::type &rowVals, const typename UnmanagedView< LocalIndicesViewType >::type &inds, const typename UnmanagedView< InputScalarViewType >::type &newVals, const bool atomic=useAtomicUpdatesByDefault) const |
Implementation detail of CrsMatrix::sumIntoLocalValues. More... | |
template<class OutputScalarViewType , class LocalIndicesViewType , class InputScalarViewType > | |
LocalOrdinal | replaceLocalValues (const RowInfo &rowInfo, const typename UnmanagedView< OutputScalarViewType >::type &rowVals, const typename UnmanagedView< LocalIndicesViewType >::type &inds, const typename UnmanagedView< InputScalarViewType >::type &newVals) const |
Implementation detail of CrsMatrix::replaceLocalValues. More... | |
template<class Scalar , class InputMemorySpace , class ValsMemorySpace > | |
LocalOrdinal | sumIntoGlobalValues (const RowInfo &rowInfo, const Kokkos::View< Scalar *, ValsMemorySpace, Kokkos::MemoryUnmanaged > &rowVals, const Kokkos::View< const GlobalOrdinal *, InputMemorySpace, Kokkos::MemoryUnmanaged > &inds, const Kokkos::View< const Scalar *, InputMemorySpace, Kokkos::MemoryUnmanaged > &newVals, const bool atomic=useAtomicUpdatesByDefault) const |
Implementation detail of CrsMatrix::sumIntoGlobalValues. More... | |
template<class OutputScalarViewType , class GlobalIndicesViewType , class InputScalarViewType > | |
LocalOrdinal | replaceGlobalValues (const RowInfo &rowInfo, const typename UnmanagedView< OutputScalarViewType >::type &rowVals, const typename UnmanagedView< GlobalIndicesViewType >::type &inds, const typename UnmanagedView< InputScalarViewType >::type &newVals) const |
Implementation detail of CrsMatrix::replaceGlobalValues. More... | |
template<class Scalar , class BinaryFunction , class InputMemorySpace , class ValsMemorySpace > | |
LocalOrdinal | transformGlobalValues (const RowInfo &rowInfo, const Kokkos::View< Scalar *, ValsMemorySpace, Kokkos::MemoryUnmanaged > &rowVals, const Kokkos::View< const GlobalOrdinal *, InputMemorySpace, Kokkos::MemoryUnmanaged > &inds, const Kokkos::View< const Scalar *, InputMemorySpace, Kokkos::MemoryUnmanaged > &newVals, BinaryFunction f, const bool atomic=useAtomicUpdatesByDefault) const |
Transform the given values using global indices. More... | |
1-D storage (StaticProfile) data structures | |
typedef Kokkos::View< GlobalOrdinal *, execution_space > | t_GlobalOrdinal_1D |
Type of the k_gblInds1D_ array of global column indices. More... | |
local_graph_type::entries_type::non_const_type | k_lclInds1D_ |
Local column indices for all rows. More... | |
t_GlobalOrdinal_1D | k_gblInds1D_ |
Global column indices for all rows. More... | |
local_graph_type::row_map_type::const_type | k_rowPtrs_ |
Row offsets for "1-D" storage. More... | |
A distributed graph accessed by rows (adjacency lists) and stored sparsely.
LocalOrdinal | The type of local indices. See the documentation of Map for requirements. |
GlobalOrdinal | The type of global indices. See the documentation of Map for requirements. |
Node | The Kokkos Node type. See the documentation of Map for requirements. |
This class implements a distributed-memory parallel sparse graph. It provides access by rows to the elements of the graph, as if the local data were stored in compressed sparse row format (adjacency lists, in graph terms). (Implementations are not required to store the data in this way internally.) This class has an interface like that of Epetra_CrsGraph, but also allows insertion of data into nonowned rows, much like Epetra_FECrsGraph.
Before reading the rest of this documentation, it helps to know something about the Teuchos memory management classes, in particular Teuchos::RCP, Teuchos::ArrayRCP, and Teuchos::ArrayView. You should also know a little bit about MPI (the Message Passing Interface for distributed-memory programming). You won't have to use MPI directly to use CrsGraph, but it helps to be familiar with the general idea of distributed storage of data over a communicator. Finally, you should read the documentation of Map.
Graph entries can be added using either local or global coordinates for the indices. The accessors isGloballyIndexed() and isLocallyIndexed() indicate whether the indices are currently stored as global or local indices. Many of the class methods are divided into global and local versions, which differ only in whether they accept/return indices in the global or local coordinate space. Some of these methods may only be used if the graph coordinates are in the appropriate coordinates. For example, getGlobalRowView() returns a View to the indices in global coordinates; if the indices are not in global coordinates, then no such View can be created.
The global/local distinction does distinguish between operation on the global/local graph. Almost all methods operate on the local graph, i.e., the rows of the graph associated with the local node, per the distribution specified by the row map. Access to non-local rows requires performing an explicit communication via the import/export capabilities of the CrsGraph object; see DistObject. However, the method insertGlobalIndices() is an exception to this rule, as non-local rows are allowed to be added via the local graph. These rows are stored in the local graph and communicated to the appropriate node on the next call to globalAssemble() or fillComplete() (the latter calls the former).
Definition at line 267 of file Tpetra_CrsGraph_decl.hpp.
typedef LocalOrdinal Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::local_ordinal_type |
This class' first template parameter; the type of local indices.
Definition at line 289 of file Tpetra_CrsGraph_decl.hpp.
typedef GlobalOrdinal Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::global_ordinal_type |
This class' second template parameter; the type of global indices.
Definition at line 291 of file Tpetra_CrsGraph_decl.hpp.
typedef Node Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::node_type |
This class' Kokkos Node type.
Definition at line 293 of file Tpetra_CrsGraph_decl.hpp.
typedef Node::device_type Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::device_type |
This class' Kokkos device type.
Definition at line 296 of file Tpetra_CrsGraph_decl.hpp.
typedef device_type::execution_space Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::execution_space |
This class' Kokkos execution space.
Definition at line 298 of file Tpetra_CrsGraph_decl.hpp.
typedef Kokkos::StaticCrsGraph<LocalOrdinal, Kokkos::LayoutLeft, execution_space> Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::local_graph_type |
The type of the part of the sparse graph on each MPI process.
Definition at line 303 of file Tpetra_CrsGraph_decl.hpp.
typedef local_graph_type LocalStaticCrsGraphType Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::TPETRA_DEPRECATED |
DEPRECATED; use local_graph_type (above) instead.
Definition at line 305 of file Tpetra_CrsGraph_decl.hpp.
typedef local_graph_type::row_map_type t_RowPtrs Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::TPETRA_DEPRECATED |
DEPRECATED; use local_graph_type::row_map_type
instead.
Definition at line 308 of file Tpetra_CrsGraph_decl.hpp.
typedef local_graph_type::row_map_type::non_const_type t_RowPtrsNC Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::TPETRA_DEPRECATED |
DEPRECATED; use local_graph_type::row_map_type::non_const_type
instead.
Definition at line 310 of file Tpetra_CrsGraph_decl.hpp.
typedef local_graph_type::entries_type::non_const_type t_LocalOrdinal_1D Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::TPETRA_DEPRECATED |
DEPRECATED; use local_graph_type::entries_type::non_const_type
instead.
Definition at line 312 of file Tpetra_CrsGraph_decl.hpp.
typedef Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::map_type |
The Map specialization used by this class.
Definition at line 315 of file Tpetra_CrsGraph_decl.hpp.
typedef Tpetra::Import<LocalOrdinal, GlobalOrdinal, Node> Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::import_type |
The Import specialization used by this class.
Definition at line 317 of file Tpetra_CrsGraph_decl.hpp.
typedef Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node> Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::export_type |
The Export specialization used by this class.
Definition at line 319 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Type of the k_gblInds1D_ array of global column indices.
Definition at line 2999 of file Tpetra_CrsGraph_decl.hpp.
|
inherited |
The type of each datum being sent or received in an Import or Export.
Note that this type does not always correspond to the Scalar
template parameter of subclasses.
Definition at line 224 of file Tpetra_DistObject_decl.hpp.
|
protectedinherited |
Whether the data transfer should be performed in forward or reverse mode.
"Reverse mode" means calling doExport() with an Import object, or calling doImport() with an Export object. "Forward mode" means calling doExport() with an Export object, or calling doImport() with an Import object.
Definition at line 477 of file Tpetra_DistObject_decl.hpp.
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::CrsGraph | ( | const Teuchos::RCP< const map_type > & | rowMap, |
size_t | maxNumEntriesPerRow, | ||
ProfileType | pftype = DynamicProfile , |
||
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 process.
rowMap | [in] Distribution of rows of the graph. |
maxNumEntriesPerRow | [in] Maximum number of graph entries per row. If pftype==DynamicProfile, this is only a hint, and you can set this to zero without affecting correctness. If pftype==StaticProfile, this sets the amount of storage allocated, and you cannot exceed this number of entries in any row. |
pftype | [in] Whether to allocate storage dynamically (DynamicProfile) or statically (StaticProfile). |
params | [in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values. |
Definition at line 162 of file Tpetra_CrsGraph_def.hpp.
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::CrsGraph | ( | const Teuchos::RCP< const map_type > & | rowMap, |
const Kokkos::DualView< const size_t *, execution_space > & | numEntPerRow, | ||
const ProfileType | pftype = DynamicProfile , |
||
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null |
||
) |
Constructor specifying a (possibly different) upper bound for the number of entries in each row.
rowMap | [in] Distribution of rows of the graph. |
numEntPerRow | [in] Maximum number of graph entries to allocate for each row. If pftype==DynamicProfile, this is only a hint. If pftype==StaticProfile, this sets the amount of storage allocated, and you cannot exceed the allocated number of entries for any row. |
pftype | [in] Whether to allocate storage dynamically (DynamicProfile) or statically (StaticProfile). |
params | [in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values. |
Definition at line 303 of file Tpetra_CrsGraph_def.hpp.
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::CrsGraph | ( | const Teuchos::RCP< const map_type > & | rowMap, |
const Teuchos::ArrayRCP< const size_t > & | numEntPerRow, | ||
const ProfileType | pftype = DynamicProfile , |
||
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null |
||
) |
Constructor specifying a (possibly different) upper bound for the number of entries in each row (legacy KokkosClassic version).
rowMap | [in] Distribution of rows of the graph. |
numEntPerRow | [in] Maximum number of graph entries to allocate for each row. If pftype==DynamicProfile, this is only a hint. If pftype==StaticProfile, this sets the amount of storage allocated, and you cannot exceed the allocated number of entries for any row. |
pftype | [in] Whether to allocate storage dynamically (DynamicProfile) or statically (StaticProfile). |
params | [in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values. |
Definition at line 238 of file Tpetra_CrsGraph_def.hpp.
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::CrsGraph | ( | const Teuchos::RCP< const map_type > & | rowMap, |
const Teuchos::RCP< const map_type > & | colMap, | ||
const size_t | maxNumEntriesPerRow, | ||
const ProfileType | pftype = DynamicProfile , |
||
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 the calling process.
rowMap | [in] Distribution of rows of the graph. |
colMap | [in] Distribution of columns of the graph. |
maxNumEntriesPerRow | [in] Maximum number of graph entries per row. If pftype==DynamicProfile, this is only a hint, and you can set this to zero without affecting correctness. If pftype==StaticProfile, this sets the amount of storage allocated, and you cannot exceed this number of entries in any row. |
pftype | [in] Whether to allocate storage dynamically (DynamicProfile) or statically (StaticProfile). |
params | [in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values. |
Definition at line 199 of file Tpetra_CrsGraph_def.hpp.
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::CrsGraph | ( | const Teuchos::RCP< const map_type > & | rowMap, |
const Teuchos::RCP< const map_type > & | colMap, | ||
const Kokkos::DualView< const size_t *, execution_space > & | numEntPerRow, | ||
ProfileType | pftype = DynamicProfile , |
||
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null |
||
) |
Constructor specifying column Map and number of entries in each row.
rowMap | [in] Distribution of rows of the graph. |
colMap | [in] Distribution of columns of the graph. |
numEntPerRow | [in] Maximum number of graph entries to allocate for each row. If pftype==DynamicProfile, this is only a hint. If pftype==StaticProfile, this sets the amount of storage allocated, and you cannot exceed the allocated number of entries for any row. |
pftype | [in] Whether to allocate storage dynamically (DynamicProfile) or statically (StaticProfile). |
params | [in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values. |
Definition at line 355 of file Tpetra_CrsGraph_def.hpp.
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::CrsGraph | ( | const Teuchos::RCP< const map_type > & | rowMap, |
const Teuchos::RCP< const map_type > & | colMap, | ||
const Teuchos::ArrayRCP< const size_t > & | numEntPerRow, | ||
ProfileType | pftype = DynamicProfile , |
||
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null |
||
) |
Constructor specifying column Map and number of entries in each row (legacy KokkosClassic version).
rowMap | [in] Distribution of rows of the graph. |
colMap | [in] Distribution of columns of the graph. |
numEntPerRow | [in] Maximum number of graph entries to allocate for each row. If pftype==DynamicProfile, this is only a hint. If pftype==StaticProfile, this sets the amount of storage allocated, and you cannot exceed the allocated number of entries for any row. |
pftype | [in] Whether to allocate storage dynamically (DynamicProfile) or statically (StaticProfile). |
params | [in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values. |
Definition at line 409 of file Tpetra_CrsGraph_def.hpp.
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::CrsGraph | ( | const Teuchos::RCP< const map_type > & | rowMap, |
const Teuchos::RCP< const map_type > & | colMap, | ||
const typename local_graph_type::row_map_type & | rowPointers, | ||
const typename local_graph_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 sorted, local ids.
rowMap | [in] Distribution of rows of the graph. |
colMap | [in] Distribution of columns of the graph. |
rowPointers | [in] The beginning of each row in the graph, as in a CSR "rowptr" array. The length of this vector should be equal to the number of rows in the graph, plus one. This last entry should store the nunber of nonzeros in the graph. |
columnIndices | [in] The local indices of the columns, as in a CSR "colind" array. The length of this vector should be equal to the number of unknowns in the graph. |
params | [in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values. |
Definition at line 478 of file Tpetra_CrsGraph_def.hpp.
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::CrsGraph | ( | const Teuchos::RCP< const map_type > & | rowMap, |
const Teuchos::RCP< const map_type > & | colMap, | ||
const Teuchos::ArrayRCP< size_t > & | rowPointers, | ||
const Teuchos::ArrayRCP< LocalOrdinal > & | columnIndices, | ||
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null |
||
) |
Constructor specifying column Map and arrays containing the graph in sorted, local ids.
rowMap | [in] Distribution of rows of the graph. |
colMap | [in] Distribution of columns of the graph. |
rowPointers | [in] The beginning of each row in the graph, as in a CSR "rowptr" array. The length of this vector should be equal to the number of rows in the graph, plus one. This last entry should store the nunber of nonzeros in the graph. |
columnIndices | [in] The local indices of the columns, as in a CSR "colind" array. The length of this vector should be equal to the number of unknowns in the graph. |
params | [in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values. |
Definition at line 512 of file Tpetra_CrsGraph_def.hpp.
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::CrsGraph | ( | const Teuchos::RCP< const map_type > & | rowMap, |
const Teuchos::RCP< const map_type > & | colMap, | ||
const local_graph_type & | lclGraph, | ||
const Teuchos::RCP< Teuchos::ParameterList > & | params | ||
) |
Constructor specifying column Map and a local (sorted) graph, which the resulting CrsGraph views.
Unlike most other CrsGraph constructors, successful completion of this constructor will result in a fill-complete graph.
rowMap | [in] Distribution of rows of the graph. |
colMap | [in] Distribution of columns of the graph. |
lclGraph | [in] A locally indexed Kokkos::StaticCrsGraph whose local row indices come from the specified row Map, and whose local column indices come from the specified column Map. |
params | [in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values. |
Definition at line 546 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Destructor.
Definition at line 678 of file Tpetra_CrsGraph_def.hpp.
|
inline |
Create a cloned CrsGraph for a different Node type.
This method creates a new CrsGraph on a specified Kokkos Node type, with all of the entries of this CrsGraph object.
node2 | [in] Kokkos Node instance for constructing the clone CrsGraph and its constituent objects. |
params | [in/out] Optional list of parameters. If not null, any missing parameters will be filled in with their default values. See the list below for valid options. |
Parameters accepted by this method:
true
, creates the clone with a static allocation profile. If false, a dynamic allocation profile is used.true
, fills clone using this graph's column map and local indices (requires that this graph have a column map.) If false, fills clone using global indices and does not provide a column map. By default, will use local indices only if this graph is using local indices.true
, calls fillComplete() on the cloned CrsGraph object, with parameters from params
sublist "CrsGraph". The domain map and range maps passed to fillComplete() are those of the map being cloned, if they exist. Otherwise, the row map is used. Definition at line 570 of file Tpetra_CrsGraph_decl.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::setParameterList | ( | const Teuchos::RCP< Teuchos::ParameterList > & | params | ) |
Set the given list of parameters (must be nonnull).
Definition at line 722 of file Tpetra_CrsGraph_def.hpp.
Teuchos::RCP< const Teuchos::ParameterList > Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getValidParameters | ( | ) | const |
Default parameter list suitable for validation.
Definition at line 685 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::insertGlobalIndices | ( | const GlobalOrdinal | globalRow, |
const Teuchos::ArrayView< const GlobalOrdinal > & | indices | ||
) |
Insert global indices into the graph.
globalRow
is a valid index in the row Map. It need not be owned by the calling process. isLocallyIndexed() == false
isStorageOptimized() == false
indicesAreAllocated() == true
isGloballyIndexed() == true
If globalRow
does not belong to the graph on this process, then it will be communicated to the appropriate process when globalAssemble() is called. (That method will be called automatically during the next call to fillComplete().) Otherwise, the entries will be inserted into the part of the graph owned by the calling process.
If the graph row already contains entries at the indices corresponding to values in indices
, then the redundant indices will be eliminated. This may happen either at insertion or during the next call to fillComplete().
Definition at line 2806 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::insertGlobalIndices | ( | const GlobalOrdinal | globalRow, |
const LocalOrdinal | numEnt, | ||
const GlobalOrdinal | inds[] | ||
) |
Epetra compatibility version of insertGlobalIndices (see above) that takes input as a raw pointer, rather than Teuchos::ArrayView.
Arguments are the same and in the same order as Epetra_CrsGraph::InsertGlobalIndices.
Definition at line 2889 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::insertLocalIndices | ( | const LocalOrdinal | localRow, |
const Teuchos::ArrayView< const LocalOrdinal > & | indices | ||
) |
Insert local indices into the graph.
localRow
is a local row belonging to the graph on this process. isGloballyIndexed() == false
isStorageOptimized() == false
hasColMap() == true
indicesAreAllocated() == true
isLocallyIndexed() == true
indices
, then the redundant indices will be eliminated; this may happen at insertion or during the next call to fillComplete(). Definition at line 2673 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::insertLocalIndices | ( | const LocalOrdinal | localRow, |
const LocalOrdinal | numEnt, | ||
const LocalOrdinal | inds[] | ||
) |
Epetra compatibility version of insertLocalIndices (see above) that takes input as a raw pointer, rather than Teuchos::ArrayView.
Arguments are the same and in the same order as Epetra_CrsGraph::InsertMyIndices.
Definition at line 2744 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::removeLocalIndices | ( | LocalOrdinal | localRow | ) |
Remove all graph indices from the specified local row.
localRow
is a local row of this graph. isGloballyIndexed() == false
isStorageOptimized() == false
getNumEntriesInLocalRow(localRow) == 0
indicesAreAllocated() == true
isLocallyIndexed() == true
Definition at line 2964 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::globalAssemble | ( | ) |
Communicate non-local contributions to other processes.
Each of the methods in this group is a global collective. It is necessary to call these mehtods on all nodes participating in the communicator associated with this graph.This method is called automatically by fillComplete(). Most users do not need to call this themselves, though we do permit this.
Definition at line 3227 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::resumeFill | ( | const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null | ) |
Resume fill operations. After calling fillComplete(), resumeFill() must be called before initiating any changes to the graph.
resumeFill() may be called repeatedly.
isFillActive() == true
isFillComplete() == false
Definition at line 3387 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::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.
This tells the graph to optimize its data structures for computational kernels, and to prepare (MPI) communication patterns.
Off-process indices are distributed (via globalAssemble()), indices are sorted, redundant indices are eliminated, and global indices are transformed to local indices.
isFillActive() && ! isFillComplete()
! isFillActive() && isFillComplete()
domainMap | [in] The graph's domain Map. MUST be one to one! |
rangeMap | [in] The graph's range Map. MUST be one to one! May be, but need not be, the same as the domain Map. |
params | [in/out] List of parameters controlling this method's behavior. See below for valid parameters. |
List of valid parameters in params
:
bool
): Default is false. If true, then isStorageOptimized() returns true after this method finishes. See isStorageOptimized() for consequences. Definition at line 3445 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::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.
See above three-argument version of fillComplete for full documentation. If the graph does not yet have domain and range Maps (i.e., if fillComplete has not yet been called on this graph at least once), then this method uses the graph's row Map (result of this->getRowMap()) as both the domain Map and the range Map. Otherwise, this method uses the graph's existing domain and range Maps.
params | [in/out] List of parameters controlling this method's behavior. See documentation of the three-argument version of fillComplete (above) for valid parameters. |
Definition at line 3418 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::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().
The graph must already have filled local 1-D storage. If the graph has been constructed in any other way, this method will throw an exception. This routine is needed to support other Trilinos packages and should not be called by ordinary users.
domainMap | [in] The graph's domain Map. MUST be one to one! |
rangeMap | [in] The graph's range Map. MUST be one to one! May be, but need not be, the same as the domain Map. |
importer | [in] Import from the graph's domain Map to its column Map. If no Import is necessary (i.e., if the domain and column Maps are the same, in the sense of Tpetra::Map::isSameAs), then this may be Teuchos::null. |
exporter | [in] Export from the graph's row Map to its range Map. If no Export is necessary (i.e., if the row and range Maps are the same, in the sense of Tpetra::Map::isSameAs), then this may be Teuchos::null. |
params | [in/out] List of parameters controlling this method's behavior. |
Definition at line 3563 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the communicator.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 1006 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the underlying node.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 802 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the Map that describes the row distribution in this graph.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 811 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the Map that describes the column distribution in this graph.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 820 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the Map associated with the domain of this graph.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 829 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the Map associated with the domain of this graph.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 838 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the importer associated with this graph.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 846 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the exporter associated with this graph.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 855 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the number of global rows in the graph.
Undefined if isFillActive().
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 734 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the number of global columns in the graph.
Returns the number of entries in the domain map of the matrix. Undefined if isFillActive().
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 743 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the number of graph rows owned on the calling node.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 757 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the number of columns connected to the locally owned rows of this graph.
Throws std::runtime_error if hasColMap() == false
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 767 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the index base for global indices for this graph.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 1015 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the global number of entries in the graph.
Undefined if isFillActive().
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 907 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the local number of entries in the graph.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 916 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the current number of entries on this node in the specified global row.
Returns OrdinalTraits<size_t>::invalid() if the specified global row does not belong to this graph.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 2345 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Get the number of entries in the given row (local index).
Teuchos::OrdinalTraits<size_t>::invalid()
. Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 2361 of file Tpetra_CrsGraph_def.hpp.
size_t Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getNodeAllocationSize | ( | ) | const |
Returns the total number of indices allocated for the graph, across all rows on this node.
This is the allocation available to the user. Actual allocation may be larger, for example, after calling fillComplete(), and thus this does not necessarily reflect the memory consumption of the this graph.
This quantity is computed during the actual allocation. Therefore, if indicesAreAllocated() == false
, this method returns OrdinalTraits<size_t>::invalid()
.
Definition at line 997 of file Tpetra_CrsGraph_def.hpp.
size_t Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getNumAllocatedEntriesInGlobalRow | ( | GlobalOrdinal | globalRow | ) | const |
Returns the current number of allocated entries for this node in the specified global row .
Throws exception std::runtime_error if the specified global row does not belong to this node.
Definition at line 2375 of file Tpetra_CrsGraph_def.hpp.
size_t Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getNumAllocatedEntriesInLocalRow | ( | LocalOrdinal | localRow | ) | const |
Returns the current number of allocated entries on this node in the specified local row.
Throws exception std::runtime_error if the specified local row is not valid for this node.
Definition at line 2390 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the number of global diagonal entries, based on global row/column index comparisons.
Undefined if isFillActive().
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 793 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns the number of local diagonal entries, based on global row/column index comparisons.
Undefined if isFillActive().
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 784 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Maximum number of entries in all rows over all processes.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 925 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Maximum number of entries in all rows owned by the calling process.
Undefined if isFillActive().
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 934 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Whether the graph has a column Map.
A CrsGraph has a column Map either because it was given to its constructor, or because it was constructed in fillComplete(). Calling fillComplete() always makes a column Map if the graph does not already have one.
A column Map lets the graph
The latter is mainly useful for a graph associated with a CrsMatrix.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 864 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Whether the graph is locally lower triangular.
! isFillActive()
. If fill is active, this method's behavior is undefined.Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 970 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Whether the graph is locally upper triangular.
! isFillActive()
. If fill is active, this method's behavior is undefined.Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 961 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
If graph indices are in the local range, this function returns true. Otherwise, this function returns false. */.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 979 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
If graph indices are in the global range, this function returns true. Otherwise, this function returns false. */.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 988 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Returns true
if fillComplete() has been called and the graph is in compute mode.
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 943 of file Tpetra_CrsGraph_def.hpp.
bool Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::isFillActive | ( | ) | const |
Returns true
if resumeFill() has been called and the graph is in edit mode.
Definition at line 952 of file Tpetra_CrsGraph_def.hpp.
bool Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::isSorted | ( | ) | const |
Whether graph indices in all rows are known to be sorted.
A fill-complete graph is always sorted, as is a newly constructed graph. A graph is sorted immediately after calling resumeFill(), but any changes to the graph may result in the sorting status becoming unknown (and therefore, presumed unsorted).
Definition at line 1033 of file Tpetra_CrsGraph_def.hpp.
bool Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::isStorageOptimized | ( | ) | const |
Returns true
if storage has been optimized.
Optimized storage means that the allocation of each row is equal to the number of entries. The effect is that a pass through the matrix, i.e., during a mat-vec, requires minimal memory traffic. One limitation of optimized storage is that no new indices can be added to the graph.
Definition at line 873 of file Tpetra_CrsGraph_def.hpp.
ProfileType Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getProfileType | ( | ) | const |
Returns true
if the graph was allocated with static data structures.
Definition at line 898 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Get a copy of the given row, using global indices.
GlobalRow | [in] Global index of the row. |
Indices | [out] On output: Global column indices. |
NumIndices | [out] Number of indices returned. |
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 2551 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Get a copy of the given row, using local indices.
LocalRow | [in] Local index of the row. |
Indices | [out] On output: Local column indices. |
NumIndices | [out] Number of indices returned. |
hasColMap()
Implements Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 2498 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getGlobalRowView | ( | GlobalOrdinal | GlobalRow, |
Teuchos::ArrayView< const GlobalOrdinal > & | Indices | ||
) | const |
Get a const, non-persisting view of the given global row's global column indices, as a Teuchos::ArrayView.
GlobalRow | [in] Global index of the row. |
Indices | [out] Global column indices in the row. If the given row is not a valid row index on the calling process, then the result has no entries (its size is zero). |
! isLocallyIndexed()
Indices.size() == getNumEntriesInGlobalRow(GlobalRow)
Definition at line 2636 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getLocalRowView | ( | LocalOrdinal | LocalRow, |
Teuchos::ArrayView< const LocalOrdinal > & | indices | ||
) | const |
Get a const, non-persisting view of the given local row's local column indices, as a Teuchos::ArrayView.
LocalRow | [in] Local index of the row. |
indices | [out] Local column indices in the row. If the given row is not a valid row index on the calling process, then the result has no entries (its size is zero). |
! isGloballyIndexed()
indices.size() == getNumEntriesInLocalRow(LocalRow)
Definition at line 2593 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Return a simple one-line description of this object.
Reimplemented from Tpetra::DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 5087 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Print the object to the given output stream with given verbosity level.
Reimplemented from Tpetra::DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 5110 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Compare the source and target (this) objects for compatibility.
Implements Tpetra::DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 5236 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Perform copies and permutations that are local to this process.
source | [in] On entry, the source object, from which we are distributing. We distribute to the destination object, which is *this object. |
numSameIDs | [in] The umber of elements that are the same on the source and destination (this) objects. These elements are owned by the same process in both the source and destination objects. No permutation occurs. |
numPermuteIDs | [in] The number of elements that are locally permuted between the source and destination objects. |
permuteToLIDs | [in] List of the elements that are permuted. They are listed by their LID in the destination object. |
permuteFromLIDs | [in] List of the elements that are permuted. They are listed by their LID in the source object. |
Reimplemented from Tpetra::DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 5250 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Pack this object's data for Import or Export.
Reimplemented from Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 5379 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getLocalDiagOffsets | ( | const Kokkos::View< size_t *, device_type, Kokkos::MemoryUnmanaged > & | offsets | ) | const |
Get offsets of the diagonal entries in the graph.
This method helps users optimize Tpetra::CrsMatrix::getLocalDiagCopy and Tpetra::Experimental::BlockCrsMatrix::getLocalDiagCopy, for several calls when the graph's structure does not change. The method fills an array of offsets of the local diagonal entries in the matrix. getLocalDiagCopy uses the offsets to extract the diagonal entries directly, without needing to search for them using Map lookups and search in each row of the graph.
The output array's contents are not defined in any other context other than for use in getLocalDiagCopy. For example, you should not rely on offsets(i)
being the index of the diagonal entry in the views returned by Tpetra::CrsMatrix::getLocalRowView. This may be the case, but it need not be. (For example, we may choose to optimize the lookups down to the optimized storage level, in which case the offsets will be computed with respect to the underlying storage format, rather than with respect to the views.)
Changes to the graph's structure, or calling fillComplete on the graph (if its structure is not already fixed), may make the output array's contents invalid. "Invalid" means that you must call this method again to recompute the offsets.
offsets.dimension_0() >= this->getNodeNumRows()
offsets | [out] Output array of offsets. This method does NOT allocate the array; the caller must allocate. Must have getNodeNumRows() entries on the calling process. (This may be different on different processes.) |
Definition at line 5605 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getLocalDiagOffsets | ( | Teuchos::ArrayRCP< size_t > & | offsets | ) | const |
Backwards compatibility overload of the above method.
This method takes a Teuchos::ArrayRCP instead of a Kokkos::View. It also reallocates the output array if it is not long enough.
offsets | [out] Output array of offsets. This method reallocates the array if it is not long enough. This is why the method takes the array by reference. |
Definition at line 5855 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getNumEntriesPerLocalRowUpperBound | ( | Teuchos::ArrayRCP< const size_t > & | boundPerLocalRow, |
size_t & | boundForAllLocalRows, | ||
bool & | boundSameForAllLocalRows | ||
) | const |
Get an upper bound on the number of entries that can be stored in each row.
When a CrsGraph is constructed, callers must give an upper bound on the number of entries in each local row. They may either supply a single integer which is the upper bound for all local rows, or they may give an array with a possibly different upper bound for each local row.
This method returns the upper bound for each row. If numEntriesPerLocalRowBound is Teuchos::null on output and boundSameForAllLocalRows is true on output, then numEntriesAllLocalRowsBound is the upper bound for all local rows. If boundSameForAllLocalRows is false on output, then numEntriesPerLocalRowBound has zero or more entries on output, and numEntriesPerLocalRowBound[i_local] is the upper bound for local row i_local.
The output argument boundSameForAllLocalRows is conservative; it only tells us whether boundForAllLocalRows has a meaningful value on output. We don't necessarily check whether all entries of boundPerLocalRow are the same.
Definition at line 3116 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::setAllIndices | ( | const typename local_graph_type::row_map_type & | rowPointers, |
const typename local_graph_type::entries_type::non_const_type & | columnIndices | ||
) |
Set the graph's data directly, using 1-D storage.
hasColMap() == true
rowPointers.size() != getNodeNumRows()+1
Definition at line 3003 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::setAllIndices | ( | const Teuchos::ArrayRCP< size_t > & | rowPointers, |
const Teuchos::ArrayRCP< LocalOrdinal > & | columnIndices | ||
) |
Set the graph's data directly, using 1-D storage.
hasColMap() == true
rowPointers.size() != getNodeNumRows()+1
Definition at line 3055 of file Tpetra_CrsGraph_def.hpp.
Teuchos::ArrayRCP< const size_t > Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getNodeRowPtrs | ( | ) | const |
Get a host view of the row offsets.
This may return either a copy or a view of the row offsets. In either case, it will always live in host memory, never in (CUDA) device memory.
Definition at line 2404 of file Tpetra_CrsGraph_def.hpp.
Teuchos::ArrayRCP< const LocalOrdinal > Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getNodePackedIndices | ( | ) | const |
Get an Teuchos::ArrayRCP of the packed column-indices.
The returned buffer exists in host-memory.
Definition at line 2489 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::replaceColMap | ( | const Teuchos::RCP< const map_type > & | newColMap | ) |
Replace the graph's current column Map with the given Map.
This only replaces the column Map. It does not change the graph's current column indices, or otherwise apply a permutation. For example, suppose that before calling this method, the calling process owns a row containing local column indices [0, 2, 4]. These indices do not change, nor does their order change, as a result of calling this method.
newColMap | [in] New column Map. Must be nonnull. |
Definition at line 4063 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::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 object as well.
newColMap | [in] New column Map. Must be nonnull. |
newImport | [in] New Import object. Optional; computed if not provided or if null. Computing an Import is expensive, so it is worth providing this if you can. |
sortIndicesInEachRow | [in] If true, sort the indices in each row after reindexing. |
Definition at line 4082 of file Tpetra_CrsGraph_def.hpp.
void Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::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.
isFillComplete() == true
isFillActive() == false
Either the given Import object is null, or the target Map of the given Import is the same as this graph's column Map.
Either the given Import object is null, or the source Map of the given Import is the same as this graph's domain Map.
Definition at line 4350 of file Tpetra_CrsGraph_def.hpp.
|
virtual |
Remove processes owning zero rows from the Maps and their communicator.
newMap | [in] This must be the result of calling the removeEmptyProcesses() method on the row Map. If it is not, this method's behavior is undefined. This pointer will be null on excluded processes. |
This method satisfies the strong exception guarantee, as long the destructors of Export, Import, and Map do not throw exceptions. This means that either the method returns normally (without throwing an exception), or there are no externally visible side effects. However, this does not guarantee no deadlock when the graph's original communicator contains more than one process. In order to prevent deadlock, you must still wrap this call in a try/catch block and do an all-reduce over all processes in the original communicator to test whether the call succeeded. This safety measure should usually be unnecessary, since the method call should only fail on user error or failure to allocate memory.
Definition at line 5493 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Make the graph's column Map, if it does not already have one.
Definition at line 4684 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Insert indices into the given row.
! (lg == LocalIndices && I == GlobalIndices)
. It does not make sense to give this method local column indices (meaning that the graph has a column Map), yet to ask it to store global indices.rowInfo | [in] Result of CrsGraph's getRowInfo() or updateAllocAndValues() methods, for the locally owned row (whose local index is rowInfo.localRow ) for which you want to insert indices. |
newInds | [in] View of the column indices to insert. If lg == GlobalIndices , then newInds.ginds, a Teuchos::ArrayView<const GlobalOrdinal> , contains the (global) column indices to insert. Otherwise, if lg == LocalIndices , then newInds.linds, a Teuchos::ArrayView<const LocalOrdinal> , contains the (local) column indices to insert. |
lg | If lg == GlobalIndices , then the input indices (in newInds ) are global indices. Otherwise, if lg == LocalIndices , the input indices are local indices. |
I | If lg == GlobalIndices , then this method will store the input indices as global indices. Otherwise, if I == LocalIndices , this method will store the input indices as local indices. |
Definition at line 1744 of file Tpetra_CrsGraph_def.hpp.
|
inlineprotected |
Insert indices and their values into the given row.
Scalar | The type of a single value. When this method is called by CrsMatrix, Scalar corresponds to the first template parameter of CrsMatrix. |
! (lg == LocalIndices && I == GlobalIndices)
. It does not make sense to give this method local column indices (meaning that the graph has a column Map), yet to ask it to store global indices.rowInfo | [in] Result of CrsGraph's getRowInfo() or updateAllocAndValues() methods, for the locally owned row (whose local index is rowInfo.localRow ) for which you want to insert indices. |
newInds | [in] View of the column indices to insert. If lg == GlobalIndices , then newInds.ginds, a Teuchos::ArrayView<const GlobalOrdinal> , contains the (global) column indices to insert. Otherwise, if lg == LocalIndices , then newInds.linds, a Teuchos::ArrayView<const LocalOrdinal> , contains the (local) column indices to insert. |
oldRowVals | [out] View of the current values. They will be overwritten with the new values. |
newRowVals | [in] View of the new values. They will be copied over the old values. |
lg | If lg == GlobalIndices , then the input indices (in newInds ) are global indices. Otherwise, if lg == LocalIndices , the input indices are local indices. |
I | If lg == GlobalIndices , then this method will store the input indices as global indices. Otherwise, if I == LocalIndices , this method will store the input indices as local indices. |
Definition at line 1620 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Like insertLocalIndices(), but with column Map filtering.
Definition at line 2755 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Like insertGlobalIndices(), but with column Map filtering.
Definition at line 2901 of file Tpetra_CrsGraph_def.hpp.
|
inlineprotected |
Transform the given values using local indices.
LocalIndicesViewType | Kokkos::View specialization that is a 1-D array of LocalOrdinal. |
OutputScalarViewType | Kokkos::View specialization that is a 1-D array of the type of values in the sparse matrix (that type is CrsMatrix::impl_scalar_type). |
InputScalarViewType | Kokkos::View specialization that is a 1-D array of the type of values in the sparse matrix, but with a possibly different memory space than how the matrix stores its values. |
BinaryFunction | The type of the binary function f to use for updating the output value(s). This should be convertible to std::function<impl_scalar_type (const impl_scalar_type&, const impl_scalar_type&)>. |
rowInfo | [in] Information about a given row of the graph. |
rowVals | [in/out] The values to be transformed. They correspond to the row indicated by rowInfo. |
inds | [in] The (local) indices in the row, for which to transform the corresponding values in rowVals. |
newVals | [in] Values to use for transforming rowVals. It's probably OK for these to alias rowVals. |
f | [in] A binary function used to transform rowVals. |
This method transforms the values using the expression
where k is the local index corresponding to inds[j]
. It ignores invalid local column indices, but they are counted in the return value.
Definition at line 1805 of file Tpetra_CrsGraph_decl.hpp.
|
inlineprotected |
Implementation detail of CrsMatrix::sumIntoLocalValues.
LocalIndicesViewType | Kokkos::View specialization that is a 1-D array of LocalOrdinal. |
OutputScalarViewType | Kokkos::View specialization that is a 1-D array of the type of values in the sparse matrix (that type is CrsMatrix::impl_scalar_type). |
InputScalarViewType | Kokkos::View specialization that is a 1-D array of the type of values in the sparse matrix, but with a possibly different memory space than how the matrix stores its values. |
rowInfo | [in] Result of getRowInfo on the index of the local row of the matrix to modify. |
rowVals | [in/out] On input: Values of the row of the sparse matrix to modify. On output: The modified values. |
inds | [in] Local column indices of that row to modify. |
newVals | [in] For each k, increment the value in rowVals corresponding to local column index inds[k] by newVals[k]. |
atomic | [in] Whether to use atomic updates (+=) when incrementing values. |
Definition at line 1970 of file Tpetra_CrsGraph_decl.hpp.
|
inlineprotected |
Implementation detail of CrsMatrix::replaceLocalValues.
OutputScalarViewType | Kokkos::View specialization that is a 1-D array of the type of values in the sparse matrix (that type is CrsMatrix::impl_scalar_type). |
LocalIndicesViewType | Kokkos::View specialization that is a 1-D array of LocalOrdinal. |
InputScalarViewType | Kokkos::View specialization that is a 1-D array of the type of values in the sparse matrix, but with a possibly different memory space than how the matrix stores its values. |
rowInfo | [in] Result of getRowInfo on the index of the local row of the matrix to modify. |
rowVals | [in/out] On input: Values of the row of the sparse matrix to modify. On output: The modified values. |
inds | [in] Local column indices of that row to modify. |
newVals | [in] For each k, replace the value corresponding to local column index inds[k] with newVals[k]. |
Definition at line 2125 of file Tpetra_CrsGraph_decl.hpp.
|
inlineprotected |
Implementation detail of CrsMatrix::sumIntoGlobalValues.
Scalar | The type of each entry in the sparse matrix. |
InputMemorySpace | Kokkos memory space / device in which the input data live. This may differ from the memory space in which the current matrix values (rowVals) live. |
ValsMemorySpace | Kokkos memory space / device in which the matrix's current values live. This may differ from the memory space in which the input data (inds and newVals) live. |
rowInfo | [in] Result of getRowInfo on the index of the local row of the matrix to modify. |
rowVals | [in/out] On input: Values of the row of the sparse matrix to modify. On output: The modified values. |
inds | [in] Global column indices of that row to modify. |
newVals | [in] For each k, increment the value in rowVals corresponding to global column index inds[k] by newVals[k]. |
Definition at line 2266 of file Tpetra_CrsGraph_decl.hpp.
|
inlineprotected |
Implementation detail of CrsMatrix::replaceGlobalValues.
OutputScalarViewType | Kokkos::View specialization that is a 1-D array of the type of values in the sparse matrix (that type is CrsMatrix::impl_scalar_type). |
GlobalIndicesViewType | Kokkos::View specialization that is a 1-D array of GlobalOrdinal. |
InputScalarViewType | Kokkos::View specialization that is a 1-D array of the type of values in the sparse matrix, but with a possibly different memory space than how the matrix stores its values. |
rowInfo | [in] Result of getRowInfo on the index of the local row of the matrix to modify. |
rowVals | [in/out] On input: Values of the row of the sparse matrix to modify. On output: The modified values. |
inds | [in] Global column indices of that row to modify. |
newVals | [in] For each k, replace the value in rowVals corresponding to global column index inds[k] with newVals[k]. |
Definition at line 2385 of file Tpetra_CrsGraph_decl.hpp.
|
inlineprotected |
Transform the given values using global indices.
Scalar | The type of each entry in the sparse matrix. |
BinaryFunction | The type of the binary function f to use for updating the sparse matrix's value(s). |
InputMemorySpace | Kokkos memory space / device in which the input data live. This may differ from the memory space in which the current matrix values (rowVals) live. |
ValsMemorySpace | Kokkos memory space / device in which the matrix's current values live. This may differ from the memory space in which the input data (inds and newVals) live. |
rowInfo | [in] Information about a given row of the graph. |
rowVals | [in/out] The values to be transformed. They correspond to the row indicated by rowInfo . |
inds | [in] The (global) indices in the row, for which to transform the corresponding values in rowVals . |
newVals | [in] Values to use for transforming rowVals . These must NOT alias rowVals . |
f | [in] A binary function used to transform rowVals . |
Teuchos::OrdinalTraits<LocalOrdinal>::invalid()
. Definition at line 2529 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Whether duplicate column indices in each row have been merged.
Definition at line 1042 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Report that we made a local modification to its structure.
Call this after making a local change to the graph's structure. Changing the structure locally invalidates the "is sorted" and "is merged" states.
Definition at line 1051 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Sort the column indices in all the rows.
Definition at line 4662 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Sort the column indices in the given row.
Definition at line 2097 of file Tpetra_CrsGraph_def.hpp.
|
inlineprotected |
Sort the column indices and their values in the given row.
Scalar | The type of the values. When calling this method from CrsMatrix, this should be the same as the Scalar template parameter of CrsMatrix. |
rowinfo | [in] Result of getRowInfo() for the row. |
values | [in/out] On input: values for the given row. If indices is an array of the column indices in the row, then values and indices should have the same number of entries, and indices[k] should be the column index corresponding to values[k]. On output: the same values, but sorted in the same order as the (now sorted) column indices in the row. |
Definition at line 2673 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Merge duplicate row indices in all of the rows.
isGloballyIndexed() == false
.isMerged() == false
. That is, this function would normally only be called after calling sortIndices(). Definition at line 5017 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Merge duplicate row indices in the given row.
isStorageOptimized() == false
Definition at line 2110 of file Tpetra_CrsGraph_def.hpp.
|
inlineprotected |
Merge duplicate row indices in the given row, along with their corresponding values.
This method is only called by CrsMatrix, for a CrsMatrix whose graph is this CrsGraph instance. It is only called when the matrix owns the graph, not when the matrix was constructed with a const graph.
isStorageOptimized() == false
Definition at line 2712 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Set the domain and range Maps, and invalidate the Import and/or Export objects if necessary.
If the domain Map has changed, invalidate the Import object (if there is one). Likewise, if the range Map has changed, invalidate the Export object (if there is one).
Definition at line 2139 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Get information about the locally owned row with local index myRow.
Definition at line 1543 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Get information about the locally owned row with global index gblRow.
If gblRow
is not locally owned, the localRow
field of the returned struct is Teuchos::OrdinalTraits<size_t>::invalid()
.
The point of this method is to fuse the global-to-local row index lookup for checking whether gblRow
is locally owned, with other error checking that getRowInfo() does. This avoids an extra global-to-local index lookup in methods like CrsMatrix::replaceGlobalValues().
Definition at line 1622 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Get a const, nonowned, locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRow).
Definition at line 1219 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Get a nonconst, nonowned, locally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRow).
Definition at line 1294 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Get a pointer to the local column indices of a locally owned row, using the result of getRowInfo.
lclInds | [out] Pointer to the local column indices of the given row. |
numEnt | [out] Number of entries in the given row. |
rowinfo | [in] Result of getRowInfo(lclRow) for the row lclRow to view. |
Definition at line 1255 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Get a const, nonowned, globally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRow).
Definition at line 1451 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Get a nonconst, nonowned, globally indexed view of the locally owned row myRow, such that rowinfo = getRowInfo(myRow).
Definition at line 1516 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Get a pointer to the global column indices of a locally owned row, using the result of getRowInfoFromGlobalRowIndex.
gblInds | [out] Pointer to the global column indices of the given row. |
numEnt | [out] Number of entries in the given row. |
rowinfo | [in] Result of getRowInfoFromGlobalRowIndex(gblRow) for the row to view, whose global row index is gblRow . |
Definition at line 1478 of file Tpetra_CrsGraph_def.hpp.
CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::local_graph_type Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, classic >::getLocalGraph | ( | ) | const |
Get the local graph.
This is only a valid representation of the local graph if the (global) graph is fill complete.
Definition at line 4392 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Whether it is correct to call getRowInfo().
Definition at line 5591 of file Tpetra_CrsGraph_def.hpp.
|
protected |
Throw an exception if the internal state is not consistent.
Definition at line 2169 of file Tpetra_CrsGraph_def.hpp.
|
inherited |
Import data into this object using an Import object ("forward mode").
The input DistObject is always the source of the data redistribution operation, and the *this
object is always the target.
If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use this method with your precomputed Import object if you want to do an Import, else use doExport() with a precomputed Export object.
source | [in] The "source" object for redistribution. |
importer | [in] Precomputed data redistribution plan. Its source Map must be the same as the input DistObject's Map, and its target Map must be the same as this->getMap() . |
CM | [in] How to combine incoming data with the same global index. |
Definition at line 248 of file Tpetra_DistObject_def.hpp.
|
inherited |
Import data into this object using an Export object ("reverse mode").
The input DistObject is always the source of the data redistribution operation, and the *this
object is always the target.
If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use the version of doImport() that takes a precomputed Import object in that case.
source | [in] The "source" object for redistribution. |
exporter | [in] Precomputed data redistribution plan. Its target Map must be the same as the input DistObject's Map, and its source Map must be the same as this->getMap() . (Note the difference from forward mode.) |
CM | [in] How to combine incoming data with the same global index. |
Definition at line 310 of file Tpetra_DistObject_def.hpp.
|
inherited |
Export data into this object using an Export object ("forward mode").
The input DistObject is always the source of the data redistribution operation, and the *this
object is always the target.
If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use this method with your precomputed Export object if you want to do an Export, else use doImport() with a precomputed Import object.
source | [in] The "source" object for redistribution. |
exporter | [in] Precomputed data redistribution plan. Its source Map must be the same as the input DistObject's Map, and its target Map must be the same as this->getMap() . |
CM | [in] How to combine incoming data with the same global index. |
Definition at line 279 of file Tpetra_DistObject_def.hpp.
|
inherited |
Export data into this object using an Import object ("reverse mode").
The input DistObject is always the source of the data redistribution operation, and the *this
object is always the target.
If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use the version of doExport() that takes a precomputed Export object in that case.
source | [in] The "source" object for redistribution. |
importer | [in] Precomputed data redistribution plan. Its target Map must be the same as the input DistObject's Map, and its source Map must be the same as this->getMap() . (Note the difference from forward mode.) |
CM | [in] How to combine incoming data with the same global index. |
Definition at line 342 of file Tpetra_DistObject_def.hpp.
|
inherited |
Whether this is a globally distributed object.
For a definition of "globally distributed" (and its opposite, "locally replicated"), see the documentation of Map's isDistributed() method.
Definition at line 374 of file Tpetra_DistObject_def.hpp.
|
inlinevirtualinherited |
The Map describing the parallel distribution of this object.
Note that some Tpetra objects might be distributed using multiple Map objects. For example, CrsMatrix has both a row Map and a column Map. It is up to the subclass to decide which Map to use when invoking the DistObject constructor.
Definition at line 373 of file Tpetra_DistObject_decl.hpp.
|
inherited |
Print this object to the given output stream.
We generally assume that all MPI processes can print to the given stream.
Definition at line 1224 of file Tpetra_DistObject_def.hpp.
|
virtualinherited |
Remove processes which contain no entries in this object's Map.
On input, this object is distributed over the Map returned by getMap() (the "original Map," with its communicator, the "original communicator"). The input newMap
of this method must be the same as the result of calling getMap()->removeEmptyProcesses()
. On processes in the original communicator which contain zero entries ("excluded processes," as opposed to "included processes"), the input newMap
must be Teuchos::null
(which is what getMap()->removeEmptyProcesses()
returns anyway).
On included processes, reassign this object's Map (that would be returned by getMap()) to the input newMap
, and do any work that needs to be done to restore correct semantics. On excluded processes, free any data that needs freeing, and do any other work that needs to be done to restore correct semantics.
This method has collective semantics over the original communicator. On exit, the only method of this object which is safe to call on excluded processes is the destructor. This implies that subclasses' destructors must not contain communication operations.
Definition at line 210 of file Tpetra_DistObject_def.hpp.
|
protectedvirtualinherited |
Whether the implementation's instance promises always to have a constant number of packets per LID (local index), and if so, how many packets per LID there are.
If this method returns zero, the instance says that it might possibly have a different number of packets for each LID (local index) to send or receive. If it returns nonzero, the instance promises that the number of packets is the same for all LIDs, and that the return value is this number of packets per LID.
The default implementation of this method returns zero. This does not affect the behavior of doTransfer() in any way. If a nondefault implementation returns nonzero, doTransfer() will use this information to avoid unnecessary allocation and / or resizing of arrays.
Definition at line 381 of file Tpetra_DistObject_def.hpp.
|
protectedvirtualinherited |
Redistribute data across memory images.
src | [in] The source object, to redistribute into the target object, which is *this object. |
CM | [in] The combine mode that describes how to combine values that map to the same global ID on the same process. |
permuteToLIDs | [in] See copyAndPermute(). |
permuteFromLIDs | [in] See copyAndPermute(). |
remoteLIDs | [in] List of entries (as local IDs) in the destination object to receive from other processes. |
exportLIDs | [in] See packAndPrepare(). |
distor | [in/out] The Distributor object that knows how to redistribute data. |
revOp | [in] Whether to do a forward or reverse mode redistribution. |
Definition at line 388 of file Tpetra_DistObject_def.hpp.
|
inlineprotectedvirtualinherited |
Whether the subclass implements the "old" or "new" (Kokkos-friendly) interface.
The "old" interface consists of copyAndPermute, packAndPrepare, and unpackAndCombine. The "new" interface consists of copyAndPermuteNew, packAndPrepareNew, and unpackAndCombineNew. The new interface is preferred because it facilitates thread parallelization using Kokkos data structures.
At some point, we will remove the old interface, and rename the "new" interface (by removing "New" from the methods' names), so that it becomes the only interface.
Definition at line 591 of file Tpetra_DistObject_decl.hpp.
|
inlineprotectedvirtualinherited |
Perform any packing or preparation required for communication.
source | [in] Source object for the redistribution. |
exportLIDs | [in] List of the entries (as local IDs in the source object) we will be sending to other images. |
exports | [out] On exit, the buffer for data to send. |
numPacketsPerLID | [out] On exit, the implementation of this method must do one of two things: set numPacketsPerLID[i] to contain the number of packets to be exported for exportLIDs[i] and set constantNumPackets to zero, or set constantNumPackets to a nonzero value. If the latter, the implementation need not fill numPacketsPerLID. |
constantNumPackets | [out] On exit, 0 if numPacketsPerLID has variable contents (different size for each LID). If nonzero, then it is expected that the number of packets per LID is constant, and that constantNumPackets is that value. |
distor | [in] The Distributor object we are using. |
Definition at line 646 of file Tpetra_DistObject_decl.hpp.
|
inlineprotectedvirtualinherited |
Perform any unpacking and combining after communication (old version that uses Teuchos memory management classes to hold data).
importLIDs | [in] List of the entries (as LIDs in the destination object) we received from other images. |
imports | [in] Buffer containing data we received. |
numPacketsPerLID | [in] If constantNumPackets is zero, then numPacketsPerLID[i] contains the number of packets imported for importLIDs[i]. |
constantNumPackets | [in] If nonzero, then numPacketsPerLID is constant (same value in all entries) and constantNumPackets is that value. If zero, then numPacketsPerLID[i] is the number of packets imported for importLIDs[i]. |
distor | [in] The Distributor object we are using. |
CM | [in] The combine mode to use when combining the imported entries with existing entries. |
Definition at line 687 of file Tpetra_DistObject_decl.hpp.
|
inlineprotectedvirtualinherited |
Perform any unpacking and combining after communication (new version that uses Kokkos data structures to hold data).
The imports
input argument controls whether this method should unpack on host or unpack on device.
importLIDs | [in] List of the entries (as LIDs in the destination object) we received from other images. |
imports | [in] Buffer containing data we received. |
numPacketsPerLID | [in] If constantNumPackets is zero, then numPacketsPerLID[i] contains the number of packets imported for importLIDs[i]. |
constantNumPackets | [in] If nonzero, then numPacketsPerLID is constant (same value in all entries) and constantNumPackets is that value. If zero, then numPacketsPerLID[i] is the number of packets imported for importLIDs[i]. |
distor | [in] The Distributor object we are using. |
CM | [in] The combine mode to use when combining the imported entries with existing entries. |
Definition at line 721 of file Tpetra_DistObject_decl.hpp.
|
protectedvirtualinherited |
Hook for creating a const view.
doTransfer() calls this on the source object. By default, it does nothing, but the source object can use this as a hint to fetch data from a compute buffer on an off-CPU device (such as a GPU) into host memory.
Definition at line 1239 of file Tpetra_DistObject_def.hpp.
|
protectedvirtualinherited |
Hook for creating a nonconst view.
doTransfer() calls this on the destination (*this
) object. By default, it does nothing, but the destination object can use this as a hint to fetch data from a compute buffer on an off-CPU device (such as a GPU) into host memory.
rwo | [in] Whether to create a write-only or a read-and-write view. For Kokkos Node types where compute buffers live in a separate memory space (e.g., in the device memory of a discrete accelerator like a GPU), a write-only view only requires copying from host memory to the compute buffer, whereas a read-and-write view requires copying both ways (once to read, from the compute buffer to host memory, and once to write, back to the compute buffer). |
Definition at line 1245 of file Tpetra_DistObject_def.hpp.
|
protectedvirtualinherited |
Hook for releasing views.
true
.doTransfer() calls this on both the source and destination objects, once it no longer needs to access that object's data. By default, this method does nothing. Implementations may use this as a hint to free host memory which is a view of a compute buffer, once the host memory view is no longer needed. Some implementations may prefer to mirror compute buffers in host memory; for these implementations, releaseViews() may do nothing.
Definition at line 1251 of file Tpetra_DistObject_def.hpp.
|
protectedinherited |
Reallocate imports_ if needed.
This unfortunately must be declared protected, for the same reason that imports_ is declared protected.
newSize | [in] New size of imports_. |
debug | [in] Whether to print (copious) debug output to stderr. |
Definition at line 444 of file Tpetra_DistObject_def.hpp.
|
related |
Nonmember function to create an empty CrsGraph given a row Map and the max number of entries allowed locally per row.
Definition at line 3145 of file Tpetra_CrsGraph_decl.hpp.
|
staticprotected |
Whether sumIntoLocalValues and transformLocalValues should use atomic updates by default.
Definition at line 1755 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
The Map describing the distribution of rows of the graph.
Definition at line 2912 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
The Map describing the distribution of columns of the graph.
Definition at line 2914 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
The Map describing the range of the (matrix corresponding to the) graph.
Definition at line 2916 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
The Map describing the domain of the (matrix corresponding to the) graph.
Definition at line 2918 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
|
protected |
|
protected |
Local graph; only initialized after first fillComplete() call.
Definition at line 2936 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Whether the graph was allocated with static or dynamic profile.
Definition at line 2945 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
The maximum number of entries to allow in each locally owned row, per row.
This comes in as an argument to some of the graph's constructors. Either this or numAllocForAllRows_ is used, but not both. allocateIndices(), setAllIndices(), and expertStaticFillComplete() all deallocate this array once they are done with it.
This is a host View because it is only ever used on the host. It has the HostMirror type for backwards compatibility; this used to be a DualView with default layout, so making this a HostMirror ensures that we can still take it directly by assignment from the constructors that take DualView, without a deep copy.
This array only exists on a process before the graph's indices are allocated on that process. After that point, it is discarded, since the graph's allocation implicitly or explicitly represents the same information.
FIXME (mfh 07 Aug 2014) We want graph's constructors to allocate, rather than doing lazy allocation at first insert. This will make both k_numAllocPerRow_ and numAllocForAllRows_ obsolete.
Definition at line 2973 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
The maximum number of entries to allow in each locally owned row.
This is an argument to some of the graph's constructors. Either this or k_numAllocPerRow_ is used, but not both.
FIXME (mfh 07 Aug 2014) We want graph's constructors to allocate, rather than doing lazy allocation at first insert. This will make both k_numAllocPerRow_ and numAllocForAllRows_ obsolete.
Definition at line 2984 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Local column indices for all rows.
This is only allocated if
Definition at line 2996 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Global column indices for all rows.
This is only allocated if
Definition at line 3008 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Row offsets for "1-D" storage.
This is only allocated if "1-D" (StaticProfile) storage is active. In that case, if beg = k_rowPtrs_(i_lcl) and end = k_rowPtrs_(i_lcl+1) for local row index i_lcl, then
Only the first k_numRowEntries_(i_lcl) of these entries are actual valid column indices. Any remaining entries are "extra space." If the graph's storage is packed, then there is no extra space, and the k_numRowEntries_ array is invalid.
Both the k_rowPtrs_ and k_numRowEntries_ arrays are not allocated if the graph has 2-D (DynamicProfile) storage.
If it is allocated, k_rowPtrs_ has length getNodeNumRows()+1. The k_numRowEntries_ array has has length getNodeNumRows(), again if it is allocated.
Definition at line 3034 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Local column indices for all rows.
This is only allocated if
In that case, if i_lcl is the local index of a locally owned row, then lclInds2D_[i_lcl] stores the local column indices for that row.
Definition at line 3061 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Global column indices for all rows.
This is only allocated if
In that case, if i_gbl is the global index of a globally owned row, then gblInds2D_[i_gbl] stores the global column indices for that row.
Definition at line 3074 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
The number of local entries in each locally owned row.
This is deallocated in fillComplete() if fillComplete()'s "Optimize Storage" parameter is set to true
.
This may also exist with 1-D storage, if storage is unpacked.
Definition at line 3083 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Status of the graph's storage, when not in a fill-complete state.
The phrase "When not in a fill-complete state" is important. When the graph is fill complete, it always uses 1-D "packed" storage. However, if the "Optimize Storage" parameter to fillComplete was false, the graph may keep unpacked 1-D or 2-D storage around and resume it on the next resumeFill call.
Definition at line 3095 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Whether the graph is locally lower triangular.
Definition at line 3103 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Whether the graph is locally upper triangular.
Definition at line 3105 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Whether the graph's indices are sorted in each row, on this process.
Definition at line 3107 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Whether the graph's indices are non-redundant (merged) in each row, on this process.
Definition at line 3110 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Whether this process has computed local constants.
Definition at line 3112 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Whether all processes have computed global constants.
Definition at line 3114 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Nonlocal data given to insertGlobalValues or sumIntoGlobalValues.
Definition at line 3117 of file Tpetra_CrsGraph_decl.hpp.
|
protected |
Whether to require makeColMap() (and therefore fillComplete()) to order column Map GIDs associated with each remote process in ascending order.
makeColMap() always groups remote GIDs by process rank, so that all remote GIDs with the same owning rank occur contiguously. By default, it always sorts remote GIDs in increasing order within those groups. This behavior differs from Epetra, which does not sort remote GIDs with the same owning process.
This is true
by default, which means "sort remote GIDs." If you don't want to sort (for compatibility with Epetra), call sortGhostColumnGIDsWithinProcessBlock(false).
Definition at line 3133 of file Tpetra_CrsGraph_decl.hpp.
|
protectedinherited |
The Map over which this object is distributed.
Definition at line 772 of file Tpetra_DistObject_decl.hpp.
|
protectedinherited |
Buffer into which packed data are imported (received from other processes).
Unfortunately, I had to declare these protected, because CrsMatrix uses them at one point. Please, nobody else use them.
Definition at line 781 of file Tpetra_DistObject_decl.hpp.
|
protectedinherited |
Number of packets to receive for each receive operation.
This array is used in Distributor::doPosts() (and doReversePosts()) when starting the ireceive operation.
This may be ignored in doTransfer() if constantNumPackets is nonzero, indicating a constant number of packets per LID. (For example, MultiVector sets the constantNumPackets output argument of packAndPrepare() to the number of columns in the multivector.)
Unfortunately, I had to declare this protected, because CrsMatrix uses it at one point. Please, nobody else use it.
Definition at line 806 of file Tpetra_DistObject_decl.hpp.
|
protectedinherited |
Buffer from which packed data are exported (sent to other processes).
Unfortunately, I had to declare this protected, because CrsMatrix uses it at one point. Please, nobody else use it.
Definition at line 813 of file Tpetra_DistObject_decl.hpp.
|
protectedinherited |
Number of packets to send for each send operation.
This array is used in Distributor::doPosts() (and doReversePosts()) for preparing for the send operation.
This may be ignored in doTransfer() if constantNumPackets is nonzero, indicating a constant number of packets per LID. (For example, MultiVector sets the constantNumPackets output argument of packAndPrepare() to the number of columns in the multivector.)
Unfortunately, I had to declare this protected, because CrsMatrix uses them at one point. Please, nobody else use it.
Definition at line 828 of file Tpetra_DistObject_decl.hpp.