Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2008-10-31 13:53:00

On Oct 31, 2008, at 11:57 AM, Rajesh Ramaya wrote:

> I am completely new to MPI. I have a basic question concerning
> MPI and mixed language coding. I hope any of you could help me out.
> Is it possible to access FORTRAN common blocks in C++ in a MPI
> compiled code. It works without MPI but as soon I switch to MPI the
> access of common block does not work anymore.
> I have a Linux MPI executable which loads a shared library at
> runtime and resolves all undefined symbols etc The shared library
> is written in C++ and the MPI executable in written in FORTRAN. Some
> of the input that the shared library looking for are in the Fortran
> common blocks. As I access those common blocks during runtime the
> values are not initialized. I would like to know if what I am
> doing is possible ?I hope that my problem is clear…………..

Generally, MPI should not get in the way of sharing common blocks
between Fortran and C/C++. Indeed, in Open MPI itself, we share a few
common blocks between Fortran and the main C Open MPI implementation.

What is the exact symptom that you are seeing? Is the application
failing to resolve symbols at run-time, possibly indicating that
something hasn't instantiated a common block? Or are you able to
successfully access the data from the common block, but it doesn't
have the values you expect (e.g., perhaps you're seeing all zeros)?

If the former, you might want to check your build procedure. You
*should* be able to simply replace your C++ / F90 compilers with
mpicxx and mpif90, respectively, and be able to build an MPI version
of your app. If the latter, you might need to make your parallel
algorithm aware of what data is available in which MPI process --
perhaps not all the data is filled in on each MPI process...?

Jeff Squyres
Cisco Systems