next up previous contents
Next: Restricted process groups Up: Groups Previous: Groups   Contents

The process grid

Any DAD group will have a parent processor arrangement. The preceding discussion about the DAD was supposed to be at a logical, design level. But from now on we will need to become more concrete. So we give specific interfaces in C++5. A C++ run-time representation of an HPF processor arrangement would naturally be implemented as an object (just as a group or communicator is logically an object in MPI). We can easily see that the HPF directive

!HPF$ PROCESSORS P(4)
might map to a C++ declaration something like
    Procs1 p(4);
and
!HPF$ PROCESSORS Q(2, 2)
might map to a C++ declaration something like
    Procs2 q(2, 2);
This supposes that Procs1 is a class of one-dimensional process grids and Procs2 is a class of two-dimensional grids6. We will generalize to a family (class hierarchy) of process grids illustrated in Figure 3.

Figure 3: A hierarchy of process grids.
\begin{figure}\centerline{\psfig{figure=procs.eps,height=1.2in}}\end{figure}

What methods are needed on the Procs class? Looking back at Figure 1 we see that we need the ability to check if the local process is a member of the process grid in question, and we need to find the coordinates of the local process relative to the grid. Later we will find that it is useful to have a separate concept of process dimension--one dimension of a process grid. We introduce another class--Dimension--to stand for this concept. Finding the coordinate becomes a method on the dimension class. Concrete interfaces for Procs and Dimension are given in Figure 4.

Figure 4: Interfaces of Procs and Dimension.
\begin{figure}\small\begin{verbatim}class Procs {
public:
int member() cons...
...ize() const ;int crd() const ;
...
} ;\end{verbatim}\normalsize\end{figure}

If we decided we wanted to use these primitives in a C++ version of our original translation example, the lines

      INTEGER W_RANK, ...
      ...

      MPI_COMM_RANK(MPI_COMM_WORLD, W_RANK, ERRCODE)
      ...

      IF (W_RANK < 4) THEN
          BLK_START = W_RANK * BLK_SIZE
          ...
      ENDIF
could be replaced with something like
    Procs1 p(4);
    ...

    if (p.member()) {
        blk_start = p.dim(0).crd() * blk_size ;
        ...
    }

A Procs object is probably not particularly ``lightweight''. It is likely to contain a vector of Dimension objects and probably some vector defining how logical processes are mapped to physical processes, and so on. Most likely a DAD should not contain a copy of this information, but some reference to an externally created Procs object.


next up previous contents
Next: Restricted process groups Up: Groups Previous: Groups   Contents
Bryan Carpenter 2002-07-12