Group

From Mesham parallel programming language

Jump to: navigation, search

Syntax

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

where n1,n2,...,nd are specific process ranks; values, variables or texas range (with limits) 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 loop, the group guarantees that the ranks supplied will be the ranks of those processes executing the block code.
Note: Texas range of ... is supported, although this can only be between values (specifies a range) and the previous value must be smaller than or equal to the following one.

Example

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

   group 1,...,3,5,...,8 {
      print("Hello world from pid 1, 2, 3, 5, 6, 7 or 8\n");
   };
};

The code fragment will involve 9 processes (0 to 8 inclusive.) Only process zero and process three will display the first message and the second is displayed by more as described by the texas range.

Since: Version 1.0

Personal tools