Difference between revisions of "Scatter"
From Mesham
Jump to navigationJump to search (Created page with '== Syntax == scatter[elements,root] == Semantics == Will send a number of elements (equal to ''elements'') from the root process to all other processes. == Example == var …') |
m (4 revisions imported) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
== Example == | == Example == | ||
− | var x:array[Int,3]::allocated[multiple[]]; | + | function void main() { |
− | + | var x:array[Int,3]::allocated[multiple[]]; | |
− | + | var r:array[Int,12]::allocated[multiple[]]; | |
− | + | var p; | |
− | + | par p from 0 to 3 { | |
− | + | x:(x::scatter[3,1]); | |
− | + | x:=r; | |
+ | }; | ||
}; | }; | ||
− | In this example, three elements of array ''r'', on process 1, are scattered to each other process and placed in their copy of ''r''. | + | In this example, three elements of array ''r'', on process 1, are scattered to each other process and placed in their copy of ''r''. |
+ | |||
+ | ''Since: Version 0.41b'' | ||
[[Category:Type Library]] | [[Category:Type Library]] | ||
− | [[Category: | + | [[Category:Compound Types]] |
[[Category:Primitive Communication Types]] | [[Category:Primitive Communication Types]] |
Latest revision as of 15:44, 15 April 2019
Syntax
scatter[elements,root]
Semantics
Will send a number of elements (equal to elements) from the root process to all other processes.
Example
function void main() { var x:array[Int,3]::allocated[multiple[]]; var r:array[Int,12]::allocated[multiple[]]; var p; par p from 0 to 3 { x:(x::scatter[3,1]); x:=r; }; };
In this example, three elements of array r, on process 1, are scattered to each other process and placed in their copy of r.
Since: Version 0.41b