\chapter{Conclusion and Future Work}
\label{chap:conclusion}

\pagestyle{myheadings}
\markright{CHAPTER~\ref{chap:conclusion}. CONCLUSION AND FUTURE WORK}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Conclusion}
We have explored the practicality of doing parallel computing in Java,
and of providing Java interfaces to High Performance Computing
software.  
%For various reasons, the success of this exercise was not a
%foregone conclusion.  
Java sits on a virtual machine model significantly different to the
hardware-oriented model that C or Fortran exploit directly.  Java
discourages or prevents direct access to the some of the fundamental
resources of the underlying hardware.

Our earliest experiments in this direction involved working entirely
within Java, building new software on top of the communication
facilities of the standard API.  The work in Chapters
\ref{chap:hpjava} and \ref{chp:mpiJava} involved creating a Java
interface to an existing HPC package.
In the long term Java may become a major implementation language for
large software packages like MPI.  It certainly has advantages in
respect of portability that could simplify implementations
dramatically.  In the immediate term recoding these packages does not
appear so attractive.  Java wrappers to existing software look more
sensible.  On a cautionary note, our experience with MPI suggests that
interfacing Java to non-trivial communication packages may be less
easy than it sounds.  Nevertheless, we intend to create a Java
interface to an existing run-time library for data parallel
computation.

So is Java, as it stands, a good language for High Performance
Computing?

It still has to be demonstrated that Java can be compiled to code of
efficiency comparable with C or Fortran.  Many avenues are being
followed simultaneously towards a {\em higher performance} Java. 
For example, IBM is developing an optimizing Java compiler that 
produces binary code directly.

Our final interface to MPI is quite elegant, and provides much
of the functionality of the standard C and Fortran bindings.  But
creating this interface was a more difficult process than one might
hope, both in terms of getting a good specification, and in terms of
making the implementation work.  We noted
that the lack of features like C++ templates (or any form of parametric
polymorphism) and user-defined operator overloading (available in many
modern languages)
made it difficult to produce a completely satisfying interface to a
data parallel library.  The Java language as currently defined imposes
various limits to the creativity of the programmer.

In many respects Java is undoubtedly a better language than Fortran.
It is object-oriented and highly dynamic, and there is
every reason to suppose that such features will be as valuable in
scientific computing as in any other programming discipline.  But to
displace established scientific programming languages Java will probably
have to acquire some of the facilities taken for granted in those
languages.

%The particular conclusions for HPJava and mpiJava are as follow:

In this dissertation, we have discussed motivations for introducing HPJava, 
an HPspmd programming model.
HPJava language extensions provide much of the
expressive power of HPF, but in a strictly SPMD environment with a
good communication library.
It allows programs to combine data parallel code and SPMD library calls 
directly.
Because of the relatively low-level programming
model, interfacing to other parallel-programming paradigms is more
natural than in HPF.  With suitable care, it is possible to make
direct calls to, say, MPI from within the data parallel program.
The object-oriented features of Java are also exploited
to give an elegant parameterization of the distributed arrays of the
extended language.


We have discussed the design and development of mpiJava---a
pure Java interface to MPI. 
mpiJava provides a fully functional and efficient Java
interface to MPI. 
When used for distributed computing the current implementation
of mpiJava does not impose a huge overhead on-top of the
native MPI interface.
Interfacing Java to MPI is not always trivial---in earlier
implementation we often saw low-level conflicts between the Java
runtime and the interrupt mechanisms used in the MPI implementations. 
The new \emph{native} thread feature in JDK 1.2 has eliminated the
interrupt problem that we encountered with earlier releases of the JDK. 
mpiJava is now stable on UNIX and Linux platforms using MPICH
and JDK 1.2 .
The syntax of mpiJava is easy to understand and use,
thus making it relatively simple for programmers with either a Java or
Scientific background to take up. 
We believe that mpiJava will also provide a popular
means for teaching students the fundamentals of parallel programming
with MPI. 


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Contributions}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The major contributions of this research is the proposing the potential
of Java as a language for scientific parallel programming, and then
providing Java interfaces to High Performance Computing software. 

\begin{itemize}

%\item {We have designed and proposed a high-level structured SPMD
%programming style, \emph{HPJava}.  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 multi-processor systems
%to workstation clusters.  We propose introducing some of the
%characteristic ideas of HPF---specifically its distributed array model
%and array intrinsic functions and libraries---into a basically SPMD
%programming model.
%}

\item {We have developed an object-oriented Java interface to MPI,
{\em mpiJava}. We have discussed the design of the mpiJava API
and the issues associated with its development. In addition we have
presented the steps necessary to port mpiJava onto a range of
operating systems, including Windows NT, Linux and Solaris. 
The 2nd version of the mpiJava package has been released and
more than 400 people have downloaded it from all around the world.
The releases of mpiJava include complete source, makefiles,
configuration scripts, compiled libraries for WMPI, release test codes
(based on the IBM MPI test suite), example applications, javadoc
documentation, and installation and usage notes.  
The software is publically available from:  
\begin{verbatim}
  http://aspen.csit.fsu.edu/pss/HPJava/mpiJava.html
\end{verbatim}

}

\item {We have developed the Java object serialization model for
marshalling general communication data 
in MPI-like APIs.  This approach is compared with a Java transcription
of the standard MPI derived datatype mechanism.  We described an
implementation of the mpiJava interface to MPI that
incorporates automatic object serialization.  Benchmark results
confirm that current JDK implementations of serialization are not fast
enough for high performance messaging applications.  Means of solving
this problem are discussed, and benchmarks for greatly improved
schemes are presented.
}

\item {Finally, we have developed mpiJava version of Monte Carlo spin
models using a parallel Java random number genrator. We also have
evaluated these with comparable native parallel MPI-C and MPI-Fortran
and sequential C, F77 and Java codes for performance comparison.
In addition we have presented graphical parallel Potts model
simulation with GUI using Java AWT and sample code that directly calls 
to MPI (mpiJava) from within the data parallel program (HPJava).
}

\end{itemize}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Future Work}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The work presented in this dissertation can be extended in various
directions.
%directions to support the following features:

\subsection{HPJava} 
The HPJava translator will be completed in the future version of HPJava. 
Further research works will include optimization and
safety-checking techniques in the compiler for HPJava. At the same
time, further SPMD libraries could be integrated into the framework.
These include more extensive irregular 
communication (CHAOS-like), one-sided access to array sections (GA-like)
and higher-level applications-oriented libraries (DAGH, ScaLAPACK).
Implementing a full test suite and evaluating performance of HPJava on large
scale applications is also interested.

\subsection {mpiJava}
Improved mpiJava can be developed by adding in some of the
functionality that has been proposed in MPI-2 \cite{MPI2}. 
It would be valuable to port mpiJava to new MPI environments,
including IBM, LAM \cite{LAM} and Globus \cite{GLOBUS}.  
We are also planning
a \emph{pure} Java MPI environment which does not rely on native MPI
services. One of the advantage of pure Java MPI over our mpiJava is
its high portability. There are many issues in pure Java
implementation. These include starting remote tasks, resource
discovery, communication base, and handling partial failures.  

\subsection {The Task and Data-parallel Cluster Algorithms}
The major computational task of cluster algorithms is the
identification and labeling of the clusters of connected sites, given
the configuration of bonds.
Due to highly irregular and non-local nature of the cluster,
it is very difficult to efficiently implement
cluster identification algorithms on SIMD computers \cite{Coddington91}. 
This problem can be solved efficiently by utilizing a mixture of both
task and data parallelism in application   
such as implementing Swendsen-Wang code working in HPF using a call to an
extrinsic function to do the component labeling in MPI.
However we found that the overhead to switch between HPF and MPI is
large, and creating distributed arrays and accessing their local and
remote elements is clumsy and errot-prone in HPF. 
It is expected that component labeling can be implemeted in HPJava
efficiently since the HPJava framework has better prospects for
dealing effectively with task parallel programming. We plan to develop
SPMD style cluster algorithms in HPJava with direct calls to MPI.  


In addition, there are many aspects of Java that should be improved.
These include Java's object serialization, Remote Method Invocation, and
enhancements in the Java Native Interface. 






