next up previous contents
Next: Distributed Arrays Up: The HPJava Language Previous: Multiarrays   Contents


Processes

An HPJava program is started concurrently in all members of some process collection[*]. From HPJava's point of view, the processes are arranged by special objects representing process groups. In general the processes in an HPJava group are arranged in multidimensional grids. Suppose that a program is running concurrently on 6 or more processes. Then, one defines a 2 $ \times $ 3 process grid by:

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{verbatim}
Procs2 p = new Procs2(2, 3) ;\end{verbatim}\end{minipage}
$

Procs2 is a class describing 2-dimensional grids of processes. Figure 3.1 illustrates the grid p, which assumes that the program was executing in 11 processes. The call to the Procs2 constructor selected 6 of these available processes and incorporated them into a grid.
Figure 3.1: The process grids illustrated by p
\includegraphics[height=1.8in]{Figures/process_grids}
Figure 3.2: The Group hierarchy of HPJava.
\includegraphics[height=1.8in]{Figures/group-hierarchy}
Procs2 is a subclass of the special base class Group. The Group class has a special status in the HPJava language. Figure 3.2 illustrates the full Group hierarchy. Procs0 is a zero-dimensional process grid, which can only have one process. Procs1 is one-dimensional process grid. Generally, ProcsN is an N-dimensional process grid. After creating p, we will want to run some code within the process group. The on construct limits control to processes in its parameter group. The code in the on construct is only executed by processes that belong to p. The on construct fixes p as the active process group within its body.
Figure 3.3: The process dimension and coordinates in p.
\includegraphics[height=2in]{Figures/procs2dims}
The Dimension class represents a specific dimension or axis of a particular process grid. Called process dimensions, these are available through the inquiry method dim(r), where $ r$ is in the range $ 0,...,R-1$ ($ R$ is the rank of the grid). Dimension has a method crd(), which returns the local process coordinate associated with the dimension. Thus, the following HPJava program crudely illustrates the process dimension and coordinates in p from Figure 3.3.

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{verbatim}
Procs2 p = ...
...(''('' + d.crd() + '', '' + e.crd() + '')'') ;
}\end{verbatim}\end{minipage}
$


next up previous contents
Next: Distributed Arrays Up: The HPJava Language Previous: Multiarrays   Contents
Bryan Carpenter 2004-06-09