Tpetra parallel linear algebra Version of the Day
|
Sparse matrix whose entries are small dense square blocks, all of the same dimensions. More...
#include <Tpetra_BlockCrsMatrix_decl.hpp>
Public Types | |
Public typedefs | |
using | scalar_type = Scalar |
The type of entries in the matrix (that is, of each entry in each block). | |
using | impl_scalar_type = typename BMV::impl_scalar_type |
The implementation type of entries in the matrix. | |
typedef LO | local_ordinal_type |
The type of local indices. | |
typedef GO | global_ordinal_type |
The type of global indices. | |
typedef Node | node_type |
The Node type. | |
typedef Node::device_type | device_type |
The Kokkos::Device specialization that this class uses. | |
typedef device_type::execution_space | execution_space |
The Kokkos execution space that this class uses. | |
typedef device_type::memory_space | memory_space |
The Kokkos memory space that this class uses. | |
typedef ::Tpetra::Map< LO, GO, node_type > | map_type |
The implementation of Map that this class uses. | |
typedef ::Tpetra::MultiVector< Scalar, LO, GO, node_type > | mv_type |
The implementation of MultiVector that this class uses. | |
typedef ::Tpetra::CrsGraph< LO, GO, node_type > | crs_graph_type |
The implementation of CrsGraph that this class uses. | |
typedef Kokkos::View< impl_scalar_type **, Impl::BlockCrsMatrixLittleBlockArrayLayout, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > | little_block_type |
The type used to access nonconst matrix blocks. | |
typedef little_block_type::HostMirror | little_block_host_type |
typedef Kokkos::View< const impl_scalar_type **, Impl::BlockCrsMatrixLittleBlockArrayLayout, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > | const_little_block_type |
The type used to access const matrix blocks. | |
typedef BMV::little_vec_type | little_vec_type |
The type used to access nonconst vector blocks. | |
typedef BMV::little_host_vec_type | little_host_vec_type |
typedef BMV::const_little_vec_type | const_little_vec_type |
The type used to access const vector blocks. | |
typedef BMV::const_little_host_vec_type | const_host_little_vec_type |
using | row_matrix_type = RowMatrix< Scalar, LO, GO, node_type > |
using | local_inds_device_view_type = typename row_matrix_type::local_inds_device_view_type |
using | local_inds_host_view_type = typename row_matrix_type::local_inds_host_view_type |
using | nonconst_local_inds_host_view_type = typename row_matrix_type::nonconst_local_inds_host_view_type |
using | global_inds_device_view_type = typename row_matrix_type::global_inds_device_view_type |
using | global_inds_host_view_type = typename row_matrix_type::global_inds_host_view_type |
using | nonconst_global_inds_host_view_type = typename row_matrix_type::nonconst_global_inds_host_view_type |
using | values_device_view_type = typename row_matrix_type::values_device_view_type |
using | values_host_view_type = typename row_matrix_type::values_host_view_type |
using | nonconst_values_host_view_type = typename row_matrix_type::nonconst_values_host_view_type |
using | local_graph_device_type = typename crs_graph_type::local_graph_device_type |
using | local_matrix_device_type = KokkosSparse::Experimental::BsrMatrix< impl_scalar_type, local_ordinal_type, device_type, void, typename local_graph_device_type::size_type > |
using | local_matrix_host_type = typename local_matrix_device_type::HostMirror |
Typedefs | |
using | mag_type = typename Kokkos::ArithTraits< Scalar >::mag_type |
Type of a norm result. | |
typedef Kokkos::View< constsize_t *, typenameNode::device_type >::const_type | row_ptrs_device_view_type |
typedef row_ptrs_device_view_type::HostMirror::const_type | row_ptrs_host_view_type |
Public Member Functions | |
virtual void | pack (const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Teuchos::Array< Packet > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets) const =0 |
Pack the object's data for an Import or Export. | |
Constructors and destructor | |
BlockCrsMatrix () | |
Default constructor: Makes an empty block matrix. | |
BlockCrsMatrix (const crs_graph_type &graph, const LO blockSize) | |
Constructor that takes a graph and a block size. | |
BlockCrsMatrix (const crs_graph_type &graph, const typename local_matrix_device_type::values_type &values, const LO blockSize) | |
BlockCrsMatrix (const crs_graph_type &graph, const map_type &domainPointMap, const map_type &rangePointMap, const LO blockSize) | |
Constructor that takes a graph, domain and range point Maps, and a block size. | |
virtual | ~BlockCrsMatrix () |
Destructor (declared virtual for memory safety). | |
Implementation of Tpetra::Operator | |
Teuchos::RCP< const map_type > | getDomainMap () const override |
Get the (point) domain Map of this matrix. | |
Teuchos::RCP< const map_type > | getRangeMap () const override |
Get the (point) range Map of this matrix. | |
Teuchos::RCP< const map_type > | getRowMap () const override |
get the (mesh) map for the rows of this block matrix. | |
Teuchos::RCP< const map_type > | getColMap () const override |
get the (mesh) map for the columns of this block matrix. | |
global_size_t | getGlobalNumRows () const override |
get the global number of block rows | |
size_t | getLocalNumRows () const override |
get the local number of block rows | |
size_t | getLocalMaxNumRowEntries () const override |
Maximum number of entries in any row of the matrix, on this process. | |
void | apply (const mv_type &X, mv_type &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const override |
For this matrix A, compute Y := beta * Y + alpha * Op(A) * X . | |
bool | hasTransposeApply () const override |
Whether it is valid to apply the transpose or conjugate transpose of this matrix. | |
void | setAllToScalar (const Scalar &alpha) |
Set all matrix entries equal to alpha . | |
Implementation of Teuchos::Describable | |
std::string | description () const override |
One-line description of this object. | |
void | describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const override |
Print a description of this object to the given output stream. | |
Extraction Methods | |
virtual void | getGlobalRowCopy (GO GlobalRow, nonconst_global_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const override |
Get a copy of the given global row's entries. | |
virtual void | getGlobalRowView (GO GlobalRow, global_inds_host_view_type &indices, values_host_view_type &values) const override |
Get a constant, nonpersisting, globally indexed view of the given row of the matrix. | |
virtual void | getLocalDiagCopy (::Tpetra::Vector< Scalar, LO, GO, Node > &diag) const override |
Get a copy of the diagonal entries, distributed by the row Map. | |
Extraction Methods | |
virtual void | getLocalDiagCopy (Vector< Scalar, LO, GO, Node > &diag) const=0 |
Get a copy of the diagonal entries, distributed by the row Map. | |
Pure virtual functions to be overridden by subclasses. | |
virtual void | getLocalDiagCopy (Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const |
Get the diagonal of the operator. | |
virtual void | apply (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const =0 |
Computes the operator-multivector application. | |
virtual bool | hasDiagonal () const |
Whether this operator can return its diagonal. | |
Mathematical methods | |
virtual void | leftScale (const Vector< Scalar, LO, GO, Node > &x)=0 |
Scale the matrix on the left with the given Vector. | |
virtual void | rightScale (const Vector< Scalar, LO, GO, Node > &x)=0 |
Scale the matrix on the right with the given Vector. | |
virtual Teuchos::RCP< RowMatrix< Scalar, LO, GO, Node > > | add (const Scalar &alpha, const RowMatrix< Scalar, LO, GO, Node > &A, const Scalar &beta, const Teuchos::RCP< const Map< LO, GO, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LO, GO, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) const |
Return a new RowMatrix which is the result of beta*this + alpha*A . | |
Implementation of Packable interface | |
virtual void | pack (const Teuchos::ArrayView< const LO > &exportLIDs, Teuchos::Array< char > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets) const |
Pack this object's data for an Import or Export. | |
Public methods for redistributing data | |
void | doImport (const SrcDistObject &source, const Import< LO, GO, Node > &importer, const CombineMode CM, const bool restrictedMode=false) |
Import data into this object using an Import object ("forward mode"). | |
void | doImport (const SrcDistObject &source, const Export< LO, GO, Node > &exporter, const CombineMode CM, const bool restrictedMode=false) |
Import data into this object using an Export object ("reverse mode"). | |
void | doExport (const SrcDistObject &source, const Export< LO, GO, Node > &exporter, const CombineMode CM, const bool restrictedMode=false) |
Export data into this object using an Export object ("forward mode"). | |
void | doExport (const SrcDistObject &source, const Import< LO, GO, Node > &importer, const CombineMode CM, const bool restrictedMode=false) |
Export data into this object using an Import object ("reverse mode"). | |
void | beginImport (const SrcDistObject &source, const Import< LO, GO, Node > &importer, const CombineMode CM, const bool restrictedMode=false) |
void | beginImport (const SrcDistObject &source, const Export< LO, GO, Node > &exporter, const CombineMode CM, const bool restrictedMode=false) |
void | beginExport (const SrcDistObject &source, const Export< LO, GO, Node > &exporter, const CombineMode CM, const bool restrictedMode=false) |
void | beginExport (const SrcDistObject &source, const Import< LO, GO, Node > &importer, const CombineMode CM, const bool restrictedMode=false) |
void | endImport (const SrcDistObject &source, const Import< LO, GO, Node > &importer, const CombineMode CM, const bool restrictedMode=false) |
void | endImport (const SrcDistObject &source, const Export< LO, GO, Node > &exporter, const CombineMode CM, const bool restrictedMode=false) |
void | endExport (const SrcDistObject &source, const Export< LO, GO, Node > &exporter, const CombineMode CM, const bool restrictedMode=false) |
void | endExport (const SrcDistObject &source, const Import< LO, GO, Node > &importer, const CombineMode CM, const bool restrictedMode=false) |
bool | transferArrived () const |
Whether the data from an import/export operation has arrived, and is ready for the unpack and combine step. | |
Attribute accessor methods | |
bool | isDistributed () const |
Whether this is a globally distributed object. | |
virtual Teuchos::RCP< const map_type > | getMap () const |
The Map describing the parallel distribution of this object. | |
I/O methods | |
void | print (std::ostream &os) const |
Print this object to the given output stream. | |
Protected Types | |
typedef char | packet_type |
Implementation detail; tells. | |
Implementation of Tpetra::DistObject. | |
The methods here implement Tpetra::DistObject. They let BlockMultiVector participate in Import and Export operations. Users don't have to worry about these methods. | |
using | buffer_device_type = typename DistObject< Scalar, LO, GO, Node >::buffer_device_type |
Kokkos::Device specialization for communication buffers. | |
impl_scalar_type_dualview::t_host::const_type | getValuesHost () const |
impl_scalar_type_dualview::t_dev::const_type | getValuesDevice () const |
impl_scalar_type_dualview::t_host | getValuesHostNonConst () const |
Get the host or device View of the matrix's values (val_ ). | |
impl_scalar_type_dualview::t_dev | getValuesDeviceNonConst () const |
impl_scalar_type_dualview::t_host::const_type | getValuesHost (const LO &lclRow) const |
Get a const Host view of the locally owned values. | |
impl_scalar_type_dualview::t_dev::const_type | getValuesDevice (const LO &lclRow) const |
Get a const Device view of the locally owned values. | |
impl_scalar_type_dualview::t_host | getValuesHostNonConst (const LO &lclRow) |
Get a non-const Host view of the locally owned values. | |
impl_scalar_type_dualview::t_dev | getValuesDeviceNonConst (const LO &lclRow) |
Get a non-const Device view of the locally owned values. | |
virtual Teuchos::RCP< const Teuchos::Comm< int > > | getComm () const override |
The communicator over which this matrix is distributed. | |
virtual global_size_t | getGlobalNumCols () const override |
The global number of columns of this matrix. | |
virtual size_t | getLocalNumCols () const override |
The number of columns needed to apply the forward operator on this node. | |
virtual GO | getIndexBase () const override |
The index base for global indices in this matrix. | |
virtual global_size_t | getGlobalNumEntries () const override |
The global number of stored (structurally nonzero) entries. | |
virtual size_t | getLocalNumEntries () const override |
The local number of stored (structurally nonzero) entries. | |
virtual size_t | getNumEntriesInGlobalRow (GO globalRow) const override |
The current number of entries on the calling process in the specified global row. | |
virtual size_t | getGlobalMaxNumRowEntries () const override |
The maximum number of entries in any row over all processes in the matrix's communicator. | |
virtual bool | hasColMap () const override |
Whether this matrix has a well-defined column Map. | |
virtual bool | isLocallyIndexed () const override |
Whether matrix indices are locally indexed. | |
virtual bool | isGloballyIndexed () const override |
Whether matrix indices are globally indexed. | |
virtual bool | isFillComplete () const override |
Whether fillComplete() has been called. | |
virtual bool | supportsRowViews () const override |
Whether this object implements getLocalRowView() and getGlobalRowView(). | |
virtual bool | checkSizes (const ::Tpetra::SrcDistObject &source) override |
virtual void | copyAndPermute (const SrcDistObject &sourceObj, const size_t numSameIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteToLIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteFromLIDs, const CombineMode CM) override |
virtual void | packAndPrepare (const SrcDistObject &sourceObj, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &exportLIDs, Kokkos::DualView< packet_type *, buffer_device_type > &exports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, size_t &constantNumPackets) override |
virtual void | unpackAndCombine (const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &importLIDs, Kokkos::DualView< packet_type *, buffer_device_type > imports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, const size_t constantNumPackets, const CombineMode combineMode) override |
Methods for use only by experts | |
enum | ReverseOption |
Whether the data transfer should be performed in forward or reverse mode. More... | |
using | buffer_memory_space = ::Tpetra::Details::DefaultTypes::comm_buffer_memory_space< device_type > |
Kokkos memory space for communication buffers. | |
virtual void | removeEmptyProcessesInPlace (const Teuchos::RCP< const map_type > &newMap) |
Remove processes which contain no entries in this object's Map. | |
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. | |
virtual void | doTransfer (const SrcDistObject &src, const ::Tpetra::Details::Transfer< local_ordinal_type, global_ordinal_type, node_type > &transfer, const char modeString[], const ReverseOption revOp, const CombineMode CM, const bool restrictedMode) |
Redistribute data across (MPI) processes. | |
virtual bool | reallocArraysForNumPacketsPerLid (const size_t numExportLIDs, const size_t numImportLIDs) |
Reallocate numExportPacketsPerLID_ and/or numImportPacketsPerLID_, if necessary. | |
void | beginTransfer (const SrcDistObject &src, const ::Tpetra::Details::Transfer< local_ordinal_type, global_ordinal_type, node_type > &transfer, const char modeString[], const ReverseOption revOp, const CombineMode CM, const bool restrictedMode) |
Implementation detail of doTransfer. | |
void | endTransfer (const SrcDistObject &src, const ::Tpetra::Details::Transfer< local_ordinal_type, global_ordinal_type, node_type > &transfer, const char modeString[], const ReverseOption revOp, const CombineMode CM, const bool restrictedMode) |
void | doPosts (const Details::DistributorPlan &distributorPlan, size_t constantNumPackets, bool commOnHost, std::shared_ptr< std::string > prefix, const bool canTryAliasing, const CombineMode CM) |
void | doPackAndPrepare (const SrcDistObject &src, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &exportLIDs, size_t &constantNumPackets) |
void | doUnpackAndCombine (const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &remoteLIDs, size_t constantNumPackets, CombineMode CM) |
Block operations | |
LO | getBlockSize () const |
The number of degrees of freedom per mesh point. | |
virtual Teuchos::RCP< const ::Tpetra::RowGraph< LO, GO, Node > > | getGraph () const override |
Get the (mesh) graph. | |
const crs_graph_type & | getCrsGraph () const |
void | applyBlock (const BlockMultiVector< Scalar, LO, GO, Node > &X, BlockMultiVector< Scalar, LO, GO, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, const Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), const Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) |
Version of apply() that takes BlockMultiVector input and output. | |
void | importAndFillComplete (Teuchos::RCP< BlockCrsMatrix< Scalar, LO, GO, Node > > &destMatrix, const Import< LO, GO, Node > &importer) const |
Import from this to the given destination matrix, and make the result fill complete. | |
void | exportAndFillComplete (Teuchos::RCP< BlockCrsMatrix< Scalar, LO, GO, Node > > &destMatrix, const Export< LO, GO, Node > &exporter) const |
Import from this to the given destination matrix, and make the result fill complete. | |
LO | replaceLocalValues (const LO localRowInd, const LO colInds[], const Scalar vals[], const LO numColInds) const |
Replace values at the given (mesh, i.e., block) column indices, in the given (mesh, i.e., block) row. | |
LO | sumIntoLocalValues (const LO localRowInd, const LO colInds[], const Scalar vals[], const LO numColInds) const |
Sum into values at the given (mesh, i.e., block) column indices, in the given (mesh, i.e., block) row. | |
void | getLocalRowView (LO LocalRow, local_inds_host_view_type &indices, values_host_view_type &values) const override |
Get a view of the (mesh, i.e., block) row, using local (mesh, i.e., block) indices. | |
void | getLocalRowViewNonConst (LO LocalRow, local_inds_host_view_type &indices, nonconst_values_host_view_type &values) const |
virtual void | getLocalRowCopy (LO LocalRow, nonconst_local_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const override |
Not implemented. | |
little_block_type | getLocalBlockDeviceNonConst (const LO localRowInd, const LO localColInd) const |
little_block_host_type | getLocalBlockHostNonConst (const LO localRowInd, const LO localColInd) const |
LO | getLocalRowOffsets (const LO localRowInd, ptrdiff_t offsets[], const LO colInds[], const LO numColInds) const |
Get relative offsets corresponding to the given rows, given by local row index. | |
LO | replaceLocalValuesByOffsets (const LO localRowInd, const ptrdiff_t offsets[], const Scalar vals[], const LO numOffsets) const |
Like replaceLocalValues, but avoids computing row offsets. | |
LO | absMaxLocalValuesByOffsets (const LO localRowInd, const ptrdiff_t offsets[], const Scalar vals[], const LO numOffsets) const |
LO | sumIntoLocalValuesByOffsets (const LO localRowInd, const ptrdiff_t offsets[], const Scalar vals[], const LO numOffsets) const |
Like sumIntoLocalValues, but avoids computing row offsets. | |
size_t | getNumEntriesInLocalRow (const LO localRowInd) const override |
Return the number of entries in the given row on the calling process. | |
local_matrix_device_type | getLocalMatrixDevice () const |
bool | localError () const |
Whether this object had an error on the calling process. | |
std::string | errorMessages () const |
The current stream of error messages. | |
void | getLocalDiagOffsets (const Kokkos::View< size_t *, device_type, Kokkos::MemoryUnmanaged > &offsets) const |
Get offsets of the diagonal entries in the matrix. | |
void | getLocalDiagCopy (const Kokkos::View< impl_scalar_type ***, device_type, Kokkos::MemoryUnmanaged > &diag, const Kokkos::View< const size_t *, device_type, Kokkos::MemoryUnmanaged > &offsets) const |
Variant of getLocalDiagCopy() that uses precomputed offsets and puts diagonal blocks in a 3-D Kokkos::View. | |
LO | absMaxLocalValues (const LO localRowInd, const LO colInds[], const Scalar vals[], const LO numColInds) const |
Variant of getLocalDiagCopy() that uses precomputed offsets and puts diagonal blocks in a 3-D Kokkos::View. | |
Mathematical methods | |
virtual void | leftScale (const ::Tpetra::Vector< Scalar, LO, GO, Node > &x) override |
Scale the RowMatrix on the left with the given Vector x. | |
virtual void | rightScale (const ::Tpetra::Vector< Scalar, LO, GO, Node > &x) override |
Scale the RowMatrix on the right with the given Vector x. | |
virtual typename::Tpetra::RowMatrix< Scalar, LO, GO, Node >::mag_type | getFrobeniusNorm () const override |
The Frobenius norm of the matrix. | |
template<class BlockCrsMatrixType > | |
Teuchos::RCP< BlockCrsMatrixType > | Tpetra::importAndFillCompleteBlockCrsMatrix (const Teuchos::RCP< const BlockCrsMatrixType > &sourceMatrix, const Import< typename BlockCrsMatrixType::local_ordinal_type, typename BlockCrsMatrixType::global_ordinal_type, typename BlockCrsMatrixType::node_type > &importer) |
template<class BlockCrsMatrixType > | |
Teuchos::RCP< BlockCrsMatrixType > | Tpetra::exportAndFillCompleteBlockCrsMatrix (const Teuchos::RCP< const BlockCrsMatrixType > &sourceMatrix, const Export< typename BlockCrsMatrixType::local_ordinal_type, typename BlockCrsMatrixType::global_ordinal_type, typename BlockCrsMatrixType::node_type > &exporter) |
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 | checkSizes (const SrcDistObject &source)=0 |
Compare the source and target (this) objects for compatibility. | |
virtual void | copyAndPermute (const SrcDistObject &source, const size_t numSameIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteToLIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteFromLIDs, const CombineMode CM) |
Perform copies and permutations that are local to the calling (MPI) process. | |
virtual void | packAndPrepare (const SrcDistObject &source, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &exportLIDs, Kokkos::DualView< packet_type *, buffer_device_type > &exports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, size_t &constantNumPackets) |
Pack data and metadata for communication (sends). | |
virtual void | unpackAndCombine (const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &importLIDs, Kokkos::DualView< packet_type *, buffer_device_type > imports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, const size_t constantNumPackets, const CombineMode combineMode) |
Perform any unpacking and combining after communication. | |
std::unique_ptr< std::string > | createPrefix (const char className[], const char methodName[]) const |
virtual bool | reallocImportsIfNeeded (const size_t newSize, const bool verbose, const std::string *prefix, const bool remoteLIDsContiguous=false, const CombineMode CM=INSERT) |
Reallocate imports_ if needed. | |
Teuchos::RCP< const map_type > | map_ |
The Map over which this object is distributed. | |
Kokkos::DualView< packet_type *, buffer_device_type > | imports_ |
Buffer into which packed data are imported (received from other processes). | |
Kokkos::DualView< size_t *, buffer_device_type > | numImportPacketsPerLID_ |
Number of packets to receive for each receive operation. | |
Kokkos::DualView< packet_type *, buffer_device_type > | exports_ |
Buffer from which packed data are exported (sent to other processes). | |
Kokkos::DualView< size_t *, buffer_device_type > | numExportPacketsPerLID_ |
Number of packets to send for each send operation. | |
Sparse matrix whose entries are small dense square blocks, all of the same dimensions.
Scalar | The type of the numerical entries of the matrix. (You can use real-valued or complex-valued types here, unlike in Epetra, where the scalar type is always double .) |
LO | The type of local indices. See the documentation of the first template parameter of Map for requirements. |
GO | The type of global indices. See the documentation of the second template parameter of Map for requirements. |
Node | The Kokkos Node type. See the documentation of the third template parameter of Map for requirements. |
Please read the documentation of BlockMultiVector first.
This class implements a sparse matrix whose entries are small dense square blocks, all of the same dimensions. The intended application is to store the discretization of a partial differential equation with multiple degrees of freedom per mesh point, where all mesh points have the same number of degrees of freedom. This class stores values associated with the degrees of freedom of a single mesh point contiguously, in a getBlockSize() by getBlockSize() block, in row-major format. The matrix's graph represents the mesh points, with one entry per mesh point. This saves storage over using a CrsMatrix, which requires one graph entry per matrix entry.
This class requires a fill-complete Tpetra::CrsGraph for construction. Thus, it has a row Map and a column Map already. As a result, BlockCrsMatrix only needs to provide access using local indices. Access using local indices is faster anyway, since conversion from global to local indices requires a hash table lookup per index. Users are responsible for converting from global to local indices if necessary. Please be aware that the row Map and column Map may differ, so you may not use local row and column indices interchangeably.
We reserve the right to change the block layout in the future. Best practice is to use this class' little_block_type and const_little_block_type typedefs to access blocks, since their types offer access to entries in a layout-independent way. These two typedefs are both Kokkos::View specializations.
Here is an example of how to fill into this object using raw-pointer views.
Definition at line 159 of file Tpetra_BlockCrsMatrix_decl.hpp.
|
protected |
Implementation detail; tells.
Definition at line 170 of file Tpetra_BlockCrsMatrix_decl.hpp.
using Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::scalar_type = Scalar |
The type of entries in the matrix (that is, of each entry in each block).
Definition at line 177 of file Tpetra_BlockCrsMatrix_decl.hpp.
using Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::impl_scalar_type = typename BMV::impl_scalar_type |
The implementation type of entries in the matrix.
Letting scalar_type and impl_scalar_type differ helps this class work correctly for Scalar types like std::complex<T>, which lack the necessary CUDA device macros and volatile overloads to work correctly with Kokkos.
Definition at line 185 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef LO Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::local_ordinal_type |
The type of local indices.
Definition at line 188 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef GO Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::global_ordinal_type |
The type of global indices.
Definition at line 190 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef Node Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::node_type |
The Node type.
Prefer device_type, execution_space, and memory_space (see below), which relate directly to Kokkos.
Definition at line 195 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef Node::device_type Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::device_type |
The Kokkos::Device specialization that this class uses.
Definition at line 198 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef device_type::execution_space Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::execution_space |
The Kokkos execution space that this class uses.
Definition at line 200 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef device_type::memory_space Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::memory_space |
The Kokkos memory space that this class uses.
Definition at line 202 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef ::Tpetra::Map<LO, GO, node_type> Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::map_type |
The implementation of Map that this class uses.
Definition at line 205 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef ::Tpetra::MultiVector<Scalar, LO, GO, node_type> Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::mv_type |
The implementation of MultiVector that this class uses.
Definition at line 207 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef ::Tpetra::CrsGraph<LO, GO, node_type> Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::crs_graph_type |
The implementation of CrsGraph that this class uses.
Definition at line 209 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef Kokkos::View<impl_scalar_type**, Impl::BlockCrsMatrixLittleBlockArrayLayout, device_type, Kokkos::MemoryTraits<Kokkos::Unmanaged> > Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::little_block_type |
The type used to access nonconst matrix blocks.
Definition at line 216 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef Kokkos::View<const impl_scalar_type**, Impl::BlockCrsMatrixLittleBlockArrayLayout, device_type, Kokkos::MemoryTraits<Kokkos::Unmanaged> > Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::const_little_block_type |
The type used to access const matrix blocks.
Definition at line 224 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef BMV::little_vec_type Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::little_vec_type |
The type used to access nonconst vector blocks.
Definition at line 226 of file Tpetra_BlockCrsMatrix_decl.hpp.
typedef BMV::const_little_vec_type Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::const_little_vec_type |
The type used to access const vector blocks.
Definition at line 230 of file Tpetra_BlockCrsMatrix_decl.hpp.
|
protected |
Kokkos::Device specialization for communication buffers.
See #1088 for why this is not just device_type::device_type
.
Definition at line 741 of file Tpetra_BlockCrsMatrix_decl.hpp.
|
inherited |
Type of a norm result.
This is usually the same as the type of the magnitude (absolute value) of Scalar
, but may differ for certain Scalar
types.
Definition at line 117 of file Tpetra_RowMatrix_decl.hpp.
|
protectedinherited |
Kokkos memory space for communication buffers.
Definition at line 754 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 683 of file Tpetra_DistObject_decl.hpp.
Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::BlockCrsMatrix |
Default constructor: Makes an empty block matrix.
Definition at line 656 of file Tpetra_BlockCrsMatrix_def.hpp.
Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::BlockCrsMatrix | ( | const crs_graph_type & | graph, |
const LO | blockSize | ||
) |
Constructor that takes a graph and a block size.
The graph represents the mesh. This constructor computes the point Maps corresponding to the given graph's domain and range Maps. If you already have those point Maps, it is better to call the four-argument constructor.
graph | [in] A fill-complete graph. |
blockSize | [in] Number of degrees of freedom per mesh point. |
KK : additional check is needed that graph is fill complete.
Definition at line 671 of file Tpetra_BlockCrsMatrix_def.hpp.
Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::BlockCrsMatrix | ( | const crs_graph_type & | graph, |
const typename local_matrix_device_type::values_type & | values, | ||
const LO | blockSize | ||
) |
KK : additional check is needed that graph is fill complete.
Definition at line 732 of file Tpetra_BlockCrsMatrix_def.hpp.
Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::BlockCrsMatrix | ( | const crs_graph_type & | graph, |
const map_type & | domainPointMap, | ||
const map_type & | rangePointMap, | ||
const LO | blockSize | ||
) |
Constructor that takes a graph, domain and range point Maps, and a block size.
The graph represents the mesh. This constructor uses the given domain and range point Maps, rather than computing them. The given point Maps must be the same as the above two-argument constructor would have computed.
Definition at line 793 of file Tpetra_BlockCrsMatrix_def.hpp.
|
inlinevirtual |
Destructor (declared virtual for memory safety).
Definition at line 301 of file Tpetra_BlockCrsMatrix_decl.hpp.
|
overridevirtual |
Get the (point) domain Map of this matrix.
Implements Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 855 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Get the (point) range Map of this matrix.
Implements Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 864 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
get the (mesh) map for the rows of this block matrix.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 873 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
get the (mesh) map for the columns of this block matrix.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 881 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
get the global number of block rows
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 889 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
get the local number of block rows
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 897 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Maximum number of entries in any row of the matrix, on this process.
This method only uses the matrix's graph. Explicitly stored zeros count as "entries."
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 905 of file Tpetra_BlockCrsMatrix_def.hpp.
|
override |
For this matrix A, compute Y := beta * Y + alpha * Op(A) * X
.
Op(A) is A if mode is Teuchos::NO_TRANS, the transpose of A if mode is Teuchos::TRANS, and the conjugate transpose of A if mode is Teuchos::CONJ_TRANS.
If alpha is zero, ignore X's entries on input; if beta is zero, ignore Y's entries on input. This follows the BLAS convention, and only matters if X resp. Y have Inf or NaN entries.
Definition at line 913 of file Tpetra_BlockCrsMatrix_def.hpp.
|
inlineoverridevirtual |
Whether it is valid to apply the transpose or conjugate transpose of this matrix.
Reimplemented from Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 345 of file Tpetra_BlockCrsMatrix_decl.hpp.
void Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::setAllToScalar | ( | const Scalar & | alpha | ) |
Set all matrix entries equal to alpha
.
Definition at line 1062 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
One-line description of this object.
Reimplemented from Tpetra::DistObject< char, LO, GO, Node >.
Definition at line 3020 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Print a description of this object to the given output stream.
out | [out] Output stream to which to print. Valid values include Teuchos::VERB_DEFAULT, Teuchos::VERB_NONE, Teuchos::VERB_LOW, Teuchos::VERB_MEDIUM, Teuchos::VERB_HIGH, and Teuchos::VERB_EXTREME. |
verbLevel | [in] Verbosity level at which to print. |
The following pseudocode shows how to wrap your std::ostream object in a Teuchos::FancyOStream, and pass it into this method:
Reimplemented from Tpetra::DistObject< char, LO, GO, Node >.
Definition at line 3043 of file Tpetra_BlockCrsMatrix_def.hpp.
|
inline |
The number of degrees of freedom per mesh point.
Definition at line 393 of file Tpetra_BlockCrsMatrix_decl.hpp.
|
overridevirtual |
Get the (mesh) graph.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3514 of file Tpetra_BlockCrsMatrix_def.hpp.
void Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::applyBlock | ( | const BlockMultiVector< Scalar, LO, GO, Node > & | X, |
BlockMultiVector< Scalar, LO, GO, Node > & | Y, | ||
Teuchos::ETransp | mode = Teuchos::NO_TRANS , |
||
const Scalar | alpha = Teuchos::ScalarTraits<Scalar>::one () , |
||
const Scalar | beta = Teuchos::ScalarTraits<Scalar>::zero () |
||
) |
Version of apply() that takes BlockMultiVector input and output.
This method is deliberately not marked const, because it may do lazy initialization of temporary internal block multivectors.
Definition at line 978 of file Tpetra_BlockCrsMatrix_def.hpp.
void Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::importAndFillComplete | ( | Teuchos::RCP< BlockCrsMatrix< Scalar, LO, GO, Node > > & | destMatrix, |
const Import< LO, GO, Node > & | importer | ||
) | const |
Import from this
to the given destination matrix, and make the result fill complete.
Definition at line 1006 of file Tpetra_BlockCrsMatrix_def.hpp.
void Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::exportAndFillComplete | ( | Teuchos::RCP< BlockCrsMatrix< Scalar, LO, GO, Node > > & | destMatrix, |
const Export< LO, GO, Node > & | exporter | ||
) | const |
Import from this
to the given destination matrix, and make the result fill complete.
Definition at line 1034 of file Tpetra_BlockCrsMatrix_def.hpp.
LO Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::replaceLocalValues | ( | const LO | localRowInd, |
const LO | colInds[], | ||
const Scalar | vals[], | ||
const LO | numColInds | ||
) | const |
Replace values at the given (mesh, i.e., block) column indices, in the given (mesh, i.e., block) row.
localRowInd | [in] Local mesh (i.e., block) index of the row in which to replace. |
colInds | [in] Local mesh (i.e., block) column ind{ex,ices} at which to replace values. colInds [k] is the local column index whose new values start at vals[getBlockSize() * getBlockSize() * k] , and colInds has length at least numColInds . This method will only access the first numColInds entries of colInds . |
vals | [in] The new values to use at the given column indices. Values for each block are stored contiguously, in row major layout, with no padding between rows or between blocks. Thus, if b = getBlockSize() , then vals[k*b*b] .. vals[(k+1)*b*b-1] are the values to use for block colInds [k]. |
numColInds | [in] The number of entries of colInds . |
colInds
. colInds
[k] is valid if and only if it is a valid local mesh (i.e., block) column index. This method succeeded if and only if the return value equals the input argument numColInds
. Definition at line 1071 of file Tpetra_BlockCrsMatrix_def.hpp.
LO Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::sumIntoLocalValues | ( | const LO | localRowInd, |
const LO | colInds[], | ||
const Scalar | vals[], | ||
const LO | numColInds | ||
) | const |
Sum into values at the given (mesh, i.e., block) column indices, in the given (mesh, i.e., block) row.
localRowInd | [in] Local mesh (i.e., block) index of the row in which to sum. |
colInds | [in] Local mesh (i.e., block) column ind{ex,ices} at which to sum. colInds [k] is the local column index whose new values start at vals[getBlockSize() * getBlockSize() * k] , and colInds has length at least numColInds . This method will only access the first numColInds entries of colInds . |
vals | [in] The new values to sum in at the given column indices. Values for each block are stored contiguously, in row major layout, with no padding between rows or between blocks. Thus, if b = getBlockSize() , then vals[k*b*b] .. vals[(k+1)*b*b-1] are the values to use for block colInds [k]. |
numColInds | [in] The number of entries of colInds . |
colInds
. colInds
[k] is valid if and only if it is a valid local mesh (i.e., block) column index. This method succeeded if and only if the return value equals the input argument numColInds
. Definition at line 1150 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Get a view of the (mesh, i.e., block) row, using local (mesh, i.e., block) indices.
This matrix has a graph, and we assume that the graph is fill complete on input to the matrix's constructor. Thus, the matrix has a column Map, and it stores column indices as local indices. This means you can view the column indices as local indices directly. However, you may not view them as global indices directly, since the column indices are not stored as global indices in the graph.
localRowInd | [in] Local (mesh, i.e., block) row index. |
colInds | [out] If localRowInd is valid on the calling process, then on output, this is a pointer to the local (mesh, i.e., block) column indices in the given (mesh, i.e., block) row. If localRowInd is not valid, then this is undefined. (Please check the return value of this method.) |
vals | [out] If localRowInd is valid on the calling process, then on output, this is a pointer to the row's values. If localRowInd is not valid, then this is undefined. (Please check the return value of this method.) |
numInds | [in] The number of (mesh, i.e., block) indices in colInds on output. |
localRowInd
is valid, else Teuchos::OrdinalTraits<LO>::invalid()
. KK: this is inherited from row matrix interface and it returns const this cannot replace the deprecated pointer interface we need nonconst version of this code Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3414 of file Tpetra_BlockCrsMatrix_def.hpp.
void Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::getLocalRowViewNonConst | ( | LO | LocalRow, |
local_inds_host_view_type & | indices, | ||
nonconst_values_host_view_type & | values | ||
) | const |
KK: this is new addition to replace getLocalRowVie with pointers and arrayviews we can change name if it is not prefrred
Definition at line 3434 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Not implemented.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 1165 of file Tpetra_BlockCrsMatrix_def.hpp.
LO Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::getLocalRowOffsets | ( | const LO | localRowInd, |
ptrdiff_t | offsets[], | ||
const LO | colInds[], | ||
const LO | numColInds | ||
) | const |
Get relative offsets corresponding to the given rows, given by local row index.
The point of this method is to precompute the results of searching for the offsets corresponding to the given column indices. You may then reuse these search results in replaceLocalValuesByOffsets or sumIntoLocalValuesByOffsets.
Offsets are block offsets; they are for column indices, not for values.
localRowInd | [in] Local index of the row. |
offsets | [out] On output: relative offsets corresponding to the given column indices. Must have at least numColInds entries. |
colInds | [in] The local column indices for which to compute offsets. Must have at least numColInds entries. This method will only read the first numColsInds entries. |
numColInds | [in] Number of entries in colInds to read. |
Definition at line 1190 of file Tpetra_BlockCrsMatrix_def.hpp.
LO Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::replaceLocalValuesByOffsets | ( | const LO | localRowInd, |
const ptrdiff_t | offsets[], | ||
const Scalar | vals[], | ||
const LO | numOffsets | ||
) | const |
Like replaceLocalValues, but avoids computing row offsets.
Definition at line 1223 of file Tpetra_BlockCrsMatrix_def.hpp.
LO Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::sumIntoLocalValuesByOffsets | ( | const LO | localRowInd, |
const ptrdiff_t | offsets[], | ||
const Scalar | vals[], | ||
const LO | numOffsets | ||
) | const |
Like sumIntoLocalValues, but avoids computing row offsets.
Definition at line 1298 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Return the number of entries in the given row on the calling process.
If the given local row index is invalid, this method (sensibly) returns zero, since the calling process trivially does not own any entries in that row.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 1418 of file Tpetra_BlockCrsMatrix_def.hpp.
BlockCrsMatrix< Scalar, LO, GO, Node >::local_matrix_device_type Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::getLocalMatrixDevice |
Get KokkosSparce::Experimental::BsrMatrix representation of this BlockCrsMatrix
Definition at line 1431 of file Tpetra_BlockCrsMatrix_def.hpp.
|
inline |
Whether this object had an error on the calling process.
Import and Export operations using this object as the target of the Import or Export may incur local errors, if some process encounters an LID in its list which is not a valid mesh row local index on that process. In that case, we don't want to throw an exception, because not all processes may throw an exception; this can result in deadlock or put Tpetra in an incorrect state, due to lack of consistency across processes. Instead, we set a local error flag and ignore the incorrect data. When unpacking, we do the same with invalid column indices. If you want to check whether some process experienced an error, you must do a reduction or all-reduce over this flag. Every time you initiate a new Import or Export with this object as the target, we clear this flag. (Note to developers: we clear it at the beginning of checkSizes().)
Definition at line 632 of file Tpetra_BlockCrsMatrix_decl.hpp.
|
inline |
The current stream of error messages.
This is only nonempty on the calling process if localError() returns true. In that case, it stores a stream of human-readable, endline-separated error messages encountered during an Import or Export cycle. Every time you initiate a new Import or Export with this object as the target, we clear this stream. (Note to developers: we clear it at the beginning of checkSizes().)
If you want to print this, you are responsible for ensuring that it is valid for the calling MPI process to print to whatever output stream you use. On some MPI implementations, you may need to send the string to Process 0 for printing.
Definition at line 650 of file Tpetra_BlockCrsMatrix_decl.hpp.
void Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::getLocalDiagOffsets | ( | const Kokkos::View< size_t *, device_type, Kokkos::MemoryUnmanaged > & | offsets | ) | const |
Get offsets of the diagonal entries in the matrix.
offsets.extent(0) == getLocalNumRows()
This method creates an array of offsets of the local diagonal entries in the matrix. This array is suitable for use in the two-argument version of getLocalDiagCopy(). However, its contents are not defined in any other context. For example, you should not rely on offsets(i)
being the index of the diagonal entry in the views returned by 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.)
If the matrix has a const ("static") graph, and if that graph is fill complete, then the offsets array remains valid through calls to fillComplete() and resumeFill(). "Invalidates" means that you must call this method again to recompute the offsets.
Definition at line 1087 of file Tpetra_BlockCrsMatrix_def.hpp.
void Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::getLocalDiagCopy | ( | const Kokkos::View< impl_scalar_type ***, device_type, Kokkos::MemoryUnmanaged > & | diag, |
const Kokkos::View< const size_t *, device_type, Kokkos::MemoryUnmanaged > & | offsets | ||
) | const |
Variant of getLocalDiagCopy() that uses precomputed offsets and puts diagonal blocks in a 3-D Kokkos::View.
diag | [out] On input: Must be preallocated, with dimensions at least (number of diagonal blocks on the calling process) x getBlockSize() x getBlockSize(). On output: the diagonal blocks. Leftmost index is "which block," then the row index within a block, then the column index within a block. |
This method uses the offsets of the diagonal entries, as precomputed by getLocalDiagOffsets(), to speed up copying the diagonal of the matrix.
Definition at line 1096 of file Tpetra_BlockCrsMatrix_def.hpp.
|
protected |
Variant of getLocalDiagCopy() that uses precomputed offsets and puts diagonal blocks in a 3-D Kokkos::View.
diag | [out] On input: Must be preallocated, with dimensions at least (number of diagonal blocks on the calling process) x getBlockSize() x getBlockSize(). On output: the diagonal blocks. Leftmost index is "which block," then the row index within a block, then the column index within a block. |
This method uses the offsets of the diagonal entries, as precomputed by getLocalDiagOffsets(), to speed up copying the diagonal of the matrix. Like sumIntoLocalValues, but for the ABSMAX combine mode.
Definition at line 1133 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overrideprotectedvirtual |
Check input valid
Definition at line 1790 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overrideprotectedvirtual |
Check input valid
Definition at line 2418 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overrideprotectedvirtual |
Check input valid
Definition at line 2674 of file Tpetra_BlockCrsMatrix_def.hpp.
BlockCrsMatrix< Scalar, LO, GO, Node >::impl_scalar_type_dualview::t_host Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::getValuesHostNonConst |
Get the host or device View of the matrix's values (val_
).
MemorySpace | Memory space for which to get the Kokkos::View. |
This is not const, because we reserve the right to do lazy allocation on device / "fast" memory. Host / "slow" memory allocations generally are not lazy; that way, the host fill interface always works in a thread-parallel context without needing to synchronize on the allocation.
CT: While we reserved the "right" we ignored this and explicitly did const cast away Hence I made the non-templated functions [getValuesHost and getValuesDevice; see above] const. KK: This should be deprecated.
Definition at line 1355 of file Tpetra_BlockCrsMatrix_def.hpp.
BlockCrsMatrix< Scalar, LO, GO, Node >::impl_scalar_type_dualview::t_host::const_type Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::getValuesHost | ( | const LO & | lclRow | ) | const |
Get a const Host view of the locally owned values.
Definition at line 1373 of file Tpetra_BlockCrsMatrix_def.hpp.
BlockCrsMatrix< Scalar, LO, GO, Node >::impl_scalar_type_dualview::t_dev::const_type Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::getValuesDevice | ( | const LO & | lclRow | ) | const |
Get a const Device view of the locally owned values.
Definition at line 1385 of file Tpetra_BlockCrsMatrix_def.hpp.
BlockCrsMatrix< Scalar, LO, GO, Node >::impl_scalar_type_dualview::t_host Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::getValuesHostNonConst | ( | const LO & | lclRow | ) |
Get a non-const Host view of the locally owned values.
Definition at line 1396 of file Tpetra_BlockCrsMatrix_def.hpp.
BlockCrsMatrix< Scalar, LO, GO, Node >::impl_scalar_type_dualview::t_dev Tpetra::BlockCrsMatrix< Scalar, LO, GO, Node >::getValuesDeviceNonConst | ( | const LO & | lclRow | ) |
Get a non-const Device view of the locally owned values.
Definition at line 1407 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
The communicator over which this matrix is distributed.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3279 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
The global number of columns of this matrix.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3288 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
The number of columns needed to apply the forward operator on this node.
This is the same as the number of elements listed in the column Map. It is not necessarily the same as the number of domain Map elements owned by the calling process.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3297 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
The index base for global indices in this matrix.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3305 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
The global number of stored (structurally nonzero) entries.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3313 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
The local number of stored (structurally nonzero) entries.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3321 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
The current number of entries on the calling process in the specified global row.
Note that if the row Map is overlapping, then the calling process might not necessarily store all the entries in the row. Some other process might have the rest of the entries.
Teuchos::OrdinalTraits<size_t>::invalid()
if the specified global row does not belong to this graph, else the number of entries. Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3329 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
The maximum number of entries in any row over all processes in the matrix's communicator.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3338 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Whether this matrix has a well-defined column Map.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3346 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Whether matrix indices are locally indexed.
A RowMatrix may store column indices either as global indices (of type GO
), or as local indices (of type LO
). In some cases (for example, if the column Map has not been computed), it is not possible to switch from global to local indices without extra work. Furthermore, some operations only work for one or the other case.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3355 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Whether matrix indices are globally indexed.
A RowMatrix may store column indices either as global indices (of type GO
), or as local indices (of type LO
). In some cases (for example, if the column Map has not been computed), it is not possible to switch from global to local indices without extra work. Furthermore, some operations only work for one or the other case.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3363 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Whether fillComplete() has been called.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3371 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Whether this object implements getLocalRowView() and getGlobalRowView().
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3379 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Get a copy of the given global row's entries.
This method only gets the entries in the given row that are stored on the calling process. Note that if the matrix has an overlapping row Map, it is possible that the calling process does not store all the entries in that row.
GlobalRow | [in] Global index of the row. |
Indices | [out] Global indices of the columns corresponding to values. |
Values | [out] Matrix values. |
NumEntries | [out] Number of stored entries on the calling process; length of Indices and Values. |
This method throws std::runtime_error
if either Indices or Values is not large enough to hold the data associated with row GlobalRow. If GlobalRow does not belong to the calling process, then the method sets NumIndices to Teuchos::OrdinalTraits<size_t>::invalid()
, and does not modify Indices or Values.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3387 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Get a constant, nonpersisting, globally indexed view of the given row of the matrix.
The returned views of the column indices and values are not guaranteed to persist beyond the lifetime of this
. Furthermore, some RowMatrix implementations allow changing the values, or the indices and values. Any such changes invalidate the returned views.
This method only gets the entries in the given row that are stored on the calling process. Note that if the matrix has an overlapping row Map, it is possible that the calling process does not store all the entries in that row.
isGloballyIndexed () && supportsRowViews ()
indices.size () == getNumEntriesInGlobalRow (GlobalRow)
GlobalRow | [in] Global index of the row. |
Indices | [out] Global indices of the columns corresponding to values. |
Values | [out] Matrix values. |
If GlobalRow
does not belong to this node, then indices
is set to null
.
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3401 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Get a copy of the diagonal entries, distributed by the row Map.
On input, the Vector's Map must be the same as the row Map of the matrix. (That is, this->getRowMap ()->isSameAs (* (diag.getMap ())) == true
.)
On return, the entries of diag
are filled with the diagonal entries of the matrix stored on this process. Note that if the row Map is overlapping, multiple processes may own the same diagonal element. You may combine these overlapping diagonal elements by doing an Export from the row Map Vector to a range Map Vector.
Definition at line 3455 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Scale the RowMatrix on the left with the given Vector x.
On return, for all entries i,j in the matrix,
Definition at line 3492 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
Scale the RowMatrix on the right with the given Vector x.
On return, for all entries i,j in the matrix,
Definition at line 3503 of file Tpetra_BlockCrsMatrix_def.hpp.
|
overridevirtual |
The Frobenius norm of the matrix.
This method computes and returns the Frobenius norm of the matrix. The Frobenius norm
Implements Tpetra::RowMatrix< Scalar, LO, GO, Node >.
Definition at line 3522 of file Tpetra_BlockCrsMatrix_def.hpp.
|
pure virtualinherited |
Get a copy of the diagonal entries, distributed by the row Map.
On input, the Vector's Map must be the same as the row Map of the matrix. (That is, this->getRowMap ()->isSameAs (* (diag.getMap ())) == true
.)
On return, the entries of diag
are filled with the diagonal entries of the matrix stored on this process. Note that if the row Map is overlapping, multiple processes may own the same diagonal element. You may combine these overlapping diagonal elements by doing an Export from the row Map Vector to a range Map Vector.
|
virtualinherited |
Get the diagonal of the operator.
By default, this throws. Subclasses must override this method if they can supply a diagonal.
Reimplemented in Tpetra::CrsMatrix< ::Tpetra::Details::DefaultTypes::scalar_type, ::Tpetra::Details::DefaultTypes::local_ordinal_type, ::Tpetra::Details::DefaultTypes::global_ordinal_type, ::Tpetra::Details::DefaultTypes::node_type >, Tpetra::CrsMatrix< SC, LO, GO, NT >, Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >, and Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >.
Definition at line 161 of file Tpetra_Operator.hpp.
|
pure virtualinherited |
Scale the matrix on the left with the given Vector.
On return, for all entries i,j in the matrix,
|
pure virtualinherited |
Scale the matrix on the right with the given Vector.
On return, for all entries i,j in the matrix,
|
virtualinherited |
Return a new RowMatrix which is the result of beta*this + alpha*A
.
The new RowMatrix is actually a CrsMatrix (which see). Note that RowMatrix is a read-only interface (not counting the left and right scale methods), so it is impossible to implement an in-place add using just that interface.
For brevity, call this matrix B, and the result matrix C. C's row Map will be identical to B's row Map. It is correct, though less efficient, for A and B not to have the same row Maps. We could make C's row Map the union of the two row Maps in that case. However, we don't want row Maps to grow for a repeated sequence of additions with matrices with different row Maps. Furthermore, the fact that the user called this method on B, rather than on A, suggests a preference for using B's distribution. The most reasonable thing to do, then, is to use B's row Map for C.
A and B must have identical or congruent communicators. This method must be called as a collective over B's communicator.
The parameters are optional and may be null. Here are the parameters that this function accepts:
bool
): If true, call fillComplete on the result matrix C. This is true
by default.It is not strictly necessary that a RowMatrix always have a domain and range Map. For example, a CrsMatrix does not have a domain and range Map until after its first fillComplete call. Neither A nor B need to have a domain and range Map in order to call add(). If at least one of them has a domain and range Map, you need not supply a domain and range Map to this method. If you ask this method to call fillComplete on C (it does by default), it will supply the any missing domain or range Maps from either B's or A's (in that order) domain and range Maps. If neither A nor B have a domain and range Map, and if you ask this method to call fillComplete, then you must supply both a domain Map and a range Map to this method.
This method comes with a default implementation, since the RowMatrix interface suffices for implementing it. Subclasses (like CrsMatrix) may override this implementation, for example to improve its performance, given additional knowledge about the subclass. Subclass implementations may need to do a dynamic cast on A in order to know its type.
Definition at line 480 of file Tpetra_RowMatrix_def.hpp.
|
virtualinherited |
Pack this object's data for an Import or Export.
Subclasses may override this method to speed up or otherwise improve the implementation by exploiting more specific details of the subclass.
Definition at line 525 of file Tpetra_RowMatrix_def.hpp.
|
pure virtualinherited |
Pack the object's data for an Import or Export.
exportLIDs | [in] List of the local indices of the entries which the source object will send out. |
exports | [out] On exit, the buffer packed with data to send. This object may resize the array if necessary. |
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, zero if numPacketsPerLID has variable contents (different size for each local index). If nonzero, then it is expected that the number of packets per local index is constant, and that constantNumPackets is that value. |
Implemented in Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >, Tpetra::CrsGraph< LO, GO, node_type >, Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >, and Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node >.
|
pure virtualinherited |
Computes the operator-multivector application.
Loosely, performs alpha
and beta
. Specifically
beta == 0
, apply() must overwrite Y
, so that any values in Y
(including NaNs) are ignored.alpha == 0
, apply() may short-circuit the operator, so that any values in X
(including NaNs) are ignored. Implemented in Tpetra::CrsMatrix< ::Tpetra::Details::DefaultTypes::scalar_type, ::Tpetra::Details::DefaultTypes::local_ordinal_type, ::Tpetra::Details::DefaultTypes::global_ordinal_type, ::Tpetra::Details::DefaultTypes::node_type >, Tpetra::CrsMatrix< SC, LO, GO, NT >, Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >, Tpetra::CrsMatrixMultiplyOp< Scalar, MatScalar, LocalOrdinal, GlobalOrdinal, Node >, Tpetra::MixedScalarMultiplyOp< Scalar, OpScalar, LocalOrdinal, GlobalOrdinal, Node >, and Tpetra::details::ApplyOp< Scalar, OperatorType >.
|
virtualinherited |
Whether this operator can return its diagonal.
By default, this returns false. Subclasses must override this method if they can supply a diagonal.
Definition at line 156 of file Tpetra_Operator.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.
"Restricted Mode" does two things:
*this
, in a "locallyFitted" sense. This cannot be used if (2) is not true, OR there are permutes. The "source" maps still need to match.
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 413 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.
"Restricted Mode" does two things:
*this
, in a "locallyFitted" sense. This cannot be used if (2) is not true, OR there are permutes. The "source" maps still need to match.
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 480 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.
"Restricted Mode" does two things:
*this
, in a "locallyFitted" sense. This cannot be used if (2) is not true, OR there are permutes. The "source" maps still need to match.
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 446 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.
"Restricted Mode" does two things:
*this
, in a "locallyFitted" sense. This cannot be used if (2) is not true, OR there are permutes. The "source" maps still need to match.
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 514 of file Tpetra_DistObject_def.hpp.
|
inherited |
Whether the data from an import/export operation has arrived, and is ready for the unpack and combine step.
Definition at line 569 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 580 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 588 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 598 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 670 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 704 of file Tpetra_DistObject_def.hpp.
|
protectedvirtualinherited |
Redistribute data across (MPI) processes.
src | [in] The source object, to redistribute into the target object, which is *this object. |
transfer | [in] The Export or Import object representing the communication pattern. (Details::Transfer is the common base class of these two objects.) |
modeString | [in] Human-readable string, for verbose debugging output and error output, explaining what function called this method. Example: "doImport (forward)", "doExport (reverse)". |
revOp | [in] Whether to do a forward or reverse mode redistribution. |
CM | [in] The combine mode that describes how to combine values that map to the same global ID on the same process. |
Definition at line 726 of file Tpetra_DistObject_def.hpp.
|
protectedvirtualinherited |
Reallocate numExportPacketsPerLID_ and/or numImportPacketsPerLID_, if necessary.
numExportLIDs | [in] Number of entries in the exportLIDs input array argument of doTransfer(). |
numImportLIDs | [in] Number of entries in the remoteLIDs input array argument of doTransfer(). |
Definition at line 748 of file Tpetra_DistObject_def.hpp.
|
protectedinherited |
Implementation detail of doTransfer.
LID DualViews come from the Transfer object given to doTransfer. They are always sync'd on both host and device. Users must never attempt to modify or sync them.
Definition at line 777 of file Tpetra_DistObject_def.hpp.
|
protectedpure virtualinherited |
Compare the source and target (this) objects for compatibility.
|
protectedvirtualinherited |
Perform copies and permutations that are local to the calling (MPI) process.
Subclasses must reimplement this function. Its default implementation does nothing. Note that the <t>target object of the Export or Import, namely *this
, packs the source object's data.
permuteToLIDs.need_sync_host()
, permuteToLIDs.need_sync_device()
, permuteFromLIDs.need_sync_host()
, and permuteFromLIDs.need_sync_device()
are all false.source | [in] On entry, the source object of the Export or Import operation. |
numSameIDs | [in] The number of elements that are the same on the source and target objects. These elements live on the same process in both the source and target objects. |
permuteToLIDs | [in] List of the elements that are permuted. They are listed by their local index (LID) in the destination object. |
permuteFromLIDs | [in] List of the elements that are permuted. They are listed by their local index (LID) in the source object. |
CM | [in] CombineMode to be used during copyAndPermute; may or may not be used by the particular object being called; behavior with respect to CombineMode may differ by object. |
Definition at line 854 of file Tpetra_DistObject_def.hpp.
|
protectedvirtualinherited |
Pack data and metadata for communication (sends).
Subclasses must reimplement this function. Its default implementation does nothing. Note that the <t>target object of the Export or Import, namely *this
, packs the source object's data.
exportLIDs.need_sync_host ()
and exportLIDs.need_sync_device()
are both false.source | [in] Source object for the redistribution. |
exportLIDs | [in] List of the entries (as local IDs in the source object) that Tpetra will send to other processes. |
exports | [out] On exit, the packed data to send. Implementations must reallocate this as needed (prefer reusing the existing allocation if possible), and may modify and/or sync this wherever they like. |
numPacketsPerLID | [out] On exit, the implementation of this method must do one of two things: either set numPacketsPerLID[i] to the number of packets to be packed for exportLIDs[i] and set constantNumPackets to zero, or set constantNumPackets to a nonzero value. If the latter, the implementation must not modify the entries of numPacketsPerLID . If the former, the implementation may sync numPacketsPerLID this wherever it likes, either to host or to device. The allocation belongs to DistObject, not to subclasses; don't be tempted to change this to pass by reference. |
constantNumPackets | [out] On exit, 0 if the number of packets per LID could differ, else (if nonzero) the number of packets per LID (which must be constant). |
Definition at line 900 of file Tpetra_DistObject_def.hpp.
|
protectedvirtualinherited |
Perform any unpacking and combining after communication.
Subclasses must reimplement this function. Its default implementation does nothing. Note that the <t>target object of the Export or Import, namely *this
, unpacks the received data into itself, possibly modifying its entries.
importLIDs.need_sync_host ()
and importLIDs.need_sync_device()
are both false.importLIDs | [in] List of the entries (as LIDs in the destination object) we received from other processes. |
imports | [in/out] On input: Buffer of received data to unpack. DistObject promises nothing about where this is sync'd. Implementations may sync this wherever they like, either to host or to device. The allocation belongs to DistObject, not to subclasses; don't be tempted to change this to pass by reference. |
numPacketsPerLID | [in/out] On input: If constantNumPackets is zero, then numPacketsPerLID[i] contains the number of packets imported for importLIDs[i]. DistObject promises nothing about where this is sync'd. Implementations may sync this wherever they like, either to host or to device. The allocation belongs to DistObject, not to subclasses; don't be tempted to change this to pass by reference. |
constantNumPackets | [in] If nonzero, then the number of packets per LID is the same for all entries ("constant") and constantNumPackets is that number. If zero, then numPacketsPerLID[i] is the number of packets to unpack for LID importLIDs[i] . |
combineMode | [in] The CombineMode to use when combining the imported entries with existing entries. |
Definition at line 949 of file Tpetra_DistObject_def.hpp.
|
protectedvirtualinherited |
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_. |
verbose | [in] Whether to print verbose debugging output to stderr on every (MPI) process in the communicator. |
prefix | [in] If verbose is true , then this is a nonnull prefix to print at the beginning of each line of verbose debugging output. Otherwise, not used. |
We don't need a "reallocExportsIfNeeded" method, because exports_
always gets passed into packAndPrepare() by nonconst reference. Thus, that method can resize the DualView without needing to call other DistObject methods.
Definition at line 994 of file Tpetra_DistObject_def.hpp.
|
protectedinherited |
The Map over which this object is distributed.
Definition at line 960 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 973 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 1013 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 1020 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 1035 of file Tpetra_DistObject_decl.hpp.