Group

From Mesham
Revision as of 13:42, 12 January 2013 by Polas (talk | contribs) (Created page with '== Syntax == group n1,n2,...,nd<br> {<br> group body<br> };<br> where n1,n2,...,nd are specific process ranks, either values of variables known at compile time. == Semantics =…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Syntax

group n1,n2,...,nd
{
group body
};

where n1,n2,...,nd are specific process ranks, either values of variables known at compile time.

Semantics

Will execute the group body on different processes as specified by the programmer. This allows the programmer to write code MPMD style and, unlike the par block, Mesham guarantees process placement. Variables declared to be multiply allocated within parallel scope, such as a par block, will automatically be allocated just to the subgroup of processes within that scope.

Note: Unlike a par loo, the group guarantees that the ranks supplied will be the ranks of those processes executing the block code.
Note: This is a blocking construct and regardless of arguments involves all processes who will either ignore it or execute the block.

Example

#include <io>
group 0, 3 {
   print("Hello world from pid 0 or 3\n");
};

The code fragment will involve 4 processes (0 to 3 inclusive.) Only process zero and process three will display the message.