Tpetra parallel linear algebra Version of the Day
|
Utility functions for packing and unpacking sparse matrix entries. More...
#include "Tpetra_ConfigDefs.hpp"
#include "Tpetra_Import.hpp"
#include "Tpetra_HashTable.hpp"
#include "Tpetra_Map.hpp"
#include "Tpetra_Util.hpp"
#include "Tpetra_Distributor.hpp"
#include "Tpetra_Details_reallocDualViewIfNeeded.hpp"
#include "Tpetra_Details_MpiTypeTraits.hpp"
#include "Tpetra_Vector.hpp"
#include "Kokkos_DualView.hpp"
#include <Teuchos_Array.hpp>
#include <utility>
#include <set>
#include "Tpetra_CrsMatrix_decl.hpp"
Go to the source code of this file.
Namespaces | |
namespace | Tpetra |
Namespace Tpetra contains the class and methods constituting the Tpetra library. | |
Functions | |
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. | |
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. | |
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 | |
template<typename LocalOrdinal , typename GlobalOrdinal , typename Node > | |
void | Tpetra::Import_Util::getTwoTransferOwnershipVector (const ::Tpetra::Details::Transfer< LocalOrdinal, GlobalOrdinal, Node > &transferThatDefinesOwnership, bool useReverseModeForOwnership, const ::Tpetra::Details::Transfer< LocalOrdinal, GlobalOrdinal, Node > &transferForMigratingData, bool useReverseModeForMigration, Tpetra::Vector< int, LocalOrdinal, GlobalOrdinal, Node > &owningPIDs) |
Generates an list of owning PIDs based on two transfer (aka import/export objects) Let: OwningMap = useReverseModeForOwnership ? transferThatDefinesOwnership.getTargetMap() : transferThatDefinesOwnership.getSourceMap(); MapAo = useReverseModeForOwnership ? transferThatDefinesOwnership.getSourceMap() : transferThatDefinesOwnership.getTargetMap(); MapAm = useReverseModeForMigration ? transferThatDefinesMigration.getTargetMap() : transferThatDefinesMigration.getSourceMap(); VectorMap = useReverseModeForMigration ? transferThatDefinesMigration.getSourceMap() : transferThatDefinesMigration.getTargetMap(); Precondition: 1) MapAo.isSameAs(*MapAm) - map compatibility between transfers 2) VectorMap->isSameAs(*owningPIDs->getMap()) - map compabibility between transfer & vector 3) OwningMap->isOneToOne() - owning map is 1-to-1 — Precondition 3 is only checked in DEBUG mode — Postcondition: owningPIDs[VectorMap->getLocalElement(GID i)] = j iff (OwningMap->isLocalElement(GID i) on rank j) | |
Utility functions for packing and unpacking sparse matrix entries.
Definition in 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 458 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 633 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 718 of file Tpetra_Import_Util2.hpp.
void Tpetra::Import_Util::getTwoTransferOwnershipVector | ( | const ::Tpetra::Details::Transfer< LocalOrdinal, GlobalOrdinal, Node > & | transferThatDefinesOwnership, |
bool | useReverseModeForOwnership, | ||
const ::Tpetra::Details::Transfer< LocalOrdinal, GlobalOrdinal, Node > & | transferForMigratingData, | ||
bool | useReverseModeForMigration, | ||
Tpetra::Vector< int, LocalOrdinal, GlobalOrdinal, Node > & | owningPIDs ) |
Generates an list of owning PIDs based on two transfer (aka import/export objects) Let: OwningMap = useReverseModeForOwnership ? transferThatDefinesOwnership.getTargetMap() : transferThatDefinesOwnership.getSourceMap(); MapAo = useReverseModeForOwnership ? transferThatDefinesOwnership.getSourceMap() : transferThatDefinesOwnership.getTargetMap(); MapAm = useReverseModeForMigration ? transferThatDefinesMigration.getTargetMap() : transferThatDefinesMigration.getSourceMap(); VectorMap = useReverseModeForMigration ? transferThatDefinesMigration.getSourceMap() : transferThatDefinesMigration.getTargetMap(); Precondition: 1) MapAo.isSameAs(*MapAm) - map compatibility between transfers 2) VectorMap->isSameAs(*owningPIDs->getMap()) - map compabibility between transfer & vector 3) OwningMap->isOneToOne() - owning map is 1-to-1 — Precondition 3 is only checked in DEBUG mode — Postcondition: owningPIDs[VectorMap->getLocalElement(GID i)] = j iff (OwningMap->isLocalElement(GID i) on rank j)
Definition at line 968 of file Tpetra_Import_Util2.hpp.