Sie sind auf Seite 1von 24

BY , PV SUMANTH KUMAR

(08951A05A5).

Contents
1. Introduction
2. Overview of Hpjava. 3. Advantages and Disadvantages in java.

4. Characteristics of Hpjava.
5. Issues in language design. 6. Sample codes.

7. Conclusion
8. References.

1.Introduction
HPJava is a programming language extended from Java

to support parallel programming, especially (but not exclusively) data parallel programming on message passing and distributed memory systems, from multiprocessor systems to workstation clusters.

1.Overview Of Hpjava
Hpjava history:

HPJava stands for high performance java. HPJava project started around 1997, to enhance the java language. HPJava is targeted at distributed memory parallel computers. Java has advantages in visualisation and user interfaces. Since the syntax of java is simple there was scope to extend it with the features required for data-parallel computing.

Hpjava Philosophy:
HPJava lifts some ideas directly from HPF. Hpjava syntax is similar to that of java. HPJava was designed in bottom up manner.

2.Advantages and Disadvantages of java


Java is potentially an excellent platform for developing large-

scale science and engineering applications Java has advantages:


Java is descendant of C++. Java omits various features of C and C++ that are considered

difficult - e.g. pointer. Java comes with built-in multithreading. Java is portable. Java has advantages in visualisation and user interfaces

Java has Disadvantages: Though java provides parallelism through threads ,but it can be easily exploited on shared memory computers.

3.

Characteristics of Hpjava

Multidimensional arrays.
Process arrays. Distributed arrays .

The on construct and the active process group .


Other features .

Multidimensional Arrays
Multidimensional arrays:

First extension to java that adds a class of true multi-dimensional arrays to the standard Java language.

Syntax:

The type-signatures and constructors of the multidimensional array use double brackets to distinguish them from ordinary arrays: int [[,]] a = new int [[5, 5]] ; float [[,,]] b = new float [[10, n, 20]] ; int [[]] c = new int [[100]] ; a, b and c are respectively 2-, 3- and one- dimensional arrays. int [] d = new int [100] ; Note: c and d are not identical.

Multidimensional arrays(cont.)
This style of subscripting is called local subscripting.
There are good technical reasons for keeping the two kinds

of array separate. int [[,]] e = new int [[n, m]] ; ... a=e;

In the assignment simply copies a handle to object referenced by e into a. There is no element-by-element copy involved

Such time of assignments of one array to another array is

not allowed in java.

Process arrays
HPJava adds class libraries and some additional syntax for

dealing with distributed arrays. These arrays are viewed as coherent global entities. These elements are divided across a set of cooperating processes. An abstract base class Process has subclasses Procs1, Procs2, ..., representing one-dimensional process arrays, two-dimensional process arrays, and so on.
Procs2 p = new Procs2(2, 2) ; /*represents a 2by2 process array*/ Procs1 q = new Procs1(4) ; /*represent a 4-element, one-dimensional process array*/

Process arrays (cont.)


At the time the Procs () constructors are executed the program

should be executing on four or more processes. Either constructor selects four processes from this set and identifies them as members of the constructed group. The local processor must be a member function , returning a Boolean value. if(p.member())

...

} /* It gets executed if the local process is a member p */

Dimension: The multi-dimensional structure of a process array is reflected in its set of process dimensions Syntax: Dimension x = p.dim(0) ; Dimension y = p.dim(1) ; Dimension z = q.dim(0) ; /* The object returned by the dim inquiry has class Dimension*/ Coordinate: This returns the coordinate of the local process with respect to the process dimension. Inner code: if(p.member()) if(x.crd() == 0) if(y.crd() == 0) { ... } /*will only execute on the first process from p, with coordinates(0,0)*/

Process arrays (cont.)

Distributed arrays
Some or all of the dimensions of a multi-dimensional array can be

declared to be distributed ranges. Distributed range is represented by an object of class Range. A Range object defines a range of integer subscripts, and defines how they are mapped into a process array dimension. More complex subclasses of Range implement more elaborate maps from integer ranges to process dimensions. Syntax: float [[#,#,]] a = new float [[x, y, 100]] on p ; A distributed range object may appear in place of an integer extent in the
constructor of the array (the expression following the new keyword). If a particular dimension of the array has a distributed range, the corresponding slot in the type signature of the array should include a # symbol.

Distributed arrays(cont.)
In general the constructor of the distributed array must be followed by

an on clause, specifying the process group over which the array is distributed. Distributed ranges of the array must be distributed over distinct dimensions of this group. Explanation of syntax:
Defines a as a 2 by 2 by 100 array of floating point numbers. Because the first two dimensions of the array are distributed ranges. dimensions of p--a is actually realized as four segments of 100 elements, one in each of the processes of p. float [[#,#,]] a = new float [[x, y, 100]] on p, b = new float [[x, y, 100]] on p ; HPJlib.shift(a, b, -1, 0, CYCL) ; Here HPJib is a predefined function ,and shift function is used to overwrite a with b values.

The on() construct and the Active Process Group.


On() constructor: This language provides writing any function in a short way by

using a on() constructor. If(p.member()) { } The above function can be re-writed by using on constructor as : on(p) { . }

The on() construct and the Active Process Group (cont.).


Active Process Group: The language incorporates a more formal idea of an active process group (APG). At any point of execution some process group is singled out as the APG. An on(p) construct specifically changes the value of the APG to p. Languages with APG makes the language more simplified.
Example:

For the complex functions defining the active process group simplifies the statement of various rules about what operations are legal inside distributed control constructs like on().

Other features
This languages introduces a special two special type of

features They are: Sub groups Sub ranges


Sub groups: These are created in process array to create

restrictions on some co-ordinates.


Sub ranges :These are created in distributed arrays .

4.Issues in language design


Translation scheme:
The initial HPJava compiler is implemented as a source-to-source

translator converting an HPJava program to a Java node program, with calls to runtime functions . The current runtime interface for HPJava is called adJava

Extending the Java language:


It provides full object-orientation--convenient for describing complex

distributed data--implemented in a relatively simple setting, to implementation of source-to-source translators . Data types in HPJava : It consists of local and global variables. Local variable declaration is same as declaring java local variables. Global variables are declared with [[ ]] .

Issues in language design(cont.)

5.Issues in language design(cont.)


Programming convenience :
The language provides some special syntax for the programmer's

convenience. These extensions purely provide syntactic conveniences. The Adjava section hierarchy:

Sample Codes
HPJava program:
Procs p = new Procs2(2, 3); on(p) { Dimension d = p.dim(0), e = p.dim(1); System.out.println(My coordinates are( + d.crd() + , + e.crd() + ));

Sample output:
My Coordinates are (0,2) My Coordinates are(1,2) My Coordinatesare(0,0) My Coordinates are (1,0) My Coordinates are (1,1)

Sample Codes
MATRIX MULTIPLICATION:

float [[,]] c = new float [[x, y]]; float [[,*]] a = new float [[x, N]]; float [[*,]] b = new float [[N, y]]; Initialize a, b overall (i = x for :) overall (j = y for :) { c [i, j] = 0.0; for(int k = 0; k < N; k++) c[i, j] += a[i, k] * b[k, j]; }

6.Conclusion
Java is a good choice as a base language, it is easy to extend,

and its safety features greatly simplify the compiler writers task. Extending Java is easier than obtaining high performance within Javas strict language. HPJava will be most helpful for problems that have some degree of regularity. Many of the most challenging problems in modern computational science have irregular structure, so the value of our language features in those domains is more usefull.

7. References
References: URL: http://www.hpjava.org/index.html URL: http://www.hpjava.org/mpijava.html Parallel programming in HPJAVA by
Bryan carpenter ,Han-Ku-lee, Geoffrey Fox, Guansong zhang.

Wikipedia.

THANK YOU

QUERIES??