Discontinuous Galerkin Library
#include "dg/algorithm.h"
|
mpi Vector class More...
Public Types | |
typedef container | container_type |
Public Member Functions | |
MPI_Vector () | |
no data is allocated, communicators are MPI_COMM_NULL More... | |
MPI_Vector (const container &data, MPI_Comm comm) | |
construct a vector More... | |
template<class OtherContainer > | |
MPI_Vector (const MPI_Vector< OtherContainer > &src) | |
Conversion operator. More... | |
const container & | data () const |
Get underlying data. More... | |
container & | data () |
Set underlying data. More... | |
MPI_Comm | communicator () const |
Get the communicator to which this vector belongs. More... | |
MPI_Comm | communicator_mod () const |
Returns a communicator of fixed size 128. More... | |
MPI_Comm | communicator_mod_reduce () const |
Returns a communicator consisting of all processes with rank 0 in communicator_mod() More... | |
void | set_communicator (MPI_Comm comm, MPI_Comm comm_mod, MPI_Comm comm_mod_reduce) |
Set the communicators with dg::exblas::mpi_reduce_communicator . More... | |
unsigned | size () const |
Return the size of the data object. More... | |
void | swap (MPI_Vector &src) |
Swap data and communicator. More... | |
mpi Vector class
This class is a simple wrapper around a container object and an MPI_Comm. The blas1 and blas2 functionality is available iff it is available for the container type. We use mpi to communicate (e.g. boundary points in matrix-vector multiplications) and use the existing blas functions for the local computations. (At the blas level 1 communication is needed only for scalar products)
container | local container type. Must have a size() and a swap() member function and a specialization of the TensorTraits class. |
typedef container dg::MPI_Vector< container >::container_type |
typedef to acces underlying container
|
inline |
no data is allocated, communicators are MPI_COMM_NULL
|
inline |
construct a vector
calls dg::exblas::mpi_reduce_communicator()
(collective call)
data | internal data copy |
comm | MPI communicator (may not be MPI_COMM_NULL ) |
|
inline |
Conversion operator.
uses conversion between compatible containers
OtherContainer | another container class (container must be copy constructible from OtherContainer) |
src | the source |
|
inline |
Get the communicator to which this vector belongs.
|
inline |
Returns a communicator of fixed size 128.
|
inline |
Returns a communicator consisting of all processes with rank 0 in communicator_mod()
|
inline |
Set underlying data.
|
inline |
Get underlying data.
|
inline |
Set the communicators with dg::exblas::mpi_reduce_communicator
.
The reason why you can't just set the comm and need three parameters is that generating communicators involves communication, which you might want to avoid when you do it many times. So you have to call the function as
|
inline |
Return the size of the data object.
data.size()
|
inline |
Swap data and communicator.
src | communicator and data is swapped |