Discontinuous Galerkin Library
#include "dg/algorithm.h"
|
Perform general gather and its transpose (scatter) operation across processes on distributed vectors using mpi. More...
Public Member Functions | |
GeneralComm ()=default | |
no memory allocation; size 0 More... | |
GeneralComm (unsigned local_size, const thrust::host_vector< int > &localIndexMap, const thrust::host_vector< int > &pidIndexMap, MPI_Comm comm) | |
Construct from local indices and PIDs index map. More... | |
template<class ConversionPolicy > | |
GeneralComm (const thrust::host_vector< int > &globalIndexMap, const ConversionPolicy &p) | |
Construct from global indices index map. More... | |
template<class OtherIndex , class OtherVector > | |
GeneralComm (const GeneralComm< OtherIndex, OtherVector > &src) | |
reconstruct from another type; if src is empty, same as default constructor More... | |
const thrust::host_vector< int > & | getLocalIndexMap () const |
read access to the local index index map given in constructor More... | |
const thrust::host_vector< int > & | getPidIndexMap () const |
read access to the pid index map given in constructor More... | |
virtual GeneralComm * | clone () const override final |
Generic copy method. More... | |
Public Member Functions inherited from dg::aCommunicator< Vector > | |
Vector | allocate_buffer () const |
Allocate a buffer object of size buffer_size() More... | |
void | global_gather (const value_type *values, Vector &buffer) const |
\( w = G v\). Globally (across processes) gather data into a buffer More... | |
Vector | global_gather (const value_type *values) const |
\( w = G v\). Globally (across processes) gather data into a buffer (memory allocating version) More... | |
void | global_scatter_reduce (const Vector &toScatter, value_type *values) const |
\( v = G^\mathrm{T} w\). Globally (across processes) scatter data accross processes and reduce on multiple indices More... | |
unsigned | buffer_size () const |
The local size of the buffer vector w = local map size. More... | |
unsigned | local_size () const |
The local size of the source vector v = local size of the dg::MPI_Vector More... | |
bool | isCommunicating () const |
True if the gather/scatter operation involves actual MPI communication. More... | |
MPI_Comm | communicator () const |
The internal MPI communicator used. More... | |
virtual aCommunicator * | clone () const=0 |
Generic copy method. More... | |
virtual | ~aCommunicator () |
vritual destructor More... | |
Additional Inherited Members | |
Public Types inherited from dg::aCommunicator< Vector > | |
using | value_type = get_value_type< Vector > |
reveal value type More... | |
using | container_type = Vector |
reveal local container type More... | |
Protected Member Functions inherited from dg::aCommunicator< Vector > | |
aCommunicator (unsigned local_size=0) | |
only derived classes can construct More... | |
aCommunicator (const aCommunicator &src) | |
only derived classes can copy More... | |
aCommunicator & | operator= (const aCommunicator &src) |
only derived classes can assign More... | |
void | set_local_size (unsigned new_size) |
Set the local size of the source vector v. More... | |
Perform general gather and its transpose (scatter) operation across processes on distributed vectors using mpi.
This Communicator can perform general global gather and scatter operations. In general the index map idx[i] might or might not map an element of the source vector v. This means that the scatter matrix S can have one or more empty lines. (see aCommunicator
for more details) Compared to SurjectiveComm
the global_scatter_reduce
function needs to perform an additional scatter as some elements of the source vector might be left empty
Index | an integer thrust Vector (needs to be int due to MPI interface) |
Vector | a thrust Vector |
|
default |
no memory allocation; size 0
|
inline |
Construct from local indices and PIDs index map.
The indices in the index map are written with respect to the buffer vector. Each location in the source vector is uniquely specified by a local vector index and the process rank.
local_size | local size of a dg::MPI_Vector (same for all processes) |
localIndexMap | Each element localIndexMap[i] represents a local vector index from (or to) where to take the value buffer[i] . There are local_buffer_size = localIndexMap.size() elements. |
pidIndexMap | Each element pidIndexMap[i] represents the pid/rank to which the corresponding index localIndexMap[i] is local. Same size as localIndexMap . The pid/rank needs to be element of the given communicator. |
comm | The MPI communicator participating in the scatter/gather operations |
|
inline |
Construct from global indices index map.
Uses the global2localIdx()
member of MPITopology to generate localIndexMap
and pidIndexMap
globalIndexMap | Each element globalIndexMap[i] represents a global vector index from (or to) where to take the value buffer[i] . There are local_buffer_size = globalIndexMap.size() elements. |
p | the conversion object |
ConversionPolicy | has to have the members:
|
|
inline |
reconstruct from another type; if src is empty, same as default constructor
|
inlinefinaloverridevirtual |
|
inline |
read access to the local index index map given in constructor
|
inline |
read access to the pid index map given in constructor