|
| NearestNeighborComm (MPI_Comm comm=MPI_COMM_NULL) |
| no communication More...
|
|
| NearestNeighborComm (unsigned n, const unsigned vector_dimensions[3], MPI_Comm comm, unsigned direction) |
| Construct. More...
|
|
template<class OtherIndex , class OtherBuffer , class OtherVector > |
| NearestNeighborComm (const NearestNeighborComm< OtherIndex, OtherBuffer, OtherVector > &src) |
| Construct from other Communicator. More...
|
|
unsigned | n () const |
| halo size More...
|
|
const unsigned * | dims () const |
| The dimensionality of the input vector. More...
|
|
unsigned | direction () const |
| The direction of communication. More...
|
|
MPI_Comm | communicator () const |
| The internal MPI communicator used. More...
|
|
Buffer | allocate_buffer () const |
| Allocate a buffer object. More...
|
|
unsigned | buffer_size () const |
| The size of the halo. More...
|
|
bool | isCommunicating () const |
| True if the gather/scatter operation involves actual MPI communication. More...
|
|
int | map_index (int i) const |
| Map a local matrix index to a buffer index. More...
|
|
void | global_gather_init (const_pointer_type input, buffer_type &buffer, MPI_Request rqst[4]) const |
| Gather values from given Vector and initiate asynchronous MPI communication. More...
|
|
void | global_gather_wait (const_pointer_type input, const buffer_type &buffer, MPI_Request rqst[4]) const |
| Wait for asynchronous communication to finish and gather received data into buffer. More...
|
|
template<class Index, class
Buffer, class Vector>
struct dg::NearestNeighborComm< Index, Buffer, Vector >
Communicator for asynchronous nearest neighbor communication.
Imagine a communicator with Cartesian topology and further imagine that the grid topology is also Cartesian (vectors form a box) in two or three dimensions. In each direction this box has a boundary layer (the halo) of a depth given by the user. Each boundary layer has two neighboring layers, one on the same process and one lying on the neighboring process. What this class does is to provide you with six pointers to each of these six layers (three on each side). The pointers either reference data in an internal communication buffer (since it involves communciation to get the layers from neighboring processes) another buffer (if mpi communication requires to reorder input data) or the input vector itself (if the communication goes along the last dimension there is no need to reorder, in fact, here is the main gain we get from the pointer approach, we save on unnecessary data copies, which might be significant in cases where the communication to computation ratio is high). The size of the data each pointer references is the halo size, buffer_size()
The communication is done asynchronously i.e. the user can initiate the communication and signal when the results are needed at a later stage.
- Note
- If the number of neighboring processes in the given direction is 1, the buffer size is 0 and all members return immediately.
-
the pointers may alias each other (if the input contains less than 4 layers)
-
the corresponding gather map is of general type and the communication can also be modeled in
GeneralComm
, but not BijectiveComm
or SurjectiveComm
- Attention
- Currently we cannot handle the case where the whole vector is the boundary layer (i.e.
buffer_size()==input.size()
and both neighboring layers are on different processes)
- Template Parameters
-
Index | the type of index container (must be either thrust::host_vector<int> or thrust::device_vector<int>) |
Buffer | the container for the pointers to the buffer arrays |
Vector | the vector container type must have a resize() function and work in the thrust library functions ( i.e. must a thrust::host_vector or thrust::device_vector) |
- See also
- dg::RowColDistMat