The first question to answer is why use Java as a base language? Actually, the programming model embodied in HPJava is largely language-independent. It can be bound to other languages like C, C++, and Fortran. But Java is a convenient base language, especially for initial experiments, because it provides full object-orientation -- convenient for describing complex distributed data -- implemented in a relatively simple setting, conducive to development of source-to-source translators. It has been noted elsewhere that Java has various features suggesting it could be an attractive language for science and engineering .
With Java as a base language, an obvious question is whether we can extend the language by simply adding packages, instead of changing the syntax. There are two problems with doing this for data-parallel programming.
Our baseline is HPF, and any package supporting parallel arrays as general as HPF is likely to be cumbersome to code with. Our run-time system needs an (in principle) infinite series of class names
Array1dI, Array1cI, Array2ddI, Array2dcI, ...to express the HPJava types
int [], int [[*]], int [[,]], int [[,*]] ...as well as the corresponding series for char, float, and so on. To access an element of a distributed array in HPJava, one writes
a[i] = 3 ;In the adJava interface, it must be written as
a.dat()[a.pos(i)] = 3 ;This is only for simple subscripting. Constructing array sections will be even more complex using the raw class library interface.
The second problem is that a Java program using a package like adJava in a direct, naive way will have very poor performance, because all the local address of the global array are expressed by functions such as pos. An optimization pass is needed to transform offset computation to a more intelligent style. So if a preprocessor must do these optimizations anyway, it makes sense to design a syntax to express the concepts of the programming model more naturally.