Table 3 lists the predefined operations for use
with MPI_ALLREDUCE, MPI_REDUCE, MPI_REDUCE_SCATTER and MPI_SCAN. To
invoke a predefined operation, place any of the following reductions in
op.
Table 3. Predefined reduction operations
| Operation | Description |
|---|---|
| MPI_BAND | bitwise AND |
| MPI_BOR | bitwise OR |
| MPI_BXOR | bitwise XOR |
| MPI_LAND | logical AND |
| MPI_LOR | logical OR |
| MPI_LXOR | logical XOR |
| MPI_MAX | maximum value |
| MPI_MAXLOC | maximum value and location |
| MPI_MIN | minimum value |
| MPI_MINLOC | minimum value and location |
| MPI_PROD | product |
| MPI_REPLACE | f(a,b) = b (the current value in the target memory is replaced by the value supplied by the origin) |
| MPI_SUM | sum |
Table 4 lists the basic datatype arguments of the reduction
operations.
Table 4. Valid datatype arguments
| Type | Arguments |
|---|---|
| Byte | MPI_BYTE |
| C integer |
MPI_INT MPI_LONG MPI_LONG_LONG_INT MPI_SHORT MPI_UNSIGNED MPI_UNSIGNED_LONG MPI_UNSIGNED_LONG_LONG MPI_UNSIGNED_SHORT |
| C pair |
MPI_DOUBLE_INT MPI_FLOAT_INT MPI_LONG_INT MPI_LONG_DOUBLE_INT MPI_SHORT_INT MPI_2INT |
| Complex | MPI_COMPLEX |
| Floating point |
MPI_DOUBLE MPI_DOUBLE_PRECISION MPI_FLOAT MPI_LONG_DOUBLE MPI_REAL |
| FORTRAN integer |
MPI_INTEGER MPI_INTEGER8 |
| FORTRAN pair |
MPI_2DOUBLE_PRECISION MPI_2INTEGER MPI_2REAL |
| Logical | MPI_LOGICAL |
Table 5 lists the valid datatypes for each op
option.
Table 5. Valid datatypes for the op option
| Type | Datatypes |
|---|---|
| Byte |
MPI_BAND MPI_BOR MPI_BXOR MPI_REPLACE |
| C integer |
MPI_BAND MPI_BOR MPI_BXOR MPI_LAND MPI_LOR MPI_LXOR MPI_MAX MPI_MIN MPI_PROD MPI_REPLACE MPI_SUM |
| C pair |
MPI_MAXLOC MPI_MINLOC MPI_REPLACE |
| Complex |
MPI_PROD MPI_REPLACE MPI_SUM |
| Floating point |
MPI_MAX MPI_MIN MPI_PROD MPI_REPLACE MPI_SUM |
| FORTRAN integer |
MPI_BAND MPI_BOR MPI_BXOR MPI_MAX MPI_MIN MPI_PROD MPI_REPLACE MPI_SUM |
| FORTRAN pair |
MPI_MAXLOC MPI_MINLOC MPI_REPLACE |
| Logical |
MPI_LAND MPI_LOR MPI_LXOR MPI_REPLACE |