Difference between revisions of "Group"

From Mesham
Jump to navigationJump to search
m (14 revisions imported)
 
(12 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
};<br>
 
};<br>
  
where n1,n2,...,nd are specific process ranks, either values of variables known at compile time.
+
where n<sub>1</sub>,n<sub>2</sub>,...,n<sub>d</sub> are specific process ranks; values, variables or texas range (with limits) known at compile time.
  
 
== Semantics ==
 
== 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.<br><br>
 
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.<br><br>
''Note:'' Unlike a ''par'' loo, the ''group'' guarantees that the ranks supplied will be the ranks of those processes executing the block code.<br>
+
''Note:'' Unlike a ''par'' loop, the ''group'' guarantees that the ranks supplied will be the ranks of those processes executing the block code.<br>
''Note:'' This is a blocking construct and regardless of arguments involves all processes who will either ignore it or execute the block.
+
''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 ==
 
== Example ==
  
 
  #include <io>
 
  #include <io>
  group 0, 3 {
+
  function void main() {
    print("Hello world from pid 0 or 3\n");
+
    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 4 processes (0 to 3 inclusive.) Only process zero and process three will display the message.
+
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''
  
 
[[Category:Parallel]]
 
[[Category:Parallel]]

Latest revision as of 15:44, 15 April 2019

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