Difference between revisions of "Alltoall"

From Mesham
Jump to navigationJump to search
(Created page with '== Syntax == alltoall[elementsoneach] == Semantics == Will cause each process to send some elements (the number being equal to ''elementsoneach'') to every other process in th…')
 
m (4 revisions imported)
 
(3 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
== Example ==
 
== Example ==
  
  x:array[Int,12]::allocated[multiple[]];
+
  function void main() {
var r:array[Int,3]::allocated[multiple[]];
+
    x:array[Int,12]::allocated[multiple[]];
var p;
+
    var r:array[Int,3]::allocated[multiple[]];
par p from 0 to 3
+
    var p;
{
+
    par p from 0 to 3 {
    (x:alltoall[3]):=r;
+
      (x:alltoall[3]):=r;
 +
    };
 
  };
 
  };
  
 
In this example each process sends every other process three elements (the elements in its ''r''.) Therefore each process ends up with twelve elements in ''x'', the location of each is based on the source processes's PID.  
 
In this example each process sends every other process three elements (the elements in its ''r''.) Therefore each process ends up with twelve elements in ''x'', the location of each is based on the source processes's PID.  
  
 +
''Since: Version 0.41b''
  
 
[[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

alltoall[elementsoneach]

Semantics

Will cause each process to send some elements (the number being equal to elementsoneach) to every other process in the group.

Example

function void main() {
   x:array[Int,12]::allocated[multiple[]];
   var r:array[Int,3]::allocated[multiple[]];
   var p;
   par p from 0 to 3 {
      (x:alltoall[3]):=r;
   };
};

In this example each process sends every other process three elements (the elements in its r.) Therefore each process ends up with twelve elements in x, the location of each is based on the source processes's PID.

Since: Version 0.41b