Reference documentation for deal.II version Git 840703ecf3 2019-10-14 17:15:20 -0400
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
Public Member Functions | Public Attributes | Private Member Functions | List of all members
Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload Class Reference

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

Inheritance diagram for Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload:
[legend]

Public Member Functions

 ConsensusAlgorithmPayload (const IndexSet &owned_indices, const IndexSet &indices_to_look_up, const MPI_Comm &comm, std::vector< unsigned int > &owning_ranks, const bool track_index_requests=false)
 
virtual void process_request (const unsigned int other_rank, const std::vector< std::pair< types::global_dof_index, types::global_dof_index >> &buffer_recv, std::vector< unsigned int > &request_buffer) override
 
virtual std::vector< unsigned int > compute_targets () override
 
virtual void pack_recv_buffer (const int other_rank, std::vector< std::pair< types::global_dof_index, types::global_dof_index >> &send_buffer) override
 
virtual void prepare_recv_buffer (const int other_rank, std::vector< unsigned int > &recv_buffer) override
 
virtual void unpack_recv_buffer (const int other_rank, const std::vector< unsigned int > &recv_buffer) override
 
std::map< unsigned int, IndexSetget_requesters ()
 
- Public Member Functions inherited from Utilities::MPI::ConsensusAlgorithmProcess< std::pair< types::global_dof_index, types::global_dof_index >, unsigned int >
virtual ~ConsensusAlgorithmProcess ()=default
 
virtual void pack_recv_buffer (const int other_rank, std::vector< std::pair< types::global_dof_index, types::global_dof_index > > &send_buffer)
 
virtual void process_request (const unsigned int other_rank, const std::vector< std::pair< types::global_dof_index, types::global_dof_index > > &buffer_recv, std::vector< unsigned int > &request_buffer)
 

Public Attributes

const IndexSetowned_indices
 
const IndexSetindices_to_look_up
 
const MPI_Comm comm
 
const unsigned int my_rank
 
const unsigned int n_procs
 
const bool track_index_requests
 
std::vector< unsigned int > & owning_ranks
 
std::vector< std::vector< std::pair< unsigned int, std::vector< std::pair< unsigned int, unsigned int > > > > > requesters
 
Dictionary dict
 
std::map< unsigned int, std::vector< types::global_dof_index > > indices_to_look_up_by_dict_rank
 
std::map< unsigned int, std::vector< unsigned int > > recv_indices
 

Private Member Functions

void append_index_origin (const types::global_dof_index index, unsigned int &owner_index, const unsigned int rank_of_request)
 

Detailed Description

Specialization of ConsensusAlgorithmProcess for the context of Utilities::MPI::compute_index_owner() and Utilities::MPI::Partitioner::set_ghost_indices() with additional payload.

Definition at line 374 of file mpi_compute_index_owner_internal.h.

Constructor & Destructor Documentation

◆ ConsensusAlgorithmPayload()

Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::ConsensusAlgorithmPayload ( const IndexSet owned_indices,
const IndexSet indices_to_look_up,
const MPI_Comm &  comm,
std::vector< unsigned int > &  owning_ranks,
const bool  track_index_requests = false 
)
inline

Constructor.

Definition at line 383 of file mpi_compute_index_owner_internal.h.

Member Function Documentation

◆ process_request()

virtual void Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::process_request ( const unsigned int  other_rank,
const std::vector< std::pair< types::global_dof_index, types::global_dof_index >> &  buffer_recv,
std::vector< unsigned int > &  request_buffer 
)
inlineoverridevirtual

Implementation of Utilities::MPI::ConsensusAlgorithmProcess::process_request(), adding the owner of a particular index in request_buffer (and keeping track of who requested a particular index in case that information is also desired).

Definition at line 481 of file mpi_compute_index_owner_internal.h.

◆ compute_targets()

virtual std::vector<unsigned int> Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::compute_targets ( )
inlineoverridevirtual

◆ pack_recv_buffer()

virtual void Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::pack_recv_buffer ( const int  other_rank,
std::vector< std::pair< types::global_dof_index, types::global_dof_index >> &  send_buffer 
)
inlineoverridevirtual

◆ prepare_recv_buffer()

virtual void Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::prepare_recv_buffer ( const int  other_rank,
std::vector< unsigned int > &  recv_buffer 
)
inlineoverridevirtual

◆ unpack_recv_buffer()

virtual void Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::unpack_recv_buffer ( const int  other_rank,
const std::vector< unsigned int > &  recv_buffer 
)
inlineoverridevirtual

◆ get_requesters()

std::map<unsigned int, IndexSet> Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::get_requesters ( )
inline

Resolve the origin of the requests by sending the information accumulated in terms of the dictionary owners during the run of the consensus algorithm back to the owner in the original IndexSet. This requires some point-to-point communication.

Returns
Map of processors and associated ranges of indices that are requested from the current rank

Definition at line 618 of file mpi_compute_index_owner_internal.h.

◆ append_index_origin()

void Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::append_index_origin ( const types::global_dof_index  index,
unsigned int &  owner_index,
const unsigned int  rank_of_request 
)
inlineprivate

Stores the index request in the requesters field. We first find out the owner of the index that was requested (using the guess in owner_index, as we typically might look up on the same rank several times in a row, which avoids the binary search in Dictionary::get_owning_rank_index(). Once we know the rank of the owner, we the vector entry with the rank of the request. Here, we utilize the fact that requests are processed rank-by-rank, so we can simply look at the end of the vector if there is already some data stored or not. Finally, we build ranges, again using that the index list is sorted and we therefore only need to append at the end.

Definition at line 782 of file mpi_compute_index_owner_internal.h.

Member Data Documentation

◆ owned_indices

const IndexSet& Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::owned_indices

The index space which describes the locally owned space.

Definition at line 403 of file mpi_compute_index_owner_internal.h.

◆ indices_to_look_up

const IndexSet& Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::indices_to_look_up

The indices which are "ghosts" on a given rank and should be looked up in terms of their owner rank from owned_indices.

Definition at line 409 of file mpi_compute_index_owner_internal.h.

◆ comm

const MPI_Comm Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::comm

The underlying MPI communicator.

Definition at line 414 of file mpi_compute_index_owner_internal.h.

◆ my_rank

const unsigned int Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::my_rank

The present MPI rank.

Definition at line 419 of file mpi_compute_index_owner_internal.h.

◆ n_procs

const unsigned int Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::n_procs

The total number of ranks participating in the MPI communicator comm.

Definition at line 425 of file mpi_compute_index_owner_internal.h.

◆ track_index_requests

const bool Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::track_index_requests

Controls whether the origin of ghost owner should also be stored. If true, it will be added into requesters and can be queried by get_requesters().

Definition at line 432 of file mpi_compute_index_owner_internal.h.

◆ owning_ranks

std::vector<unsigned int>& Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::owning_ranks

The result of the index owner computation: To each index contained in indices_to_look_up, this vector contains the MPI rank of the owner in owned_indices.

Definition at line 439 of file mpi_compute_index_owner_internal.h.

◆ requesters

std::vector<std::vector< std::pair<unsigned int, std::vector<std::pair<unsigned int, unsigned int> > > > > Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::requesters

Keeps track of the origin of the requests. The layout of the data structure is as follows: The outermost vector has as many entries as Dictionary::actually_owning_rank_list and represents the information we should send back to the owners from the present dictionary entry. The second vector then collects a list of MPI ranks that have requested data, using the rank in the first pair entry and a list of index ranges as the second entry.

Definition at line 453 of file mpi_compute_index_owner_internal.h.

◆ dict

Dictionary Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::dict

The dictionary handling the requests.

Definition at line 458 of file mpi_compute_index_owner_internal.h.

◆ indices_to_look_up_by_dict_rank

std::map<unsigned int, std::vector<types::global_dof_index> > Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::indices_to_look_up_by_dict_rank

Array to collect the indices to look up, sorted by the rank in the dictionary.

Definition at line 465 of file mpi_compute_index_owner_internal.h.

◆ recv_indices

std::map<unsigned int, std::vector<unsigned int> > Utilities::MPI::internal::ComputeIndexOwner::ConsensusAlgorithmPayload::recv_indices

The field where the indices for incoming data from the process are stored.

Definition at line 471 of file mpi_compute_index_owner_internal.h.


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