Tpetra parallel linear algebra
Version of the Day
|
Interface for breaking ties in ownership. More...
#include <Tpetra_TieBreak.hpp>
Classes | |
struct | Triplet |
Representation of a global index on a process. More... | |
Public Member Functions | |
virtual bool | mayHaveSideEffects () const |
Whether selectedIndex() may have side effects. More... | |
virtual | ~TieBreak ()=default |
Virtual destructor (for memory safety of derived classes). More... | |
virtual std::size_t | selectedIndex (GlobalOrdinal GID, const std::vector< std::pair< int, LocalOrdinal > > &pid_and_lid) const =0 |
Break any ties in ownership of the given global index GID. More... | |
Interface for breaking ties in ownership.
LocalOrdinal | The type of local indices. |
GlobalOrdinal | The type of global indices. |
This class provides an abstract interface to a way for Directory to "break ties" in ownership of global indices. To "break a tie" for a global index GID means: Given a set of one or more (PID, LID) pairs, where each PID is a process that owns GID and LID is the corresponding local index of GID, choose exactly one (PID, LID) pair from that set. Furthermore, this choice must be a global choice, that is, the same on all participating processes.
Definition at line 38 of file Tpetra_TieBreak.hpp.
|
virtualdefault |
Virtual destructor (for memory safety of derived classes).
|
inlinevirtual |
Whether selectedIndex() may have side effects.
If you are defining your own implementation (i.e., subclass) of this class, and if you know that your implementation of selectedIndex() does not have side effects, then you may redefine this method to return false. This may skip using the TieBreak object in certain cases, to save local work. Otherwise, we must use the TieBreak object in case the implementation has desired side effects.
Definition at line 68 of file Tpetra_TieBreak.hpp.
|
pure virtual |
Break any ties in ownership of the given global index GID.
Given a global index GID, and a set of (PID, LID) pairs (of processes that own GID, and the local index of GID on that process), return the index of one pair in the list.
This method must always be called collectively over all the processes in the Directory's communicator. Subclasses reserve the right to use communication (either point-to-point or collective) over that communicator, but are not required to do so. However, their decisions are required to be consistent over those processes. This means that if multiple processes call this method with the same GID and the same list of pairs, all these processes must return the same index. (It would also be a good idea for subclasses not to be sensitive to the order of pairs.)
FIXME (mfh 17 Sep 2013) I'm not a fan of the name of this method. We should call it something more indicative of its function, like "arbitrateOwnership" or "breakTie".