Reference documentation for deal.II version 9.3.3
|
#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 () const |
unsigned int | temporary_storage_size () const |
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) |
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 39 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
.
Definition at line 29 of file mpi_noncontiguous_partitioner.cc.
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.
Definition at line 39 of file mpi_noncontiguous_partitioner.cc.
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 temporary_storage_size. The reason for this is that this vector is used as buffer for both sending and receiving data.communication_channel
. 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.communication_channel
. 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.std::pair< unsigned int, unsigned int > Utilities::MPI::NoncontiguousPartitioner::n_targets | ( | ) | const |
Returns the number of processes this process sends data to and the number of processes this process receives data from.
Definition at line 50 of file mpi_noncontiguous_partitioner.cc.
unsigned int Utilities::MPI::NoncontiguousPartitioner::temporary_storage_size | ( | ) | const |
Return the size of the temporary storage needed by the export_to_ghosted_array() functions, if the temporary storage is handled by the user code.
Definition at line 58 of file mpi_noncontiguous_partitioner.cc.
types::global_dof_index Utilities::MPI::NoncontiguousPartitioner::memory_consumption | ( | ) |
Return memory consumption in Byte.
Definition at line 66 of file mpi_noncontiguous_partitioner.cc.
|
overridevirtual |
Return the underlying communicator.
Implements Utilities::MPI::CommunicationPatternBase.
Definition at line 81 of file mpi_noncontiguous_partitioner.cc.
|
overridevirtual |
Initialize the inner data structures.
Implements Utilities::MPI::CommunicationPatternBase.
Definition at line 89 of file mpi_noncontiguous_partitioner.cc.
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.
Definition at line 165 of file mpi_noncontiguous_partitioner.cc.
|
private |
MPI communicator.
Definition at line 209 of file mpi_noncontiguous_partitioner.h.
|
private |
The ranks this process sends data to.
Definition at line 214 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 221 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 229 of file mpi_noncontiguous_partitioner.h.
|
private |
The ranks this process receives data from.
Definition at line 234 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 241 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 249 of file mpi_noncontiguous_partitioner.h.
|
mutableprivate |
Buffer containing the values sorted by rank for sending and receiving.
Definition at line 260 of file mpi_noncontiguous_partitioner.h.
|
mutableprivate |
MPI requests for sending and receiving.
Definition at line 267 of file mpi_noncontiguous_partitioner.h.