Fortran 77 Binding Issues

Fortran 77 Binding Issues

Up: Language Binding Next: C Binding Issues Previous: Language Binding

All MPI names have an MPI_ prefix, and all characters are capitals. Programs must not declare variables or functions with names beginning with the prefix, MPI_. This is mandated to avoid possible name collisions.

All MPI Fortran subroutines have a return code in the last argument. A few MPI operations are functions, which do not have the return code argument. The return code value for successful completion is MPI_SUCCESS. Other error codes are implementation dependent; see Chapter MPI Environmental Management .

Handles are represented in Fortran as INTEGERs. Binary-valued variables are of type LOGICAL.

Array arguments are indexed from one.

Unless explicitly stated, the MPI F77 binding is consistent with ANSI standard Fortran 77. There are several points where this standard diverges from the ANSI Fortran 77 standard. These exceptions are consistent with common practice in the Fortran community. In particular:

  • MPI identifiers are limited to thirty, not six, significant characters.
  • MPI identifiers may contain underscores after the first character.
  • An MPI subroutine with a choice argument may be called with different argument types. An example is shown in Figure 1 . This violates the letter of the Fortran standard, but such a violation is common practice. An alternative would be to have a separate version of MPI_SEND for each data type.
  • Although not required, it is strongly suggested that named MPI constants ( PARAMETERs) be provided in an include file, called mpif.h. On systems that do not support include files, the implementation should specify the values of named constants.
  • Vendors are encouraged to provide type declarations in the mpif.h file on Fortran systems that support user-defined types. One should define, if possible, the type MPI_ADDRESS, which is an INTEGER of the size needed to hold an address in the execution environment. On systems where type definition is not supported, it is up to the user to use an INTEGER of the right kind to represent addresses (i.e., INTEGER*4 on a 32 bit machine, INTEGER*8 on a 64 bit machine, etc.).

double precision a 
         integer b 
         call MPI_send(a,...) 
         call MPI_send(b,...) 

Figure 1: An example of calling a routine with mismatched formal and actual arguments.

All MPI named constants can be used wherever an entity declared with the PARAMETER attribute can be used in Fortran. There is one exception to this rule: the MPI constant MPI_BOTTOM (section Address and extent functions ) can only be used as a buffer argument.

Up: Language Binding Next: C Binding Issues Previous: Language Binding

Return to MPI Standard Index
Return to MPI home page