Reduction Type

Next: , Previous: Pipe, Index: Index

The reduce[root,operation] type results in MPI reduce communication. Here, all processes in the group will combine their values together at the root process and then the operation will be performed on them.

Operation Semantics
min Find the minimum value
max Find the maximum value
sum Add the values up
prod Find the product of the value
land Compute the logical and
band Compute the bitwise and
lor Compute the logical or
bor Compute the bitwise or
lxor Compute the logical xor
bxor Compute the bitwise xor
minloc Find the minimum value and location
replace Current value in the target memory is replaced by the value supplied by the origin

Examples

var t:Int::allocated[multiple[]];
var x:Int::allocated[multiple[]];
var p;
par p from 0 to 3
{
x:(x::reduce[1,"max"];
x:=p;
t:=x;
};

In this example, x is to be reduced, with the root as process 1 and the operation will be to find the maximum number. In the first assignment x:=p; all processes will combine their values of p and the maximum will be placed into process 1's x. In the second assignmentt:=x; processes will combine their values of x and the maximum will be placed into process 1's t.

Last Modified: August 2008