next up previous contents
Next: Distributed data Up: Introduction to Adlib Previous: Introduction to Adlib

Defining a process array

Adlib provides a series of classes Procs1, Procs2, ... derived from a common base class Procs. These classes represent multi-dimensional process arrays. A process array represents a set of logical processes over which data and work can be divided.

Logical processes may have a one-to-one mapping to physical processors, but this is not required. If there are more logical processes than available processors, Adlib will transparently map multiple processes to each processor (at some cost in performance). If there are fewer logical processes than processors, each logical process is mapped to a different processor, and some processors hold none of the logical processes in the array.

A rank-2 (two-dimensional) process array p is declared by

  Procs2 p(2, 2) ;
p represents 4 processes arranged in a two by two array. The shape of a process array should be chosen by the programmer to suit the the intended distribution format (blocking) of data arrays. There is no implied pattern of connectivity or nearness between individual processes.

The declaration of p is completely analogous to the HPF declaration

  !HPF$ PROCESSORS P (2, 2)

A process array is activated by using the member function on, and deactivated again by using the member no. We will always use these functions in the context of an if construct, like this:

  if(p.on()) {
    // ... some code
  } p.no() ;
This idiom is called an on construct. The on member returns a truth value which is non-zero if the processor executing the code holds one or more processes from p. So the code inside the construct is only executed by processors which hold part of p. After the p.on() call, p is designated the active process group. It loses this status after the p.no() call.



Bryan Carpenter
Fri Feb 23 15:40:28 EST 1996