Par
From Mesham
Jump to navigationJump to search
Syntax
par p from a to b
{
par body
};
Semantics
The parallel equivalent of the for loop, each iteration will execute concurrently on different processes. This allows the programmer to write code MPMD style, with the limitation that bounds a and b must be known during compilation. All (variable sharing) communication in a par loop is performed using one sided communication, whereas variable sharing SPMD style is performed using synchronous communication for performance reasons.
Example
var p; par p from 0 to 10 { print["Hello from process ",p,"\n"]; };
The code fragment will spawn 11 processes (0 to 10 inclusive) and each will display a message.