F90_CALLS_C++_AND_MPI
Mixed Language MPI Programming


F90_CALLS_C++_AND_MPI is a directory of FORTRAN90 programs which illustrate the use of the MPI Message Passing Interface in situations in which a C++ function is involved in the calculation.

Please note that this example takes advantage of the ISO C binding module, which was actually only introduced into the FORTRAN standard as part of FORTRAN 2003. Your compiler may be willing to let your FORTRAN90 program access it. If not, you might consider moving to FORTRAN 2003!.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

F90_CALLS_C+++_AND_MPI is available in a FORTRAN90 version.

Related Data and Programs:

F90_CALLS_C++, FORTRAN90 programs which call a C++ function.

F90_CALLS_C_AND_MPI, FORTRAN90 programs which call a C function while executing under the MPI parallel programming environment.

MPI, FORTRAN90 programs which illustrate the use of the MPI application program interface for carrying out parallel computations in a distributed memory environment.

Reference:

  1. William Gropp, Ewing Lusk, Anthony Skjellum,
    Using MPI: Portable Parallel Programming with the Message-Passing Interface,
    Second Edition,
    MIT Press, 1999,
    ISBN: 0262571323,
    LC: QA76.642.G76.

Examples and Tests:

QUAD estimates an integral by evaluating a function at N points. Under MPI, P processes are used, each of which evaluates the function at N/P points, and the results are combined. In this example, the main program sets up MPI, but then calls an underlying function to compute the partial results. This function is written in C++. The Intel IFORT FORTRAN compiler we are using automatically appends an underscore to function names, so in the C++ code we have explicitly added an underscore to the end of the C++ function that is called by the FORTRAN90 main program (because I didn't feel like looking up the FORTRAN90 compiler option to suppress the underscore addition).

You can go up one level to the FORTRAN90 source codes.


Last revised on 13 January 2012.