Gather Type

Next: , Previous: Broadcast, Index: Index

The gather[elements,root] type will gather a number of elements (equal to elements) from each process and send these to the root process.

Examples

var x:array[Int,12] :: allocated[single[on[2]]];
var r:array[Int,3] :: allocated[multiple[]];
var p;
par p from 0 to 3
{
(x::gather[3,2]):=r;
};

In this example, the variable x is allocated on root process,2, only. Whereas r is allocated on all processes. In the assignment, three elements of r are gathered from each process and sent to the root process (2) and then placed into variable x in the order defined by the source PID.

Last Modified: August 2008