Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Protected Member Functions | List of all members
Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node > Class Template Reference

Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distribution. More...

#include <Tpetra_Export_decl.hpp>

Inheritance diagram for Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >:
Inheritance graph
[legend]

Public Types

typedef ::Tpetra::Map
< LocalOrdinal, GlobalOrdinal,
Node > 
map_type
 The specialization of Map used by this class. More...
 

Public Member Functions

Constructor/Destructor Methods
 Export (const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target)
 Construct a Export object from the source and target Map. More...
 
 Export (const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target, const Teuchos::RCP< Teuchos::FancyOStream > &out)
 Construct an Export from the source and target Maps, with an output stream for debugging output. More...
 
 Export (const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target, const Teuchos::RCP< Teuchos::ParameterList > &plist)
 Constructor (with list of parameters) More...
 
 Export (const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target, const Teuchos::RCP< Teuchos::FancyOStream > &out, const Teuchos::RCP< Teuchos::ParameterList > &plist)
 Constructor (with list of parameters and debugging output stream) More...
 
 Export (const Export< LocalOrdinal, GlobalOrdinal, Node > &rhs)
 Copy constructor. More...
 
 Export (const Import< LocalOrdinal, GlobalOrdinal, Node > &importer)
 "Copy" constructor from an Export object. More...
 
virtual ~Export ()
 Destructor. More...
 
void setParameterList (const Teuchos::RCP< Teuchos::ParameterList > &plist)
 Set parameters. More...
 
Export Attribute Methods
size_t getNumSameIDs () const
 Number of initial identical IDs. More...
 
size_t getNumPermuteIDs () const
 Number of IDs to permute but not to communicate. More...
 
Teuchos::ArrayView< const
LocalOrdinal > 
getPermuteFromLIDs () const
 List of local IDs in the source Map that are permuted. More...
 
Teuchos::ArrayView< const
LocalOrdinal > 
getPermuteToLIDs () const
 List of local IDs in the target Map that are permuted. More...
 
size_t getNumRemoteIDs () const
 Number of entries not on the calling process. More...
 
Teuchos::ArrayView< const
LocalOrdinal > 
getRemoteLIDs () const
 List of entries in the target Map to receive from other processes. More...
 
size_t getNumExportIDs () const
 Number of entries that must be sent by the calling process to other processes. More...
 
Teuchos::ArrayView< const
LocalOrdinal > 
getExportLIDs () const
 List of entries in the source Map that will be sent to other processes. More...
 
Teuchos::ArrayView< const int > getExportPIDs () const
 List of processes to which entries will be sent. More...
 
Teuchos::RCP< const map_typegetSourceMap () const
 The source Map used to construct this Export. More...
 
Teuchos::RCP< const map_typegetTargetMap () const
 The target Map used to construct this Export. More...
 
DistributorgetDistributor () const
 The Distributor that this Export object uses to move data. More...
 
bool isLocallyComplete () const
 Do all source Map indices on the calling process exist on at least one process (not necessarily this one) in the target Map? More...
 
Export< LocalOrdinal,
GlobalOrdinal, Node > & 
operator= (const Export< LocalOrdinal, GlobalOrdinal, Node > &rhs)
 Assignment operator. More...
 
I/O Methods
virtual void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
 Describe this object in a human-readable way to the given output stream. More...
 
virtual void print (std::ostream &os) const
 Print the Export's data to the given output stream. More...
 

Protected Member Functions

void describeImpl (Teuchos::FancyOStream &out, const std::string &className, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
 Implementation of describe() for subclasses (Tpetra::Import and Tpetra::Export). More...
 

Detailed Description

template<class LocalOrdinal = ::Tpetra::Details::DefaultTypes::local_ordinal_type, class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type, class Node = ::Tpetra::Details::DefaultTypes::node_type>
class Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >

Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distribution.

Template Parameters
LocalOrdinalThe type of local indices. See the documentation of Map for requirements.
GlobalOrdinalThe type of global indices. See the documentation of Map for requirements.
NodeThe Kokkos Node type. See the documentation of Map for requirements.

Tpetra users should use this class to construct a communication plan between two data distributions (i.e., two Map objects). The plan can be called repeatedly by computational classes to perform communication according to the same pattern. Constructing the plan may be expensive, both in terms of communication and computation. However, it can be reused inexpensively.

Tpetra has two classes for data redistribution: Import and Export. Import is for redistributing data from a uniquely-owned distribution to a possibly multiply-owned distribution. Export is for redistributing data from a possibly multiply-owned distribution to a uniquely-owned distribution.

The names "Import" and "Export" have nothing to do with the direction in which data moves relative to the calling process; any process may do both receives and sends in an Import or Export. Rather, the names suggest what happens in their most common use case, the communication pattern for sparse matrix-vector multiply. Import "brings in" remote source vector data (from the domain Map to the column Map) for local computation, and Export "pushes" the result back (from the row Map to the range Map). Import and Export have other uses as well.

One use case of Export is finite element assembly. For example, one way to compute a distributed forcing term vector is to use an overlapping distribution for the basis functions' domains. An Export with the SUM combine mode combines each process' contribution to the integration into a single nonoverlapping distribution.

Epetra separated Import and Export for performance reasons. The implementation is different, depending on which direction is the uniquely-owned Map. Tpetra retains this convention.

This class is templated on the same template arguments as Map: the local ordinal type LocalOrdinal, the global ordinal type GlobalOrdinal, and the Kokkos Node type.

This method accepts an optional list of parameters, either through the constructor or through the setParameterList() method. Most users do not need to worry about these parameters; the default values are fine. However, for expert users, we expose the following parameter:

Definition at line 124 of file Tpetra_Export_decl.hpp.

Member Typedef Documentation

template<class LocalOrdinal = ::Tpetra::Details::DefaultTypes::local_ordinal_type, class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type, class Node = ::Tpetra::Details::DefaultTypes::node_type>
typedef ::Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::map_type

The specialization of Map used by this class.

Definition at line 131 of file Tpetra_Export_decl.hpp.

Constructor & Destructor Documentation

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::Export ( const Teuchos::RCP< const map_type > &  source,
const Teuchos::RCP< const map_type > &  target 
)

Construct a Export object from the source and target Map.

Parameters
source[in] The source distribution. This may be a multiply owned (overlapping) distribution.
target[in] The target distribution. This must be a uniquely owned (nonoverlapping) distribution.

Definition at line 79 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::Export ( const Teuchos::RCP< const map_type > &  source,
const Teuchos::RCP< const map_type > &  target,
const Teuchos::RCP< Teuchos::FancyOStream > &  out 
)

Construct an Export from the source and target Maps, with an output stream for debugging output.

Parameters
source[in] The source distribution. This may be a multiply owned (overlapping) distribution.
target[in] The target distribution. This must be a uniquely owned (nonoverlapping) distribution.
out[in/out] Output stream for debugging output.

Definition at line 123 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::Export ( const Teuchos::RCP< const map_type > &  source,
const Teuchos::RCP< const map_type > &  target,
const Teuchos::RCP< Teuchos::ParameterList > &  plist 
)

Constructor (with list of parameters)

Parameters
source[in] The source distribution. This may be a multiply owned (overlapping) distribution.
target[in] The target distribution. This must be a uniquely owned (nonoverlapping) distribution.
plist[in/out] List of parameters. Currently passed directly to the Distributor that implements communication. If you don't know what this should be, you should use the two-argument constructor, listed above.

Definition at line 168 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::Export ( const Teuchos::RCP< const map_type > &  source,
const Teuchos::RCP< const map_type > &  target,
const Teuchos::RCP< Teuchos::FancyOStream > &  out,
const Teuchos::RCP< Teuchos::ParameterList > &  plist 
)

Constructor (with list of parameters and debugging output stream)

Parameters
source[in] The source distribution. This may be a multiply owned (overlapping) distribution.
target[in] The target distribution. This must be a uniquely owned (nonoverlapping) distribution.
out[in/out] Output stream for debugging output.
plist[in/out] List of parameters. Currently passed directly to the Distributor that implements communication. If you don't know what this should be, you should use the two-argument constructor, listed above.

Definition at line 222 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::Export ( const Export< LocalOrdinal, GlobalOrdinal, Node > &  rhs)

Copy constructor.

Note
Currently this only makes a shallow copy of the Export's underlying data.

Definition at line 277 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::Export ( const Import< LocalOrdinal, GlobalOrdinal, Node > &  importer)

"Copy" constructor from an Export object.

This constructor creates an Export object from the "reverse" of the given Import object. This method is mainly useful for Tpetra developers, for example when building the explicit transpose of a sparse matrix.

Definition at line 300 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::~Export ( )
virtual

Destructor.

Definition at line 308 of file Tpetra_Export_def.hpp.

Member Function Documentation

template<class LocalOrdinal , class GlobalOrdinal , class Node >
void Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::setParameterList ( const Teuchos::RCP< Teuchos::ParameterList > &  plist)

Set parameters.

Please see the class documentation for a list of all accepted parameters and their default values.

Definition at line 65 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
size_t Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getNumSameIDs ( ) const
virtual

Number of initial identical IDs.

The number of IDs that are identical between the source and target Maps, up to the first different ID.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 312 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
size_t Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getNumPermuteIDs ( ) const
virtual

Number of IDs to permute but not to communicate.

The number of IDs that are local to the calling process, but not part of the first getNumSameIDs() entries. The Import will permute these entries locally (without distributed-memory communication).

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 317 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::ArrayView< const LocalOrdinal > Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getPermuteFromLIDs ( ) const
virtual

List of local IDs in the source Map that are permuted.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 323 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::ArrayView< const LocalOrdinal > Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getPermuteToLIDs ( ) const
virtual

List of local IDs in the target Map that are permuted.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 329 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
size_t Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getNumRemoteIDs ( ) const
virtual

Number of entries not on the calling process.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 334 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::ArrayView< const LocalOrdinal > Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getRemoteLIDs ( ) const
virtual

List of entries in the target Map to receive from other processes.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 340 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
size_t Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getNumExportIDs ( ) const
virtual

Number of entries that must be sent by the calling process to other processes.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 345 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::ArrayView< const LocalOrdinal > Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getExportLIDs ( ) const
virtual

List of entries in the source Map that will be sent to other processes.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 351 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::ArrayView< const int > Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getExportPIDs ( ) const
virtual

List of processes to which entries will be sent.

The entry with local ID getExportLIDs()[i] will be sent to process getExportPiDs()[i].

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 357 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const typename Export< LocalOrdinal, GlobalOrdinal, Node >::map_type > Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getSourceMap ( ) const
virtual

The source Map used to construct this Export.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 363 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const typename Export< LocalOrdinal, GlobalOrdinal, Node >::map_type > Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getTargetMap ( ) const
virtual

The target Map used to construct this Export.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 369 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Distributor & Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::getDistributor ( ) const
virtual

The Distributor that this Export object uses to move data.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 375 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
bool Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::isLocallyComplete ( ) const
virtual

Do all source Map indices on the calling process exist on at least one process (not necessarily this one) in the target Map?

It's not necessarily an error for an Export not to be locally complete on one or more processes. Nevertheless, you may find this predicate useful for figuring out whether you set up your Maps in the way that you expect.

Implements Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 381 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Export< LocalOrdinal, GlobalOrdinal, Node > & Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::operator= ( const Export< LocalOrdinal, GlobalOrdinal, Node > &  rhs)

Assignment operator.

Definition at line 388 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
void Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::describe ( Teuchos::FancyOStream &  out,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) const
virtual

Describe this object in a human-readable way to the given output stream.

You must call this method as a collective over all processes in the communicator of the source and target Map of this object.

Parameters
out[out] Output stream to which to write. Only Process 0 in this object's communicator may write to the output stream.
verbLevel[in] Verbosity level. This also controls whether this method does any communication. At verbosity levels higher (greater) than Teuchos::VERB_LOW, this method behaves as a collective over the object's communicator.

Teuchos::FancyOStream wraps std::ostream. It adds features like tab levels. If you just want to wrap std::cout, try this:

auto out = Teuchos::getFancyOStream (Teuchos::rcpFromRef (std::out));

Reimplemented from Tpetra::Details::Classes::Transfer< LO, GO, NT >.

Definition at line 398 of file Tpetra_Export_def.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
void Tpetra::Classes::Export< LocalOrdinal, GlobalOrdinal, Node >::print ( std::ostream &  os) const
virtual

Print the Export's data to the given output stream.

This method assumes that the given output stream can be written on all process(es) in the Export's communicator. The resulting output is useful mainly for debugging.

Note
This method tries its best (by using barriers at the end of each iteration of a for loop over all communicator ranks) to ensure ordered deterministic output. However, the assumption that all processes can write to the stream means that there are no ordering guarantees other than what the operating and run-time system provide. (MPI synchronization may be separate from output stream synchronization, so the barriers only improve the chances that output can complete before the next process starts writing.)

Definition at line 407 of file Tpetra_Export_def.hpp.

template<class LO , class GO , class NT >
void Tpetra::Details::Classes::Transfer< LO, GO, NT >::describeImpl ( Teuchos::FancyOStream &  out,
const std::string &  className,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) const
protectedinherited

Implementation of describe() for subclasses (Tpetra::Import and Tpetra::Export).

Parameters
out[out] Output stream to which to write. Only Process 0 in this object's communicator may write to the output stream.
className[in] Name of the subclass of Transfer calling this method.
verbLevel[in] Verbosity level. This also controls whether this method does any communication. At verbosity levels higher (greater) than Teuchos::VERB_LOW, this method behaves as a collective over the object's communicator.

Definition at line 68 of file Tpetra_Details_Transfer_def.hpp.


The documentation for this class was generated from the following files: