Tpetra parallel linear algebra
Version of the Day
|
Utility functions for packing and unpacking sparse matrix entries. More...
#include "Tpetra_ConfigDefs.hpp"
#include "Tpetra_Details_PackTraits.hpp"
#include "Tpetra_Import.hpp"
#include "Tpetra_HashTable.hpp"
#include "Tpetra_Map.hpp"
#include "Tpetra_Util.hpp"
#include "Tpetra_Distributor.hpp"
#include "Kokkos_DualView.hpp"
#include <Teuchos_Array.hpp>
#include <utility>
#include "Tpetra_CrsMatrix_decl.hpp"
#include "Tpetra_CrsMatrix.hpp"
Go to the source code of this file.
Namespaces | |
Tpetra | |
Namespace Tpetra contains the class and methods constituting the Tpetra library. | |
Functions | |
template<typename Scalar , typename LocalOrdinal , typename GlobalOrdinal , typename Node > | |
void | Tpetra::Import_Util::packAndPrepareWithOwningPIDs (const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &SourceMatrix, const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Kokkos::DualView< char *, typename Node::device_type > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor, const Teuchos::ArrayView< const int > &SourcePids) |
Special version of Tpetra::CrsMatrix::packAndPrepare that also packs owning process ranks. More... | |
template<typename Scalar , typename LocalOrdinal , typename GlobalOrdinal , typename Node > | |
size_t | Tpetra::Import_Util::unpackAndCombineWithOwningPIDsCount (const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &SourceMatrix, const Teuchos::ArrayView< const LocalOrdinal > &importLIDs, const Teuchos::ArrayView< const char > &imports, const Teuchos::ArrayView< const size_t > &numPacketsPerLID, size_t constantNumPackets, Distributor &distor, CombineMode combineMode, size_t numSameIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteToLIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteFromLIDs) |
Special version of Tpetra::CrsMatrix::unpackAndCombine that also unpacks owning process ranks. More... | |
template<typename Scalar , typename LocalOrdinal , typename GlobalOrdinal , typename Node > | |
void | Tpetra::Import_Util::unpackAndCombineIntoCrsArrays (const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &SourceMatrix, const Teuchos::ArrayView< const LocalOrdinal > &importLIDs, const Teuchos::ArrayView< const char > &imports, const Teuchos::ArrayView< const size_t > &numPacketsPerLID, size_t constantNumPackets, Distributor &distor, CombineMode combineMode, size_t numSameIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteToLIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteFromLIDs, size_t TargetNumRows, size_t TargetNumNonzeros, int MyTargetPID, const Teuchos::ArrayView< size_t > &rowPointers, const Teuchos::ArrayView< GlobalOrdinal > &columnIndices, const Teuchos::ArrayView< Scalar > &values, const Teuchos::ArrayView< const int > &SourcePids, Teuchos::Array< int > &TargetPids) |
unpackAndCombineIntoCrsArrays More... | |
template<typename Scalar , typename Ordinal > | |
void | Tpetra::Import_Util::sortCrsEntries (const Teuchos::ArrayView< size_t > &CRS_rowptr, const Teuchos::ArrayView< Ordinal > &CRS_colind, const Teuchos::ArrayView< Scalar > &CRS_vals) |
Sort the entries of the (raw CSR) matrix by column index within each row. More... | |
template<typename Scalar , typename Ordinal > | |
void | Tpetra::Import_Util::sortAndMergeCrsEntries (const Teuchos::ArrayView< size_t > &CRS_rowptr, const Teuchos::ArrayView< Ordinal > &CRS_colind, const Teuchos::ArrayView< Scalar > &CRS_vals) |
Sort and merge the entries of the (raw CSR) matrix by column index within each row. More... | |
template<typename LocalOrdinal , typename GlobalOrdinal , typename Node > | |
void | Tpetra::Import_Util::lowCommunicationMakeColMapAndReindex (const Teuchos::ArrayView< const size_t > &rowPointers, const Teuchos::ArrayView< LocalOrdinal > &columnIndices_LID, const Teuchos::ArrayView< GlobalOrdinal > &columnIndices_GID, const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::ArrayView< const int > &owningPids, Teuchos::Array< int > &remotePids, Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap) |
lowCommunicationMakeColMapAndReindex More... | |
Utility functions for packing and unpacking sparse matrix entries.
Definition in file Tpetra_Import_Util2.hpp.
void Tpetra::Import_Util::packAndPrepareWithOwningPIDs | ( | const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > & | SourceMatrix, |
const Teuchos::ArrayView< const LocalOrdinal > & | exportLIDs, | ||
Kokkos::DualView< char *, typename Node::device_type > & | exports, | ||
const Teuchos::ArrayView< size_t > & | numPacketsPerLID, | ||
size_t & | constantNumPackets, | ||
Distributor & | distor, | ||
const Teuchos::ArrayView< const int > & | SourcePids | ||
) |
Special version of Tpetra::CrsMatrix::packAndPrepare that also packs owning process ranks.
One of several short-cut routines to optimize fill complete for the special case of sparse matrix-matrix multiply.
Note: The SourcePids vector should contain a list of owning PIDs for each column in the ColMap, as from Epetra_Util::GetPids, without the "-1 for local" option being used. This routine is basically Tpetra::CrsMatrix::packAndPrepare, but it packs the owning PIDs as well as the GIDs.
Definition at line 539 of file Tpetra_Import_Util2.hpp.
size_t Tpetra::Import_Util::unpackAndCombineWithOwningPIDsCount | ( | const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > & | SourceMatrix, |
const Teuchos::ArrayView< const LocalOrdinal > & | importLIDs, | ||
const Teuchos::ArrayView< const char > & | imports, | ||
const Teuchos::ArrayView< const size_t > & | numPacketsPerLID, | ||
size_t | constantNumPackets, | ||
Distributor & | distor, | ||
CombineMode | combineMode, | ||
size_t | numSameIDs, | ||
const Teuchos::ArrayView< const LocalOrdinal > & | permuteToLIDs, | ||
const Teuchos::ArrayView< const LocalOrdinal > & | permuteFromLIDs | ||
) |
Special version of Tpetra::CrsMatrix::unpackAndCombine that also unpacks owning process ranks.
It belongs with packAndPrepareWithOwningPIDs() (see above).
Perform the count for unpacking the imported column indices pids, and values, and combining them into matrix. Return (a ceiling on) the number of local stored entries ("nonzeros") in the matrix. If there are no shared rows in the SourceMatrix this count is exact.
Note: This routine also counts the copyAndPermute nonzeros in addition to those that come in via import.
Definition at line 762 of file Tpetra_Import_Util2.hpp.
void Tpetra::Import_Util::unpackAndCombineIntoCrsArrays | ( | const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > & | SourceMatrix, |
const Teuchos::ArrayView< const LocalOrdinal > & | importLIDs, | ||
const Teuchos::ArrayView< const char > & | imports, | ||
const Teuchos::ArrayView< const size_t > & | numPacketsPerLID, | ||
size_t | constantNumPackets, | ||
Distributor & | distor, | ||
CombineMode | combineMode, | ||
size_t | numSameIDs, | ||
const Teuchos::ArrayView< const LocalOrdinal > & | permuteToLIDs, | ||
const Teuchos::ArrayView< const LocalOrdinal > & | permuteFromLIDs, | ||
size_t | TargetNumRows, | ||
size_t | TargetNumNonzeros, | ||
int | MyTargetPID, | ||
const Teuchos::ArrayView< size_t > & | rowPointers, | ||
const Teuchos::ArrayView< GlobalOrdinal > & | columnIndices, | ||
const Teuchos::ArrayView< Scalar > & | values, | ||
const Teuchos::ArrayView< const int > & | SourcePids, | ||
Teuchos::Array< int > & | TargetPids | ||
) |
unpackAndCombineIntoCrsArrays
Note: The SourcePids vector (on input) should contain owning PIDs for each column in the (source) ColMap, as from Tpetra::Import_Util::getPids, with the "-1 for local" option being used.
Note: The TargetPids vector (on output) will contain owning PIDs for each entry in the matrix, with the "-1 for local" for locally owned entries.
Definition at line 835 of file Tpetra_Import_Util2.hpp.
void Tpetra::Import_Util::sortCrsEntries | ( | const Teuchos::ArrayView< size_t > & | CRS_rowptr, |
const Teuchos::ArrayView< Ordinal > & | CRS_colind, | ||
const Teuchos::ArrayView< Scalar > & | CRS_vals | ||
) |
Sort the entries of the (raw CSR) matrix by column index within each row.
Definition at line 1094 of file Tpetra_Import_Util2.hpp.
void Tpetra::Import_Util::sortAndMergeCrsEntries | ( | const Teuchos::ArrayView< size_t > & | CRS_rowptr, |
const Teuchos::ArrayView< Ordinal > & | CRS_colind, | ||
const Teuchos::ArrayView< Scalar > & | CRS_vals | ||
) |
Sort and merge the entries of the (raw CSR) matrix by column index within each row.
Entries with the same column index get merged additively.
Definition at line 1137 of file Tpetra_Import_Util2.hpp.
void Tpetra::Import_Util::lowCommunicationMakeColMapAndReindex | ( | const Teuchos::ArrayView< const size_t > & | rowPointers, |
const Teuchos::ArrayView< LocalOrdinal > & | columnIndices_LID, | ||
const Teuchos::ArrayView< GlobalOrdinal > & | columnIndices_GID, | ||
const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & | domainMap, | ||
const Teuchos::ArrayView< const int > & | owningPids, | ||
Teuchos::Array< int > & | remotePids, | ||
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & | colMap | ||
) |
lowCommunicationMakeColMapAndReindex
If you know the owning PIDs already, you can make the colmap a lot less expensively. If LocalOrdinal and GlobalOrdinal are the same, you can (and should) use the same array for both columnIndices_LID and columnIndices_GID. This routine works just fine "in place."
Note: The owningPids vector (on input) should contain owning PIDs for each entry in the matrix, like that generated by Tpetra::Import_Util::unpackAndCombineIntoCrsArrays routine. Note: This method will return a Teuchos::Array of the remotePIDs, used for construction of the importer.
Definition at line 1203 of file Tpetra_Import_Util2.hpp.