Reference documentation for deal.II version 9.2.0
\(\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 | Private Member Functions | Private Attributes | List of all members
Utilities::MPI::ConsensusAlgorithms::NBX< T1, T2 > Class Template Reference

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

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

Public Member Functions

 NBX (Process< T1, T2 > &process, const MPI_Comm &comm)
 
virtual ~NBX ()=default
 
virtual void run () override
 
- Public Member Functions inherited from Utilities::MPI::ConsensusAlgorithms::Interface< T1, T2 >
 Interface (Process< T1, T2 > &process, const MPI_Comm &comm)
 
virtual ~Interface ()=default
 

Private Member Functions

bool check_own_state ()
 
void signal_finish ()
 
bool check_global_state ()
 
void answer_requests ()
 
void start_communication ()
 
void clean_up_and_end_communication ()
 

Private Attributes

std::vector< unsigned inttargets
 
std::vector< std::vector< T1 > > send_buffers
 
std::vector< MPI_Requestsend_requests
 
std::vector< std::vector< T2 > > recv_buffers
 
std::vector< MPI_Requestrecv_requests
 
std::vector< std::unique_ptr< std::vector< T2 > > > request_buffers
 
std::vector< std::unique_ptr< MPI_Request > > request_requests
 
MPI_Request barrier_request
 
std::set< unsigned intrequesting_processes
 

Additional Inherited Members

- Protected Attributes inherited from Utilities::MPI::ConsensusAlgorithms::Interface< T1, T2 >
Process< T1, T2 > & process
 
const MPI_Commcomm
 
const unsigned int my_rank
 
const unsigned int n_procs
 

Detailed Description

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

This class implements a concrete algorithm for the ConsensusAlgorithms::Interface base class, using only point-to-point communications and a single IBarrier.

Note
This class closely follows the paper Hoefler, Siebert, Lumsdaine "Scalable Communication Protocols for Dynamic Sparse Data Exchange". Since the algorithm shown there is not considering payloads, the algorithm has been modified here in such a way that synchronous sends (Issend) have been replaced by equivalent Isend/Irecv, where Irecv receives the answer to a request (with payload).
Template Parameters
T1The type of the elements of the vector to be sent.
T2The type of the elements of the vector to be received.
Author
Peter Munch, 2019

Definition at line 228 of file mpi_consensus_algorithms.h.

Constructor & Destructor Documentation

◆ NBX()

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

Constructor.

Parameters
processProcess to be run during consensus algorithm.
commMPI Communicator

◆ ~NBX()

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

Destructor.

Member Function Documentation

◆ run()

template<typename T1 , typename T2 >
virtual void Utilities::MPI::ConsensusAlgorithms::NBX< T1, T2 >::run ( )
overridevirtual

Run consensus algorithm.

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

◆ check_own_state()

template<typename T1 , typename T2 >
bool Utilities::MPI::ConsensusAlgorithms::NBX< T1, T2 >::check_own_state ( )
private

Check if all request answers have been received by this rank.

◆ signal_finish()

template<typename T1 , typename T2 >
void Utilities::MPI::ConsensusAlgorithms::NBX< T1, T2 >::signal_finish ( )
private

Signal to all other ranks that this rank has received all request answers via entering IBarrier.

◆ check_global_state()

template<typename T1 , typename T2 >
bool Utilities::MPI::ConsensusAlgorithms::NBX< T1, T2 >::check_global_state ( )
private

Check if all ranks have received all their request answers, i.e. all ranks have reached the IBarrier.

◆ answer_requests()

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

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

◆ start_communication()

template<typename T1 , typename T2 >
void Utilities::MPI::ConsensusAlgorithms::NBX< 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::NBX< T1, T2 >::clean_up_and_end_communication ( )
private

After all rank has received all answers, 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::NBX< T1, T2 >::targets
private

List of processes this process wants to send requests to.

Definition at line 255 of file mpi_consensus_algorithms.h.

◆ send_buffers

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

Buffers for sending requests.

Definition at line 260 of file mpi_consensus_algorithms.h.

◆ send_requests

template<typename T1 , typename T2 >
std::vector<MPI_Request> Utilities::MPI::ConsensusAlgorithms::NBX< T1, T2 >::send_requests
private

Requests for sending requests.

Definition at line 265 of file mpi_consensus_algorithms.h.

◆ recv_buffers

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

Buffers for receiving answers to requests.

Definition at line 270 of file mpi_consensus_algorithms.h.

◆ recv_requests

template<typename T1 , typename T2 >
std::vector<MPI_Request> Utilities::MPI::ConsensusAlgorithms::NBX< T1, T2 >::recv_requests
private

Requests for receiving answers to requests.

Definition at line 276 of file mpi_consensus_algorithms.h.

◆ request_buffers

template<typename T1 , typename T2 >
std::vector<std::unique_ptr<std::vector<T2> > > Utilities::MPI::ConsensusAlgorithms::NBX< T1, T2 >::request_buffers
private

Buffers for sending answers to requests.

Definition at line 281 of file mpi_consensus_algorithms.h.

◆ request_requests

template<typename T1 , typename T2 >
std::vector<std::unique_ptr<MPI_Request> > Utilities::MPI::ConsensusAlgorithms::NBX< T1, T2 >::request_requests
private

Requests for sending answers to requests.

Definition at line 286 of file mpi_consensus_algorithms.h.

◆ barrier_request

template<typename T1 , typename T2 >
MPI_Request Utilities::MPI::ConsensusAlgorithms::NBX< T1, T2 >::barrier_request
private

Definition at line 289 of file mpi_consensus_algorithms.h.

◆ requesting_processes

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

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

Definition at line 296 of file mpi_consensus_algorithms.h.


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