Perform surjective gather and its transpose (scatter) operation across processes on distributed vectors using mpi.
More...
|
| SurjectiveComm () |
| no memory allocation; size 0 More...
|
|
| SurjectiveComm (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 > |
| SurjectiveComm (const thrust::host_vector< int > &globalIndexMap, const ConversionPolicy &p) |
| Construct from global indices index map. More...
|
|
template<class OtherIndex , class OtherVector > |
| SurjectiveComm (const SurjectiveComm< 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...
|
|
const Index & | getSortedIndexMap () const |
|
virtual SurjectiveComm * | clone () const override final |
| Generic copy method. More...
|
|
bool | isLocalBijective () const |
| No reduction on this process? True: no reduction, False: need to reduce. 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::SurjectiveComm< Index, Vector >
Perform surjective gather and its transpose (scatter) operation across processes on distributed vectors using mpi.
This Communicator performs surjective global gather and scatter operations, which means that the index map is surjective: If the index map idx[i] is surjective, each element of the source vector v maps to at least one location in the buffer vector w. This means that the scatter matrix S can have more than one 1's in each line. (see aCommunicator
for more details) Compared to BijectiveComm
in the global_gather
function there is an additional gather and in the global_scatter_reduce
function a reduction needs to be performed.
- Template Parameters
-
Index | an integer thrust Vector (needs to be int due to MPI interface) |
Vector | a thrust Vector |
template<class Index , class Vector >
template<class ConversionPolicy >
dg::SurjectiveComm< Index, Vector >::SurjectiveComm |
( |
const thrust::host_vector< int > & |
globalIndexMap, |
|
|
const ConversionPolicy & |
p |
|
) |
| |
|
inline |
Construct from global indices index map.
Uses the global2localIdx()
member of MPITopology to generate localIndexMap
and pidIndexMap
- Parameters
-
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 |
- Template Parameters
-
ConversionPolicy | has to have the members:
bool global2localIdx(unsigned,unsigned&,unsigned&) const; where the first parameter is the global index and the other two are the output pair (localIdx, rank). return true if successful, false if global index is not part of the grid
MPI_Comm communicator() const; returns the communicator to use in the gather/scatter
local_size(); return the local vector size
|
- See also
- Topology base classes the MPI grids defined in Level 3 can all be used as a ConversionPolicy
- Note
- we assume that the index map is surjective