Difference between revisions of "Allreduce"

From Mesham
Jump to navigationJump to search
(Created page with '== Syntax == allreduce[operation] == Semantics == Similar to the reduce type, but the reduction will be performed on each process and the result is also available to all. …')
 
m (6 revisions imported)
 
(5 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
== Example ==
 
== Example ==
  
  var x:Int::allocated[multiple[]];
+
  function void main() {
var p;
+
    var x:Int::allocated[multiple[]];
par p from 0 to 3
+
    var p;
{
+
    par p from 0 to 3 {
    (x::allreduce["min"]):=p;
+
      (x::allreduce["min"]):=p;
 +
    };
 
  };
 
  };
  
 
In this case all processes will perform the reduction on ''p'' and all processes will have the minimum value of ''p'' placed into their copy of ''x''.
 
In this case all processes will perform the reduction on ''p'' and all processes will have the minimum value of ''p'' placed into their copy of ''x''.
  
 +
''Since: Version 0.41b''
 +
 +
== Supported operations ==
 +
 +
{{ Template:ReductionOperations }}
  
 
[[Category:Type Library]]
 
[[Category:Type Library]]
[[Category:Composite Types]]
+
[[Category:Compound Types]]
 
[[Category:Primitive Communication Types]]
 
[[Category:Primitive Communication Types]]

Latest revision as of 15:44, 15 April 2019

Syntax

allreduce[operation]

Semantics

Similar to the reduce type, but the reduction will be performed on each process and the result is also available to all.

Example

function void main() {
   var x:Int::allocated[multiple[]];
   var p;
   par p from 0 to 3 {
      (x::allreduce["min"]):=p;
   };
};

In this case all processes will perform the reduction on p and all processes will have the minimum value of p placed into their copy of x.

Since: Version 0.41b

Supported operations

Operator Description
max Identify the maximum value
min Identify the minimum value
sum Sum all the values together
prod Generate product of all values