Perform bijective gather and its transpose (scatter) operation across processes on distributed vectors using mpi.
More...
|
| BijectiveComm ()=default |
| no memory allocation; size 0 More...
|
|
| BijectiveComm (const thrust::host_vector< int > &pids, MPI_Comm comm) |
| Construct from a given scatter map (inverse index map) with respect to the source/data vector. More...
|
|
| BijectiveComm (unsigned local_size, thrust::host_vector< int > localIndexMap, thrust::host_vector< int > pidIndexMap, MPI_Comm comm) |
| Construct from local indices and PIDs index map. More...
|
|
template<class ConversionPolicy > |
| BijectiveComm (const thrust::host_vector< int > &globalIndexMap, const ConversionPolicy &p) |
| Construct from global indices index map. More...
|
|
template<class OtherIndex , class OtherVector > |
| BijectiveComm (const BijectiveComm< OtherIndex, OtherVector > &src) |
| reconstruct from another type; if src is empty, same as default constructor More...
|
|
const thrust::host_vector< int > & | get_pids () const |
| These are the pids that were given in the Constructor. More...
|
|
virtual BijectiveComm * | clone () const override final |
| Generic copy method. More...
|
|
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...
|
|
template<class Index, class Vector>
struct dg::BijectiveComm< Index, Vector >
Perform bijective gather and its transpose (scatter) operation across processes on distributed vectors using mpi.
If the index map idx[i] is bijective, each element of the source vector v maps to exactly one location in the buffer vector w. In this case the scatter matrix S is the inverse of G. (see aCommunicator
for more details)
int i = myrank;
double values[8] = {i,i,i,i, 9,9,9,9};
thrust::host_vector<double> hvalues( values, values+8);
int pids[8] = {0,1,2,3, 0,1,2,3};
thrust::host_vector<int> hpids( pids, pids+8);
thrust::host_vector<double> hrecv = coll.global_gather( hvalues);
thrust::host_vector<double> hrecv2( hvalues.size());
coll.global_scatter_reduce( hrecv, hrecv2);
BijectiveComm()=default
no memory allocation; size 0
- Template Parameters
-
Index | an integer thrust Vector (needs to be int due to MPI interface) |
Vector | a thrust Vector |
- Note
- a scatter followed by a gather of the received values restores the original array
-
The order of the received elements is according to their original array index (i.e. a[0] appears before a[1]) and their process rank of origin ( i.e. values from rank 0 appear before values from rank 1)