Channel Type
Next: Pipe,
Previous: ASync,
Index: Index
The channel[a,b] type will specify that a variable is a channel from process a (sender) to process b (receiver.) Normally this will result in MPI_Send and MPI_Recv, although if the async type is used then MPI_Irecv and MPI_Isend is generated instead. Note that channel is unidirectional - process a sends and b receives, NOT the otherway around.
Examples
var x:Int::allocated[multiple[]];
var p;
par p from 0 to 2
{
(x::channel[0,2]):=193;
var hello:=(x::channel[0,2]);
};
In this case, x is a channel between processes 0 and 2. In the par loop process 0 sends the value 193 to process 2. Then the variable hello is declared and process 2 will issue an MPI Recv in order to receive this value.
Note: When receiving, the value will be copied into the channel variable as well as the Lvariable, so in the example above on process 2 both x and hello will contain the value 193.
Last Modified: August 2008