First, we will look at the actual calling formats used by MPI.
C bindings
For C, the general format is
- rc = MPI_Xxxxx(parameter, ... )
Note that case is important here, as it is with all C code.
For example, MPI must be capitalized, as must be the first character after the underscore. Everything after that must be lower case. The return code is rc, and is type integer. Upon success, it is set to MPI_SUCCESS.
C programs should include the file "mpi.h". This contains definitions for MPI constants and functions.
Fortran bindings
For Fortran, the general form is
- Call MPI_XXXXX(parameter,..., ierror)
Note that case is
not important here.
So, an equivalent form would be
- call mpi_xxxxx(parameter,..., ierror)
Instead of the function returning with an error code, as in C, the Fortran versions of MPI routines usually have one additional parameter in the calling list, ierror, which is the return code. Upon success, ierror is set to MPI_SUCCESS.
Fortran programs should usually include 'mpif.h' (see note below). This contains definitions for MPI constants and functions.
Note: The Fortran Compiler produces warning messages for programs that call MPI_Send and MPI_Recv with different type arguments, which are valid. Although the messages from the compiler are only warnings, the executables fail to run. In Windows the Fortran solution requires the statement use mpi, rather than an include 'mpif.h' statement. Add the file C:\Program Files\MPIPro\include\mpif.f90 to the project. It is required to create the module MPI.mod that is invoked by use mpi.
Fortran programs should usually include 'mpif.h', but when you are using the Fortran Compiler in Windows and including MPI_Send and MPI_Recv with different type arguments, the Fortran solution requires the statement use mpi, rather than an include statement. Add the file C:\Program Files\MPIPro\include\mpif.f90 to the project. It is required to create the module MPI.mod that is invoked by use mpi. Both files contain definitions for MPI constants and functions.
For both C and Fortran
The exceptions to the above formats are the timing routines (MPI_Wtime and MPI_Wtick) which are functions for both C and Fortran, and return double-precision reals. Case considerations are the same as for the other MPI calls.