dune-common
2.2.0
|
Specialization of CollectiveCommunication for MPI. More...
#include <dune/common/mpicollectivecommunication.hh>
Public Member Functions | |
CollectiveCommunication (const MPI_Comm &c) | |
Instantiation using a MPI communicator. | |
int | rank () const |
Return rank, is between 0 and size()-1. | |
int | size () const |
Number of processes in set, is greater than 0. | |
template<typename T > | |
T | sum (T &in) const |
Compute the sum of the argument over all processes and return the result in every process. Assumes that T has an operator+. | |
template<typename T > | |
int | sum (T *inout, int len) const |
Compute the sum of the argument over all processes and return the result in every process. Assumes that T has an operator+. | |
template<typename T > | |
T | prod (T &in) const |
Compute the product of the argument over all processes and return the result in every process. Assumes that T has an operator*. | |
template<typename T > | |
int | prod (T *inout, int len) const |
Compute the product of the argument over all processes and return the result in every process. Assumes that T has an operator*. | |
template<typename T > | |
T | min (T &in) const |
Compute the minimum of the argument over all processes and return the result in every process. Assumes that T has an operator<. | |
template<typename T > | |
int | min (T *inout, int len) const |
Compute the minimum of the argument over all processes and return the result in every process. Assumes that T has an operator<. | |
template<typename T > | |
T | max (T &in) const |
Compute the maximum of the argument over all processes and return the result in every process. Assumes that T has an operator<. | |
template<typename T > | |
int | max (T *inout, int len) const |
Compute the maximum of the argument over all processes and return the result in every process. Assumes that T has an operator<. | |
int | barrier () const |
Wait until all processes have arrived at this point in the program. | |
template<typename T > | |
int | broadcast (T *inout, int len, int root) const |
Distribute an array from the process with rank root to all other processes. | |
template<typename T > | |
int | gather (T *in, T *out, int len, int root) const |
Gather arrays on root task. | |
template<typename T > | |
int | scatter (T *send, T *recv, int len, int root) const |
Scatter array from a root to all other task. | |
operator MPI_Comm () const | |
template<typename T , typename T1 > | |
int | allgather (T *sbuf, int count, T1 *rbuf) const |
Gathers data from all tasks and distribute it to all. | |
template<typename BinaryFunction , typename Type > | |
int | allreduce (Type *inout, int len) const |
Compute something over all processes for each component of an array and return the result in every process. | |
template<typename BinaryFunction , typename Type > | |
int | allreduce (Type *in, Type *out, int len) const |
Compute something over all processes for each component of an array and return the result in every process. |
Specialization of CollectiveCommunication for MPI.
|
inline |
Instantiation using a MPI communicator.
|
inline |
Gathers data from all tasks and distribute it to all.
The block of data sent from the jth process is received by every process and placed in the jth block of the buffer recvbuf.
[in] | sbuf | The buffer with the data to send. Has to be the same for each task. |
[in] | count | The number of elements to send by any process. |
[out] | rbuf | The receive buffer for the data. Has to be of size notasks*count, with notasks being the number of tasks in the communicator. |
|
inline |
Compute something over all processes for each component of an array and return the result in every process.
The template parameter BinaryFunction is the type of the binary function to use for the computation
inout | The array to compute on. |
len | The number of components in the array |
|
inline |
Compute something over all processes for each component of an array and return the result in every process.
The template parameter BinaryFunction is the type of the binary function to use for the computation
in | The array to compute on. |
out | The array to store the results in. |
len | The number of components in the array |
|
inline |
Wait until all processes have arrived at this point in the program.
|
inline |
Distribute an array from the process with rank root to all other processes.
|
inline |
Gather arrays on root task.
Each process sends its in array of length len to the root process (including the root itself). In the root process these arrays are stored in rank order in the out array which must have size len * number of processes.
[in] | in | The send buffer with the data to send. |
[out] | out | The buffer to store the received data in. Might have length zero on non-root tasks. |
[in] | len | The number of elements to send on each task. |
[out] | root | The root task that gathers the data. |
|
inline |
Compute the maximum of the argument over all processes and return the result in every process. Assumes that T has an operator<.
|
inline |
Compute the maximum of the argument over all processes and return the result in every process. Assumes that T has an operator<.
|
inline |
Compute the minimum of the argument over all processes and return the result in every process. Assumes that T has an operator<.
|
inline |
Compute the minimum of the argument over all processes and return the result in every process. Assumes that T has an operator<.
|
inline |
|
inline |
Compute the product of the argument over all processes and return the result in every process. Assumes that T has an operator*.
|
inline |
Compute the product of the argument over all processes and return the result in every process. Assumes that T has an operator*.
|
inline |
Return rank, is between 0 and size()-1.
|
inline |
Scatter array from a root to all other task.
The root process sends the elements with index from k*len to (k+1)*len-1 in its array to task k, which stores it at index 0 to len-1.
[in] | send | The array to scatter. Might have length zero on non-root tasks. |
[out] | recv | The buffer to store the received data in. Upon completion of the method each task will have same data stored there as the one in send buffer of the root task before. |
[in] | len | The number of elements in the recv buffer. |
[out] | root | The root task that gathers the data. |
|
inline |
Number of processes in set, is greater than 0.
|
inline |
Compute the sum of the argument over all processes and return the result in every process. Assumes that T has an operator+.
|
inline |
Compute the sum of the argument over all processes and return the result in every process. Assumes that T has an operator+.