Reference documentation for deal.II version 9.3.3
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 > Class Template Reference

#include <deal.II/base/mpi_consensus_algorithms.h>

Inheritance diagram for Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >:
[legend]

Public Member Functions

 PEX (Process< T1, T2 > &process, const MPI_Comm &comm)
 
virtual ~PEX ()=default
 
virtual std::vector< unsigned intrun () override
 

Protected Attributes

Process< T1, T2 > & process
 
const MPI_Commcomm
 
const bool job_supports_mpi
 
const unsigned int my_rank
 
const unsigned int n_procs
 

Private Member Functions

void answer_requests (int index)
 
unsigned int start_communication ()
 
void clean_up_and_end_communication ()
 

Private Attributes

std::vector< unsigned inttargets
 
std::vector< unsigned intsources
 
std::vector< std::vector< T1 > > send_buffers
 
std::vector< std::vector< T2 > > recv_buffers
 
std::vector< MPI_Request > send_and_recv_buffers
 
std::vector< std::vector< T2 > > requests_buffers
 
std::vector< MPI_Request > requests_answers
 
std::set< unsigned intrequesting_processes
 

Detailed Description

template<typename T1, typename T2>
class Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >

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.

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.
The function Utilities::MPI::compute_point_to_point_communication_pattern() is used to determine the source processes, which implements a PEX-algorithm from [65].
Template Parameters
T1The type of the elements of the vector to be sent.
T2The type of the elements of the vector to be received.

Definition at line 359 of file mpi_consensus_algorithms.h.

Constructor & Destructor Documentation

◆ PEX()

template<typename T1 , typename T2 >
Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::PEX ( Process< T1, T2 > &  process,
const MPI_Comm comm 
)

Constructor.

Parameters
processProcess to be run during consensus algorithm.
commMPI Communicator

◆ ~PEX()

template<typename T1 , typename T2 >
virtual Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::~PEX ( )
virtualdefault

Destructor.

Member Function Documentation

◆ run()

template<typename T1 , typename T2 >
virtual std::vector< unsigned int > Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::run ( )
overridevirtual

Run consensus algorithm and return the requesting processes.

Implements Utilities::MPI::ConsensusAlgorithms::Interface< T1, T2 >.

◆ answer_requests()

template<typename T1 , typename T2 >
void Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::answer_requests ( int  index)
private

The ith request message from another rank has been received: process the request and send an answer.

◆ start_communication()

template<typename T1 , typename T2 >
unsigned int Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::start_communication ( )
private

Start to send all requests via ISend and post IRecvs for the incoming answer messages.

◆ clean_up_and_end_communication()

template<typename T1 , typename T2 >
void Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::clean_up_and_end_communication ( )
private

After all answers have been exchanged, the MPI data structures can be freed and the received answers can be processed.

Member Data Documentation

◆ targets

template<typename T1 , typename T2 >
std::vector<unsigned int> Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::targets
private

List of ranks of processes this processes wants to send a request to.

Definition at line 386 of file mpi_consensus_algorithms.h.

◆ sources

template<typename T1 , typename T2 >
std::vector<unsigned int> Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::sources
private

List of ranks of processes wanting to send a request to this process.

Definition at line 391 of file mpi_consensus_algorithms.h.

◆ send_buffers

template<typename T1 , typename T2 >
std::vector<std::vector<T1> > Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::send_buffers
private

Buffers for sending requests.

Definition at line 398 of file mpi_consensus_algorithms.h.

◆ recv_buffers

template<typename T1 , typename T2 >
std::vector<std::vector<T2> > Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::recv_buffers
private

Buffers for receiving answers to requests.

Definition at line 403 of file mpi_consensus_algorithms.h.

◆ send_and_recv_buffers

template<typename T1 , typename T2 >
std::vector<MPI_Request> Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::send_and_recv_buffers
private

Requests for sending requests and receiving answers to requests.

Definition at line 408 of file mpi_consensus_algorithms.h.

◆ requests_buffers

template<typename T1 , typename T2 >
std::vector<std::vector<T2> > Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::requests_buffers
private

Buffers for sending answers to requests.

Definition at line 413 of file mpi_consensus_algorithms.h.

◆ requests_answers

template<typename T1 , typename T2 >
std::vector<MPI_Request> Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::requests_answers
private

Requests for sending answers to requests.

Definition at line 418 of file mpi_consensus_algorithms.h.

◆ requesting_processes

template<typename T1 , typename T2 >
std::set<unsigned int> Utilities::MPI::ConsensusAlgorithms::PEX< T1, T2 >::requesting_processes
private

List of processes who have made a request to this process.

Definition at line 423 of file mpi_consensus_algorithms.h.

◆ process

template<typename T1 , typename T2 >
Process<T1, T2>& Utilities::MPI::ConsensusAlgorithms::Interface< T1, T2 >::process
protectedinherited

Reference to the process provided by the user.

Definition at line 186 of file mpi_consensus_algorithms.h.

◆ comm

template<typename T1 , typename T2 >
const MPI_Comm& Utilities::MPI::ConsensusAlgorithms::Interface< T1, T2 >::comm
protectedinherited

MPI communicator.

Definition at line 191 of file mpi_consensus_algorithms.h.

◆ job_supports_mpi

template<typename T1 , typename T2 >
const bool Utilities::MPI::ConsensusAlgorithms::Interface< T1, T2 >::job_supports_mpi
protectedinherited

Cache if job supports MPI.

Definition at line 196 of file mpi_consensus_algorithms.h.

◆ my_rank

template<typename T1 , typename T2 >
const unsigned int Utilities::MPI::ConsensusAlgorithms::Interface< T1, T2 >::my_rank
protectedinherited

Rank of this process.

Definition at line 201 of file mpi_consensus_algorithms.h.

◆ n_procs

template<typename T1 , typename T2 >
const unsigned int Utilities::MPI::ConsensusAlgorithms::Interface< T1, T2 >::n_procs
protectedinherited

Number of processes in the communicator.

Definition at line 206 of file mpi_consensus_algorithms.h.


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