Difference between revisions of "Group"

From Mesham
Jump to navigationJump to search
Line 1: Line 1:
 +
{{DISPLAYTITLE:xyz}}
 
''Since: Version 1.0''
 
''Since: Version 1.0''
{{DISPLAYTITLE:xyz}}
 
 
== Syntax ==
 
== Syntax ==
  

Revision as of 18:01, 13 January 2013

Since: Version 1.0

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.