[O-MPI users] [Beowulf] MPI ABI

Toon Knapen toon.knapen at fft.be
Tue Oct 11 06:44:07 PDT 2005

William Gropp wrote:
> Fortran name mangling here means how are Fortran routine names in the
> source code mapped to names in the object library.  For example, is
> MPI_Init
> in the Fortran source mapped to
> mpi_init
> mpi_init_
> mpi_init__
> MPI_Init_
> Each of these has been chosen by some Fortran 77 compiler.  Confusion
> over this is one of the most common problems that users face,
> particularly when they use command line options to *change* the way the
> Fortran compiler maps the names in their code.

but that's an easy one to solve. We already do it for BLAS and LAPACK.
Based on some preprocessor directives we generate macro's that convert
every 'dgemm' in our C/C++ app into DGEMM, dgemm_, dgemm__ etc.

It get's more complicated once the arguments are taken into account to
mangle the function-name (like in C++ and also f90 AFAICT). The x86 ABI
defines how the C++ compiler should mangle the arguments along with the
function-name but for fortran90 there is no such ABI, certainly not on
all platforms.

> Calling conventions introduce another issue.  How are Fortran CHARACTER
> data passed to and from a routine?  A common but not universal choice in
> the Unix world is to pass the address of the character data in the
> position that the argument occurs in the calling sequence and append as
> an integer value (not pointer to integer) the length of the CHARACTER
> data to the end of the argument list.  Other compilers insert the length
> immediately after the address of the character data and still others
> pass the address of a dope vector describing the character data.

There again we have routines that do 'the right thing' dependent on the
compiler that is being detected. Not very complicated (once you found
out what the convention is ;-).

>> > Fortran LOGICAL
>> could you elaborate?
> What is the value of .TRUE.?  Is it 1? 0? -1? Any negative value?  All
> of those have been used by some Fortran 77 compiler.  The Fortran
> standard leaves this up to the implementer.

Hm, I never encountered this problem yet.

The one thing about linking f77 and C that I do not know how to solve
yet is e.g. fortran functions that return a complex. I understand
functions that return e.g. a double just use the same calling convention
as C functions that return a double. Fortran functions that return a
complex however use a calling convention that is similar to C functions
that have the same argument list but with an additional complex argument
and a void return type. And I'm not sure this is the case on all
platforms BTW.


More information about the Beowulf mailing list