[Beowulf] Java vs C++ for interfacing to parallel library

Joe Landman landman at scalableinformatics.com
Sun Aug 20 05:43:10 PDT 2006


Jonathan Ennis-King wrote:
> Does anyone have experience writing parallel Java code (using MPI) with
> calls to C libraries which also use MPI? Is this possible/sensible? Is
> there a big performance hit relative to doing the same in C++?

Unless all of the important optimizable calculation is done in libraries
that you are stitching together with Java glue, the compiled languages
are likely to be quite a bit faster.

There is a sizeable abstraction penalty associated with OO languages.
Many of the design patterns that they encourage (object factories,
inheritance chains, etc) are anathema to high performance.

> I'm considering writing some parallel code to do fluid flow in porous
> media, the heart of which is solving systems of sparse linear equations.
> There are some good libraries in C which provide the parallel solver
> (e.g. PETSC), but I'm trying to resolve which language to use for my
> code. The choice is between C++ and Java, and although I'm favouring
> Java at present, I'm not sure about its performance in this context.

Hmmm.  For this, C or Fortran may be far more appropriate.  Depends upon
what it is you want to do with the code.  High performance using MPI
depends upon many factors.  If there is one particular part of the code
that is better served by an OO based language, then I might suggest
designing/implementing all the speed sensitive bits in a language which
lets you achieve high performance, and then interfacing them to your OO
language so that the OO system isn't being used for the critical time
sensitive portions.

>   Jonathan Ennis-King
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit

Joseph Landman, Ph.D
Founder and CEO
Scalable Informatics LLC,
email: landman at scalableinformatics.com
web  : http://www.scalableinformatics.com
phone: +1 734 786 8423
fax  : +1 734 786 8452 or +1 866 888 3112
cell : +1 734 612 4615

More information about the Beowulf mailing list