Next: Organization of the Dissertation
In this section, we present a high level overview of our HPJava.
Some predefined classes and some extra syntax for dealing with distributed
arrays are added into the basic language, Java.
We will briefly review the features of the HPJava language by showing simple
In this section, we will only give an overview of features.
Detailed description of those features will be presented
in the Chapter 3.
Features of HPJava
Figure 1.1 is a basic HPJava program for sequential matrix
This program is simple and similar to the ordinary Java program.
It uses simple sequential multiarrays--a feature HPJava adds to
standard Java. A multiarray uses double brackets to
distinguish the type signature from a standard Java array. The multiarray and
ordinary Java array have many similarities. Both arrays have some index space
and stores a collection of elements of fixed type.
Syntax of accessing a multiarray is very similar with accessing ordinary
Java array which uses single brackets, but an HPJava sequential multiarray
uses double bracket and asterisks for its type signature.
The most significant difference between ordinary Java array and
the multiarray of HPJava is that the distributed array is
true multi-dimensional array like the arrays of Fortran, while ordinary
Java only provides arrays of arrays.
These features of Fortran arrays have adapted and evolved to support
scientific and parallel algorithms.
Sequential Matrix multiplication in HPJava.
HPJava also adds a distributed array feature to the base
language Java. The distributed array is a very important feature of
HPJava. Like the name says, the elements of the distributed array are
distributed among processes: each process only has a portion of the data.
As we can see from the parallel version (Figure 1.2) of
matrix multiplication, HPJava puts a hyphen in the type signature to indicate
a particular dimension is distributed over processes.
Input arrays a and b and result array c are
The array c is distributed in both its dimensions
while array a and b each have one distributed dimension and one
Figure 1.2 is a simple program but it includes much of the
HPJava special syntax.
In this program, we can see some unusual key words and operations
which we do not see in an ordinary Java program like control constructs
on and overall. There are also some added standard classes, like
Procs2, and BlockRange.
The class Procs2 represents 2-dimensional grids of processes selected
from the set of available processes.
The on construct makes p the active process group
within its body, and
only the processes that belong to p execute the code inside of the
Distribution format of each dimension of a distributed array is represented
by a Range class.
The BlockRange class used in this example describes
We also have a control construct which represents distributed parallel loops,
similar the forall construct in High Performance Fortran (HPF),
The overall construct introduced a distributed index for
subscripting a distributed array.
The program in Figure 1.2 depends on a special
alignment relation between its distributed arrays.
A parallel Matrix multiplication in HPJava.
We can create a general purpose matrix multiplication routine that works for
arrays with any distributed format (Figure 1.3) from
Figure 1.2 using collective communication.
This program take arrays which may be distributed in both their dimensions, and
copies into the temporary array with a special distribution format for better
performance. A collective communication schedule remap() is used to copy
the elements of one distributed array to another.
From the viewpoint of this dissertation, the most important part of this code
is communication method. We can divide the communication library of HPJava into
two parts: the high-level Adlib library, and the low-level mpjdev
library. The Adlib library is responsible for the collective communication
the mpjdev library is responsible for the actual communication.
One of the most characteristic and important communication library methods,
remap(), takes two arrays as arguments and copies the elements of
the source array to the destination array, regardless of the distribution
format of the two arrays.
In addition to the features described above, many more features
and communication functions available to the HPJava are described
in the Chapter 3 and Chapter 4.
The HPJava software including Adlib and mpjdev is
available for free download from www.hpjava.org.
A general Matrix multiplication in HPJava.
Next: Organization of the Dissertation