libsc
2.8.7
The SC library provides support for parallel scientific applications.
|
Self-contained implementations of MPI_Reduce and MPI_Allreduce. More...
#include <sc.h>
Go to the source code of this file.
Macros | |
#define | SC_REDUCE_ALLTOALL_LEVEL 3 |
The highest recursion level that uses direct all-to-all. | |
Typedefs | |
typedef void(* | sc_reduce_t) (void *sendbuf, void *recvbuf, int sendcount, sc_MPI_Datatype sendtype) |
Prototype for a user-defined reduce operation. | |
Functions | |
int | sc_allreduce_custom (void *sendbuf, void *recvbuf, int sendcount, sc_MPI_Datatype sendtype, sc_reduce_t reduce_fn, sc_MPI_Comm mpicomm) |
Custom allreduce operation with reproducible associativity. More... | |
int | sc_reduce_custom (void *sendbuf, void *recvbuf, int sendcount, sc_MPI_Datatype sendtype, sc_reduce_t reduce_fn, int target, sc_MPI_Comm mpicomm) |
Custom reduce operation with reproducible associativity. More... | |
int | sc_allreduce (void *sendbuf, void *recvbuf, int sendcount, sc_MPI_Datatype sendtype, sc_MPI_Op operation, sc_MPI_Comm mpicomm) |
Drop-in MPI_Allreduce replacement with reproducible associativity. More... | |
int | sc_reduce (void *sendbuf, void *recvbuf, int sendcount, sc_MPI_Datatype sendtype, sc_MPI_Op operation, int target, sc_MPI_Comm mpicomm) |
Drop-in MPI_Reduce replacement with reproducible associativity. More... | |
Self-contained implementations of MPI_Reduce and MPI_Allreduce.
Our motivation for writing these alternatives is reproducible associativity. With this implementation, the associativity of the reduction operation depends on the size of the communicator only and does not suffer from random or otherwise obscure influences.
Both algorithms use a binary communication tree. We provide implementations via a customizable reduction operator as well as drop-in replacements for minimum, maximum, and sum. We do not currently support user-defined MPI datatypes.
int sc_allreduce | ( | void * | sendbuf, |
void * | recvbuf, | ||
int | sendcount, | ||
sc_MPI_Datatype | sendtype, | ||
sc_MPI_Op | operation, | ||
sc_MPI_Comm | mpicomm | ||
) |
Drop-in MPI_Allreduce replacement with reproducible associativity.
Currently we support the operations minimum, maximum, and sum.
[in] | sendbuf | Send buffer conforming to MPI specification. |
[out] | recvbuf | Receive buffer conforming to MPI specification. |
[in] | sendcount | Number of data items to reduce. |
[in] | sendtype | Valid MPI datatype. |
[in] | operation | sc_MPI_MIN, sc_MPI_MAX, or sc_MPI_SUM. We abort otherwise. |
[in] | mpicomm | Valid MPI communicator. |
int sc_allreduce_custom | ( | void * | sendbuf, |
void * | recvbuf, | ||
int | sendcount, | ||
sc_MPI_Datatype | sendtype, | ||
sc_reduce_t | reduce_fn, | ||
sc_MPI_Comm | mpicomm | ||
) |
Custom allreduce operation with reproducible associativity.
[in] | sendbuf | Send buffer conforming to MPI specification. |
[out] | recvbuf | Receive buffer conforming to MPI specification. |
[in] | sendcount | Number of data items to reduce. |
[in] | sendtype | Valid MPI datatype. |
[in] | reduce_fn | Custom, associative reduction operator. |
[in] | mpicomm | Valid MPI communicator. |
int sc_reduce | ( | void * | sendbuf, |
void * | recvbuf, | ||
int | sendcount, | ||
sc_MPI_Datatype | sendtype, | ||
sc_MPI_Op | operation, | ||
int | target, | ||
sc_MPI_Comm | mpicomm | ||
) |
Drop-in MPI_Reduce replacement with reproducible associativity.
Currently we support the operations minimum, maximum, and sum.
[in] | sendbuf | Send buffer conforming to MPI specification. |
[out] | recvbuf | Receive buffer conforming to MPI specification. |
[in] | sendcount | Number of data items to reduce. |
[in] | sendtype | Valid MPI datatype. |
[in] | operation | sc_MPI_MIN, sc_MPI_MAX, or sc_MPI_SUM. We abort otherwise. |
[in] | target | The MPI rank that obtains the result. |
[in] | mpicomm | Valid MPI communicator. |
int sc_reduce_custom | ( | void * | sendbuf, |
void * | recvbuf, | ||
int | sendcount, | ||
sc_MPI_Datatype | sendtype, | ||
sc_reduce_t | reduce_fn, | ||
int | target, | ||
sc_MPI_Comm | mpicomm | ||
) |
Custom reduce operation with reproducible associativity.
[in] | sendbuf | Send buffer conforming to MPI specification. |
[out] | recvbuf | Receive buffer conforming to MPI specification. |
[in] | sendcount | Number of data items to reduce. |
[in] | sendtype | Valid MPI datatype. |
[in] | reduce_fn | Custom, associative reduction operator. |
[in] | target | The MPI rank that obtains the result. |
[in] | mpicomm | Valid MPI communicator. |