Reduce is a collective algorithm that combines the values stored by each process into a
single value available at the designated root process. This particular variant of
Reduce<(Of <(T>)>)(T, ReductionOperation<(Of <(T>)>), Int32) applies to each of the elements
of the provided arrays. Each process must provide arrays of the same length, and the values at each
array index are combined
in a user-defined way, specified via a delegate. If value1, value2, ..., valueN
are the ith values provided by the N processes in the communicator, the ith result will be the value
value1 op value2 op ... op valueN. The resulting array is only
available to the root process. If all processes need the result of the reduction,
use Allreduce<(Of <(T>)>)(array<T>[]()[], ReductionOperation<(Of <(T>)>), array<T>[]()[]%).
Namespace:
MPIAssembly: MPI (in MPI.dll)
Version: 1.0.0.0 (1.0.0.0)
Syntax
| C# |
|---|
public void Reduce<T>( T[] inValues, ReductionOperation<T> op, int root, ref T[] outValues ) |
| Visual Basic (Declaration) |
|---|
Public Sub Reduce(Of T) ( _ inValues As T(), _ op As ReductionOperation(Of T), _ root As Integer, _ ByRef outValues As T() _ ) |
| Visual C++ |
|---|
public: generic<typename T> void Reduce( array<T>^ inValues, ReductionOperation<T>^ op, int root, array<T>^% outValues ) |
Parameters
- inValues
- Type: array<
T
>[]()[]
The local values that will be combined with the values provided by other processes.
- op
- Type: MPI..::.ReductionOperation<(Of <(T>)>)
The operation used to combine two values. This operation must be associative.
- root
- Type: System..::.Int32
The rank of the process that is the root of the reduction operation, which will receive the result of the reduction operation in its outValue argument.
- outValues
- Type:
array<
T
>[]()[]
%
The variable that will receive the results of the reduction operation. Only the root process will receive the actual result; all other processes will receive a default-initialized value. When this collective operation returns, outValues will be of the same length as inValues.
Type Parameters
- T
- Any serializable type.