Reference documentation for deal.II version 9.2.0
|
#include <deal.II/base/mpi_noncontiguous_partitioner.h>
Public Member Functions | |
NoncontiguousPartitioner ()=default | |
NoncontiguousPartitioner (const IndexSet &indexset_locally_owned, const IndexSet &indexset_ghost, const MPI_Comm &communicator) | |
NoncontiguousPartitioner (const std::vector< types::global_dof_index > &indices_locally_owned, const std::vector< types::global_dof_index > &indices_ghost, const MPI_Comm &communicator) | |
template<typename Number > | |
void | export_to_ghosted_array (const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array) const |
template<typename Number > | |
void | export_to_ghosted_array (const unsigned int communication_channel, const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &temporary_storage, const ArrayView< Number > &ghost_array, std::vector< MPI_Request > &requests) const |
template<typename Number > | |
void | export_to_ghosted_array_start (const unsigned int communication_channel, const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &temporary_storage, std::vector< MPI_Request > &requests) const |
template<typename Number > | |
void | export_to_ghosted_array_finish (const ArrayView< const Number > &temporary_storage, const ArrayView< Number > &ghost_array, std::vector< MPI_Request > &requests) const |
std::pair< unsigned int, unsigned int > | n_targets () |
types::global_dof_index | memory_consumption () |
const MPI_Comm & | get_mpi_communicator () const override |
void | reinit (const IndexSet &indexset_locally_owned, const IndexSet &indexset_ghost, const MPI_Comm &communicator) override |
void | reinit (const std::vector< types::global_dof_index > &indices_locally_owned, const std::vector< types::global_dof_index > &indices_ghost, const MPI_Comm &communicator) |
Public Member Functions inherited from LinearAlgebra::CommunicationPatternBase | |
virtual | ~CommunicationPatternBase ()=default |
Private Attributes | |
MPI_Comm | communicator |
std::vector< unsigned int > | send_ranks |
std::vector< types::global_dof_index > | send_ptr |
std::vector< types::global_dof_index > | send_indices |
std::vector< unsigned int > | recv_ranks |
std::vector< types::global_dof_index > | recv_ptr |
std::vector< types::global_dof_index > | recv_indices |
std::vector< uint8_t > | buffers |
std::vector< MPI_Request > | requests |
A flexible Partitioner class, which does not impose restrictions regarding the order of the underlying index sets.
Definition at line 41 of file mpi_noncontiguous_partitioner.h.
|
default |
Default constructor. Requires calling one of the reinit() functions to create a valid object.
Utilities::MPI::NoncontiguousPartitioner::NoncontiguousPartitioner | ( | const IndexSet & | indexset_locally_owned, |
const IndexSet & | indexset_ghost, | ||
const MPI_Comm & | communicator | ||
) |
Constructor. Set up point-to-point communication pattern based on the IndexSets arguments indexset_locally_owned
and indexset_ghost
for the MPI communicator communicator
.
Utilities::MPI::NoncontiguousPartitioner::NoncontiguousPartitioner | ( | const std::vector< types::global_dof_index > & | indices_locally_owned, |
const std::vector< types::global_dof_index > & | indices_ghost, | ||
const MPI_Comm & | communicator | ||
) |
Constructor. Same as above but for vectors of indices indices_locally_owned
and indices_ghost
. This allows the indices to not be sorted and the values are read and written automatically at the right position of the vector during update_values(), update_values_start(), and update_values_finish(). It is allowed to include entries with the value numbers::invalid_dof_index which do not take part of the index exchange but are present in the data vectors as padding.
void Utilities::MPI::NoncontiguousPartitioner::export_to_ghosted_array | ( | const ArrayView< const Number > & | locally_owned_array, |
const ArrayView< Number > & | ghost_array | ||
) | const |
Fill the vector ghost_array
according to the precomputed communication pattern with values from locally_owned_array
.
void Utilities::MPI::NoncontiguousPartitioner::export_to_ghosted_array | ( | const unsigned int | communication_channel, |
const ArrayView< const Number > & | locally_owned_array, | ||
const ArrayView< Number > & | temporary_storage, | ||
const ArrayView< Number > & | ghost_array, | ||
std::vector< MPI_Request > & | requests | ||
) | const |
Same as above but with an interface similar to Utilities::MPI::Partitioner::export_to_ghosted_array_start and Utilities::MPI::Partitioner::export_to_ghosted_array_finish. In this function, the user can provide the temporary data structures to be used.
temporary_storage
vector has to be at least as large as the sum of the number of entries in the index sets passed to the constructor and the reinit() functions. The reason for this is that this vector is used as buffer for both sending and receiving data. void Utilities::MPI::NoncontiguousPartitioner::export_to_ghosted_array_start | ( | const unsigned int | communication_channel, |
const ArrayView< const Number > & | locally_owned_array, | ||
const ArrayView< Number > & | temporary_storage, | ||
std::vector< MPI_Request > & | requests | ||
) | const |
Start update: Data is packed, non-blocking send and receives are started.
temporary_storage
. This allows for padding and other post-processing of the received data.void Utilities::MPI::NoncontiguousPartitioner::export_to_ghosted_array_finish | ( | const ArrayView< const Number > & | temporary_storage, |
const ArrayView< Number > & | ghost_array, | ||
std::vector< MPI_Request > & | requests | ||
) | const |
Finish update. The method waits until all data has been sent and received. Once data from any process is received it is processed and placed at the right position of the vector dst
.
temporary_storage
, since the data has been received into the buffer and not into the destination vector.Returns the number of processes this process sends data to and the number of processes this process receives data from.
types::global_dof_index Utilities::MPI::NoncontiguousPartitioner::memory_consumption | ( | ) |
Return memory consumption in Byte.
|
overridevirtual |
Return the underlying communicator.
Implements LinearAlgebra::CommunicationPatternBase.
|
overridevirtual |
Initialize the inner data structures.
Implements LinearAlgebra::CommunicationPatternBase.
void Utilities::MPI::NoncontiguousPartitioner::reinit | ( | const std::vector< types::global_dof_index > & | indices_locally_owned, |
const std::vector< types::global_dof_index > & | indices_ghost, | ||
const MPI_Comm & | communicator | ||
) |
Initialize the inner data structures.
|
private |
MPI communicator.
Definition at line 199 of file mpi_noncontiguous_partitioner.h.
|
private |
The ranks this process sends data to.
Definition at line 204 of file mpi_noncontiguous_partitioner.h.
|
private |
Offset of each process within send_buffer.
send_indices
this forms a CRS data structure. Definition at line 211 of file mpi_noncontiguous_partitioner.h.
|
private |
Local index of each entry in send_buffer within the destination vector.
send_ptr
this forms a CRS data structure. Definition at line 219 of file mpi_noncontiguous_partitioner.h.
|
private |
The ranks this process receives data from.
Definition at line 224 of file mpi_noncontiguous_partitioner.h.
|
private |
Offset of each process within recv_buffer.
recv_indices
this forms a CRS data structure. Definition at line 231 of file mpi_noncontiguous_partitioner.h.
|
private |
Local index of each entry in recv_buffer within the destination vector.
recv_ptr
this forms a CRS data structure. Definition at line 239 of file mpi_noncontiguous_partitioner.h.
|
mutableprivate |
Buffer containing the values sorted by rank for sending and receiving.
Definition at line 250 of file mpi_noncontiguous_partitioner.h.
|
mutableprivate |
MPI requests for sending and receiving.
Definition at line 257 of file mpi_noncontiguous_partitioner.h.