Java2Fortran
how ?
more ? (links)
Contact
mail
me !
|
|
Why combine Java and Fortran?
|
Why did I choose this solution ? Combining Java and
Legacy Fortran Code to achieve parallelism.
The Programming Languages Choice
Fortran begins to look rather old fashioned especially
in the computer scientist’s world. Nevertheless with the introduction of
Fortran 90, the language has been modernized and still used a lot in the
engineering world. Fortran is still indeed the world’s most widely used
scientific programming language and the most effective language for computational
science. Furthermore we chose Fortran for our simulation because:
It is particularly well suited to solve
numerical problems
It is available on nearly all platforms (uniquely
on some).
The well proven code we based this implementation
on was written in Fortran. Re-implementing this simulation in Java or in
C would have been much too time consuming and would have required the full
involvement of a fluid dynamics engineer to guarantee the correctness of
the re-implementation. The fluid dynamics model that we had to implement
is indeed really complex. Furthermore Java is not suited at all for expensive
scientific computation. Our idea was then to use the legacy code the way
it was previously written as much as possible. We wanted to avoid making
unnecessary changes, and just make the essential modifications that would
allow us to achieve the parallelization.
Note that we did not use Fortran 90 despite
its great features, but Fortran 77 instead because the legacy code we used
was written in Fortran 77 and also because we wanted our simulation to
be portable to the same platforms it previously was.
However the fact is that Fortran does not contain
(as Java does) standardized and platform independent constructs for creating
user interfaces, managing threads, networking, and a variety of other tasks
associated with creating applications. Thus there is interest in following
a design in which the parallelization task (the thread management) is written
in Java, but the core computational component is written in Fortran.
Building a Java Fortran Interface
Making Java and Fortran routines talk to each
other is not easy, but achievable at least on Unix Solaris systems. A few
researchers have been investigating this interfacing and ended up with
different solutions but followed the same scheme as we did: they built
the Fortran to Java Interface via C. C-Fortran interface indeed exists
but is strongly platform dependent, we will fully present it. For
further details or other platform interfacing we recommend the reader to
refer to the section more.
This technique has been successfully applied for
this implementation. It is a significant achievement in the sense that
it provides the developer with a means to exploit Java parallelism features
but also Java GUI features while still using their long running and
well-validated Fortran legacy code. However such interfacing is highly
platform dependent and great attention has to be paid and sensible modification
could be required if one intended to port this implementation onto another
platform.

Quotes:
""The notion itself may provoke giggles from
object-oriented bigots, who view Fortran as a holdover from the Jurassic
era. But if they tried comparing the speed of Java and Fortran for writing
and executing numerical codes, they'd stop snickering. Fortran is like
a chef's meat cleaver, in comparison to C's Swiss Army knife: it's only
good for one thing, but it does that very well. I guess Java is like a
Leatherman that's been run over by a truck--lots of really cool tools,
but many don't work very well at this point. A larger collection of tools
can only help
you solve problems. ""
cf. Combining Java and Fortran, Mark Fardal,
at http://donald.phast.umass.edu/~fardal/jfpage/javafortran.shtml
""While people are debating whether or not Java
is good for computationally intensive tasks, the fact is that C, C++ and
Fortran are the primary languages for those who do scientific/technical
computing. It also seems unlikely that this situation will change in the
near future. Unfortunately, C, C++ and Fortran do not contain (as Java
does) standardized and platform independent constructs for creating user
interfaces, managing threads, networking, and a variety of other tasks
associated with creating "applications". Thus, there is interest in
creating applications in which the user interface,
or other "application packaging", is written in Java, but the core computational
component is written in C, C++, or Fortran""
cf. Putting a Java Interface on your C, C++ or
Fortran Code , Chris Anderson, Department of Mathematics, UCLA, at p://www.math.ucla.edu/~anderson/JAVAclass/JavaInterface/Files.html
|