template<typename RequestType, typename AnswerType>
class Utilities::MPI::ConsensusAlgorithms::PEX< RequestType, AnswerType >
This class implements a concrete algorithm for the ConsensusAlgorithms::Interface base class, using a two step approach. In the first step the source ranks are determined and in the second step a static sparse data exchange is performed. This algorithm is most suitable for relatively small process counts – say, less than 100.
- Note
- In contrast to NBX, this class splits the same task into two distinct steps. In the first step, all processes are identified who want to send a request to this process. In the second step, the data is exchanged. However, since - in the second step - now it is clear how many requests have to be answered, i.e. when this process can stop waiting for requests, no IBarrier is needed.
-
Under the hood, this function uses Utilities::MPI::compute_point_to_point_communication_pattern() to determine the source processes, which itself is based on the NBX-algorithm from [119] that is implemented in the ConsensusAlgorithms::NBX class (a sister class to the current one).
- Template Parameters
-
RequestType | The type of the elements of the vector to be sent. |
AnswerType | The type of the elements of the vector to be received. |
Definition at line 566 of file mpi_consensus_algorithms.h.
template<typename RequestType , typename AnswerType >
virtual std::vector< unsigned int > Utilities::MPI::ConsensusAlgorithms::PEX< RequestType, AnswerType >::run |
( |
const std::vector< unsigned int > & |
targets, |
|
|
const std::function< RequestType(const unsigned int)> & |
create_request, |
|
|
const std::function< AnswerType(const unsigned int, const RequestType &)> & |
answer_request, |
|
|
const std::function< void(const unsigned int, const AnswerType &)> & |
process_answer, |
|
|
const MPI_Comm |
comm |
|
) |
| |
|
overridevirtual |
Run the consensus algorithm and return a vector of process ranks that have requested answers from the current process.
This version of the run() function simply unpacks the functions packaged in process
and calls the version of the run() function that takes a number of std::function
arguments.
- Deprecated:
- Instead of deriving a class from the Process base class and providing a corresponding object to this function, use the other run() function in this class that takes function objects as arguments.
Implements Utilities::MPI::ConsensusAlgorithms::Interface< RequestType, AnswerType >.