next up previous
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.

   figure68
Figure 1: Structured processes

The two ranges associated with the group p are,

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

dim(int) is a member function return a range reference, which corresponds to a processor dimension.

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;

As shown in the figure, 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. For example, it is not difficult to imagine, and we will see that the following code,

  on(p) {
    ...
  }

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

The language also provided well defined constructs to switch execution control among processes according to data items we want to access. This will be introduced later.



Guansong Zhang
Mon Feb 23 15:47:12 EST 1998