Next: Global variables Up: Basic concepts Previous: Subgroup and Subrange

### Structured SPMD programming

When a process group is defined, a set of Range and Location reference also have been defined. as in figure 1.

The two associated ranges with the group p are,

  Range u=p.dim(0);
Range v=p.dim(1);


Group.dim(int) is a member function return a Range reference. It corresponds to a processor dimension, which reflects the basic meaning of a range. This range can be considered either a block range with its size as one, or a cyclic range of its extent the same as the processor number. More complicated ranges can be derived from it. Currently, the language supports block range, cyclic range. The distribution format for these two ranges can be show in figure 2. Besides a collapsed range, defined as duplicated positions on each process in the dimension is also provided.

Combining block range and cyclic range will get block-cyclic distribution. For example,

  Range v1=new CyclicRange(20, v);
Range v2=new BlockRange(100, v1);


will create a cyclic(5) distribution on the second dimension of the processor.

We define the range representing processor dimension as level 0 range, and range based on it one level higher. So u and v are level 0 ranges, v1 is a level 1 range and v2 is a level 2 range2.

Further more, we can get a location in Range u, and use it to create a new group,

  Location i = u|1;
Group q = p/i;


We also can create a subrange of v by writing

  v|1::2


Note that in Group p, it need two locations to locate the processor with a dotted circle. They are i mapped from Range u, and a new location j mapped from Range v.

  Location j = v|0;


From the figure, we can see that Group p is a highly structured concept, and all the notions introduced around it contribute to program execution control in the new programming language.

In a traditional SPMD program, execution control is based on if statements and process id or rank numbers. In the new programming language, switching execution control is based on the structured process group we introduced above, for example, it is not difficult to think that the following code

  on(p) {
...
}


will switch the execution control inside the bracket to processes in Group p.

Further more, the language provided well defined constructs to switch execution control among processes according to data items we want to access. Therefor, we call the programming model introduced here structured SPMD programming.

Next: Global variables Up: Basic concepts Previous: Subgroup and Subrange
Bryan Carpenter 2002-07-12